Table of contents
Official Content
  • This documentation is valid for:

This is a step-by-step guide to create a conversational assistant with internet search using Flows in Globant Enterprise AI.

This Flow manages two assistants: a Chat Assistant that answers questions using internet search results, and another Chat Assistant that rephrases follow-up questions (based on the conversation history) as standalone questions. In addition, it includes a Search API component.

Step 1: Configuring the Work Environment

To get started, first, make sure you have access to the Globant Enterprise AI Backoffice and are familiar with the interface for creating Flows

Step 2: Creating Chat Assistants

In this step, two Chat Assistants are created. They are called 'Response from Search' and 'Follow-up Rephrase'.

'Response from Search' Chat Assistant

This Chat Assistant generates answers for the end user based solely on the results of an internet search, without using prior knowledge or inventing information. It takes the provided search results and uses them to answer the end user's question in the best possible way. If necessary, the answer can include rich text in HTML format, but Markdown should not be used to format the answer.

LLM Settings:

AI Provider: Google VertexAI
Model: gemini-1.5-pro
Temperature: 0.10
Max Output Tokens: 8192

Prompt:

INSTRUCTIONS
------------
Your task is to generate a response for the user based on the results of an internet search.
DO NOT USE PRIOR KNOWLEDGE AND DO NOT MAKE UP INFORMATION USE THE SEARCH RESULTS.
Given the following results from an internet search and NOT PRIOR KNOWLEDGE answer the user question the best you can.

SEARCH RESULTS
--------------
{searchResults}

RESPONSE FORMAT
---------------
For the response you can generate RICH TEXT USING HTML if it is needed.
DO NOT USE MARKDOWN TO FORMAT YOUR RESPONSE.
FOR RICH TEXT DO NOT USE MARKDOWN USE HTML INSTEAD.

'Follow-up Rephrase' Chat Assistant

This Chat Assistant rephrases a follow-up question based on the conversation history, ensuring it becomes a standalone question if needed. If the follow-up question already works as a standalone question, it simply repeats the question without any changes.

LLM Settings:

AI Provider: Google VertexAI
Model: gemini-1.5-pro
Temperature: 0.10
Max Output Tokens: 8192

Prompt:

Given the conversation history and not prior knowledge, and a follow-up question, rephrase the follow-up question to be a standalone question IF IT IS NEEDED. If the question works as a standalone question, just repeat the question.

RESPONSE ONLY WITH THE STANDALONE QUESTION AND NOTHING MORE; DO NOT INCLUDE ANY OTHER TEXT.

Step 3: Creating the Flow

Follow the steps described in How to create a Flow to create the Flow called 'Search Assistant' with the following structure:

Internet Search complete flow - Globant Enterprise AI

Step 4: Implementing the API component

To add the API component, go to the Interactions section and, below INTEGRATIONS in the Flow menu, drag the component between the Assistants nodes.

Interaction section in Flows - API - Enterprise AI

Step 5: Setting Up the Search API

Go to Google Search API documentation and click on Get API key button.

Setting Up the Search API - Globant Enterprise AI

In the pop-up window that opens, select or create a project from the Select or create project menu.

Enable Custom Search API - Flows in Enterprise AI

Select the Yes option to agree that the use of the services and related APIs is subject to compliance with the applicable Terms of Service. Then click on NEXT to continue with the setup process.

In the next window, click on the SHOW KEY button to reveal the API Key. Copy this API key, as it will be required to configure the API node in your flow.

Show API Key - Flow in Enterprise AI

Step 6: Creating a Programmable Search Engine

Go to Programmable Search Engine and click on the Add button. 

Programmable Search Engine - Flows

In the pop-up window that opens, fill in the necessary fields to create the search engine:

Create a new search engine - Flows

  • Name of your search engine: In the "Search engine name" field, enter a name for the search engine, such as Search Assistant.
  • What to search for: Select the "Search the entire web" option to have the engine search the entire web. If you prefer to search only specific sites, you can select the "Search specific sites or pages" option and add the necessary URLs.
  • Search settings: If you wish, you can adjust additional settings such as image search or SafeSearch filter.
  • Captcha: Select the "I am not a robot" checkbox.
  • Create: At the end of the window, click on the Create button to finalize the creation of the search engine.

In the window that appears, you must click on the Customize button.

Your New search engine has been created - Flows

This will take you to the Overview section of the search engine you have just created. In this section, you should find and copy the Search engine ID, which is a unique value associated with your search engine. This ID is required to configure the API node in your flow.

Search Engine Overview - Flows

Step 7: Configuring the API Node

With the Search engine ID and API key, you can now configure the API node. First, you must click on the Edit button that appears when you position the mouse over the API node.

Configuring the API Node in Enterprise AI Flow

Once you have clicked on Edit, the State Configuration menu will be displayed on the left side.

State configuration edit - Flows in Enterprise AI

Within this menu, in the URL section, you must configure the URL with the following value:

https://www.googleapis.com/customsearch/v1?key=<API key>&cx=<Search engine ID>&q=<query>

Be sure to replace <API key> and <Search engine ID> with the previously obtained values.

In the API node, go to the Parameters section and click on + Add new to add a new parameter. Then, configure the parameter with the following details:

  • Parameter name: q.
  • Value: lastResponse (the value obtained from the previous response).

Next, in the State Configuration section, you must make sure to mark q as Query params.

Value configuration in State configuration Flow

In the Responses section, make sure to map the items property to the searchResults variable. If searchResults is not available, you can click on Add new variable to create it.

Parameters and Values configuration in API node - Flows

Step 8: Configuring the Assistant Node

After you have configured the API node, go to the Assistant node, which is located just below the API node in your flow. In this node, find the Variable section and change the input variable to searchResults.

Configuring the Assistant Node -Flow

Step 9: Testing the Flow

Finally, save the changes and test the flow. You can use the test window or the Playground to make sure everything works correctly, verifying that the Assistant responds properly using the search results.

Testing the Search Assistant - Internet Search Flow Testing the Follow up assistant - Flow
Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant