Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Recomendation to manage big chunk of documents

Hi Team, Good Morning.

Currently, I need to fetch almost 400.000 different files, Right now im doing API calls from my Dialogflow cx and then responding properly.

I decided on DFcx and not genAI agent/ data stored because having 400.000 files could be expensive and also will take a long time for searching after ingestion.

Right now I have come to a situation where I would like to ask a question in different ways that the flow can't understand sometimes. So im searching for recommendations to address this issue.

Do you know if, for example, I can use genAI to understand the customer query and then use that Genai, not to respond but to call an API? and then, having this json response provide a response?

And this could be addressed with Dialogflow? or should be addresed with Vertex AI? What do you think?

2 REPLIES 2

Hi @Mizar,

You can leverage the strengths of both Dialogflow and generative AI to create a more powerful and flexible chatbot.

Here's a general workflow on how you might achieve this:

  1. Natural Language Understanding (NLU):
    • Use Dialogflow's NLU capabilities to extract key entities and intents from the customer query.
  2. Query Generation:
    • Based on the extracted entities and intents, generate a query that can be used to call the API. This query might be in the form of a structured request or a natural language prompt.

      Query Generation Optimization:

  • Contextual Awareness: For complex queries, incorporate previous conversation turns (Dialogflow context) into the query generation process to improve accuracy.
  • Query Refinement: Experiment with different prompt engineering techniques to guide the GenAI model towards generating more effective API queries.

3. API Call:

    • Use Dialogflow's integration capabilities to call the desired API with the generated query.
    • Handle the API response, which will likely be in JSON format.

4. Response Generation:

    • Process the JSON response to extract relevant information.
    • Use Dialogflow's templates or custom logic to craft a human-readable response based on the extracted information.
    • Other Option:
      Dynamic Summarization: Use GenAI to summarize lengthy API responses into concise and relevant information for the user.

                    Personalized Responses: Leverage user information (if available) and conversation history to tailor the GenAI-generated responses

Example:

Customer Query: "Show me the cheapest flights to London next month, departing from New York."

NLU (Dialogflow): Extracts entities: city: London, time: next month, departure_city: New York, intent: find_flights

Query Generation (GenAI):

Prompt: "Generate an API query to find the cheapest flights to London next month, departing from New York. The API expects parameters for 'destination', 'departure_date_range', and 'origin'."

Generated Query: { "destination": "London", "departure_date_range": "2024-09-01,2024-09-30", "origin": "New York" }

API Call (Dialogflow): Sends the generated query to a flight booking API.

Response Processing: Parses the JSON response from the API.

Response Generation (GenAI):

  • Summarizes the cheapest flight options.
  • Presents the results in a clear, conversational format.

Key Considerations:

  • API Selection: Choose an API that provides the necessary data or functionality for your use case.
  • Query Formulation: Ensure that the generated query is well-formatted and compatible with the API's requirements.
  • Error Handling: Implement mechanisms to handle potential errors or unexpected responses from the API.
  • Security: Protect sensitive information (e.g., API keys) and ensure compliance with data privacy regulations.

I hope the above information is helpful.

@ruthseki As soon as my datastore takes the first query, I cant control the output or what it does. How can I achieve this? or is not possible?