![](https://cdn-images-1.medium.com/max/1024/1*n7pUw0AcAgrHHBFrgsbZmQ.jpeg)
Introduction
The exploration focuses on examining the workings of Dialogflow CX, a tool that assists in human-like conversations, and the advanced Gemini Pro model, a highly intelligent AI. It focuses on demonstrating their combined impact in revolutionizing the development of conversational agents. It’s all about how these two join forces to transform how we create these interactive virtual assistants.
The weblog will underscore the pivotal role of agent generation in transforming user experiences and optimizing interactions. It will elucidate how the fusion of Dialogflow CX and the Gemini Pro model elevates the creation of conversational agents, making interactions more intuitive, seamless, and human-like.
Exploration of Dialogflow CX
The weblog will provide an in-depth understanding of Dialogflow CX, highlighting its pivotal role in crafting intelligent conversational agents. Readers will gain insights into its features, functionalities, and its unique position in the realm of conversational AI platforms.
Let’s begin by creating a Dialogflow agent with a knowledge base.
1. Google signup
To start using Dialogflow you need to have a Google Account. If you already use Gmail, you can log in using that account. Or you can create a new Google account.
2. Create a Project
To start with a new chatbot development in Dialogflow, we need to create a project. And make sure that Dialogflow API is enabled from your Google Cloud Console.
If your API is not enabled refer to this https://support.google.com/googleapi/answer/6158841?hl=en document. Enable Dialogflow API.
![](https://cdn-images-1.medium.com/max/590/0*6z0XW2NX3rCZqAN5.png)
3. Create an Agent
To start with a new chatbot development in Dialogflow, we need to create an agent.
- Click on which type of bot you want to create, here we select ‘Build Your Own’ to create our custom bot.
![](https://cdn-images-1.medium.com/max/1024/0*PFiuk0qppiB3L4G8.png)
Provide a name for your agent and select the default timezone. Choose the default language as per your preference.
Click on ‘Create’.
![](https://cdn-images-1.medium.com/max/748/0*B3pOlwnkEmUoG2Zn.png)
Exploration of Gemini Pro Model
The Gemini Pro model is a powerful generative AI tool developed by Google DeepMind. It excels at several tasks, making it a versatile option for various applications, including Knowledge Base Dialogflow.
Integrating Gemini Pro into platforms like Dialogflow potentially enhances the chatbot’s ability to understand and respond to user queries more effectively, particularly within a knowledge base setup.
It might incorporate multi-modal capabilities, allowing it to process and generate responses based not only on text but also on other modalities like images or structured data, though the extent of this integration might vary.
With Gemini Pro, now developers can build “agents” that can process and act on information.
What is Bucket?
Cloud Storage Buckets serve as fundamental storage units for your data. All information stored in Cloud Storage must reside within a bucket. These buckets enable data organization and access control. However, unlike directories or folders, they do not support nesting of other buckets within them.
- You can create an unlimited number of buckets within a project or location.
- Upon creating a bucket, you assign it a globally unique name and designate a geographic location for storing both the bucket and its contents.
- The pricing structure, covering costs for data storage, processing, and outbound data transfer, is influenced by factors like the bucket’s location and the storage classes of its objects. For detailed information, refer to cloud Storage pricing.
- Identity and Access Management (IAM) is used to control access to individual buckets.
When creating the bucket, you have to remember these things.
- Ensure you’ve chosen the project associated with the agent you’re using.
- Use Standard Storage class.
- Ensure the bucket location aligns with your agent’s designated location.
4. Create buckets
To create a new bucket, go to the Cloud Storage Buckets page and click on the ‘Create’ button.
![](https://cdn-images-1.medium.com/max/645/0*lDHe3bye7qzk6Pj2.png)
![](https://cdn-images-1.medium.com/max/1024/0*hZznsXvj6wZOCoYo.png)
![](https://cdn-images-1.medium.com/max/1024/0*5PXTHsj0a1m61a2G.png)
Enter a globally unique bucket name, choose from the available options for your buckets, and click on ‘Create’.
![](https://cdn-images-1.medium.com/max/1024/0*DWBAz9o7ek1QmLng.png)
![](https://cdn-images-1.medium.com/max/1024/0*XYCmNGHXO_5cVq1W.png)
You can create a folder, upload files, upload a folder, and transfer data to and from here. Additionally, you can directly upload files by clicking on ‘Upload Files’.
What is a Data stores?
Data store agents utilize data stores to locate answers to user queries within your data. These stores comprise various websites and documents, all referencing your data.
When a user poses a question, the agent seeks an answer within the provided content, condensing the information into a clear response. It also offers relevant source links, allowing users to explore further. The agent can furnish a maximum of five concise answer snippets per question.
5. Create a data store
To create a new data store, navigate to the ‘Data Stores’ option in the left-hand menu under the ‘Manage’ tab.
![](https://cdn-images-1.medium.com/max/329/0*jxWfmlnWO92CaNwA.png)
Click on ‘NEW DATA STORE’.
![](https://cdn-images-1.medium.com/max/1024/0*Dma4FQoMioCc_KDB.png)
Select a Data Source for your data store, and which types of data you want to store in your data store.
![](https://cdn-images-1.medium.com/max/1024/0*Qchr4DuLdSx2SFO2.png)
Various sources are available for supplying your data, like Website URLs, BigQuery, and Cloud Storage, data can be structured or unstructured, and it can be with or without metadata.
Import data from GCS
Click on the ‘browser’ to view the bucket data, which includes files and folders. Select the files or folders you want to import, and also specify the types of data you wish to import.
Click on ‘Continue’.
![](https://cdn-images-1.medium.com/max/1024/0*AOhZ1DOEMw7M95dL.png)
Give a name to your data store and click on ‘Create’.
![](https://cdn-images-1.medium.com/max/1024/0*T8AKSIR0ccstWfUH.png)
What is a Data store agent?
Data store agents, a unique variant of Dialogflow agents, offer LLM-generated agent responses derived from your website content and uploaded data.
To create a data store agent, you have to supply data stores during its creation.
Data store agents feature specialized state handlers called data store handlers, allowing your agent to engage end-users in conversations about the content.
6. Create a data store agent
Go to the Search and Conversation page or click on Create Vertex AI Search and Conversation app.
![](https://cdn-images-1.medium.com/max/1024/0*c2MHd_rRYNYhO2-p.png)
Click on ‘NEW APP’.
![](https://cdn-images-1.medium.com/max/1024/0*BI1k2Qlo1J0234xA.png)
Select the type of application you want to create, for example, we have chosen the Chat option.
![](https://cdn-images-1.medium.com/max/1024/0*CNKqqyofZrrFOxas.png)
Fill in all the required details, and then click on ‘Continue’.
![](https://cdn-images-1.medium.com/max/1024/0*hmY2U3mJ5Cp0AsNx.png)
Link a data store to your agent by performing one of the following actions:
- Select the data store if you already created it.
- Otherwise, Click on CREATE NEW DATA STORE.
Click on ‘Create’.
![](https://cdn-images-1.medium.com/max/1024/0*rs1eD29f1wgKG1mt.png)
A Data Store agent is created.
7. Verify your agent’s performance by conducting tests
The Dialogflow CX simulator is available for testing your agent.
Select your project name and agent name, then click on ‘Test Agent’.
![](https://cdn-images-1.medium.com/max/1024/0*fyv1Jt1KowBD9DMr.png)
We display the agent’s response to the user’s inquiries here.
![](https://cdn-images-1.medium.com/max/1015/0*1E9YUZxQ4_ua_QnX.png)
Improve the agent’s generative responses
Click on ‘Agent Settings’, and open the Agent Settings page.
Navigate to the ‘Generative AI’ sub-tab, which offers several options to enhance the quality of an agent’s generative responses.
Further down the page, you’ll find an option related to ‘Grounding confidence’.
Grounding confidence
We measure the confidence level of responses created from your connected data store, ensuring the information aligns with the data. You can adjust the allowed response types by setting the minimum confidence level. Responses falling below this threshold won’t be displayed.
You have the choice of selecting from five confidence levels:
- Very low
- Low
- Medium
- High
- Very high
![](https://cdn-images-1.medium.com/max/924/0*aYmwb3UV9v8A3BN6.png)
Click on the dropdown box it displays the various options for confidence level.
Select any one option.
![](https://cdn-images-1.medium.com/max/756/0*cuH6USMu9c7hdXNP.png)
Data store prompt
You can improve the quality of the responses generated from the data store content by including additional information about the agent.
![](https://cdn-images-1.medium.com/max/917/0*-ABrn4YlU0c2jR0f.png)
![](https://cdn-images-1.medium.com/max/914/0*Lg-1YLuWB7XztASQ.png)
Fill in all required details.
Once you’ve completed this section, either partially or entirely, you’ll find, on the right side under “Your prompt,” a brief paragraph generated from these settings. This paragraph will be used in generating answers.
Here, is an example of a prompt:
Your name is Indian Road Safety, and you are a helpful and polite Road Safety Officer at Indian Road Safety Agency, Promoting road safety nationwide. Your task is to assist humans in providing information for OFFENCES, PENALTIES, AND PROCEDURE in India.
Select the generative model
You can choose the generative model that a data store agent uses for the summarization of generative requests.
![](https://cdn-images-1.medium.com/max/750/0*qHHBWhPGmnMWAIFK.png)
8. Add or edit data store handlers for an existing agent
Apply flows or pages to the data store handlers.
Select the flow associated with the data store handler. Commonly it is the default start flow.
Select the page associated with the data store handler. Commonly it is the start page.
Click ‘Add state handler’, then select Data Store and click on ‘Apply’.
![](https://cdn-images-1.medium.com/max/476/0*YNeBml4W69Vhkobg.png)
![](https://cdn-images-1.medium.com/max/460/0*t_BiQisn0xJKQk6e.png)
If you want to create a new data store, then click on the search and conversation app.
![](https://cdn-images-1.medium.com/max/1024/0*vGCRhjgrm5eMlpQl.png)
Click on the ‘+’ symbol to add the data store.
![](https://cdn-images-1.medium.com/max/528/0*ikXYXC_e373CjzJ6.png)
Select the data store that you have already created and click on Save.
![](https://cdn-images-1.medium.com/max/638/0*B6GUGcCyXC1OJSUa.png)
Agent responses
In the section for Agent responses, you can create custom replies that make use of generative answers as references.
Use $request.knowledge.questions[0] in the ‘Agent says’ section for generative answers.
![](https://cdn-images-1.medium.com/max/596/0*WihV9Xl4qOqt1MHz.png)
Outcomes
We tested several questions related to Road Rules and Regulations for India using the Gemini Pro Model.
We’ve included some of the tested questions here,
Q1: If I drive a vehicle without a license then what happens
Ans: If you drive a vehicle without a license, you may be fined Rs. 5000.
Q2: Can I drive a vehicle without a permit
Ans: No, you cannot drive a vehicle without a permit.
Q3: vehicle permit is compulsory?
Ans: Yes, a permit is required to use a motor vehicle as a transport vehicle in any public place, whether or not it is carrying passengers or goods. The permit must be granted or countersigned by a Regional or State Transport Authority or any prescribed authority.
Q4: Unauthorized user drive a vehicle then any fine for that?
Ans: Yes, there is a fine for unauthorized users driving a vehicle. The fine is 5000 rupees.
We’ve additionally included a screenshot containing these same questions.
Follow the steps above to add or edit data store handlers for an existing agent.
Conclusion
By harnessing the combined power of Dialogflow CX’s conversational management and Gemini Pro’s generative AI capabilities, we’re entering a new era of conversational AI where building chatbots becomes more intuitive and efficient, shifting from complex coding to natural language prompts and datastore. Now the Conversations become seamless, human-like, and contextually aware, leading to more engaging and satisfying interactions.
Originally published at Build An AI Chatbot Using A Generative AI Model With Dialogflow Knowledge Base on February 2, 2024.
Build an AI Chatbot using a Generative AI Model with Dialogflow Knowledge Base. was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.