How do we best send "current date" to a vertex ai agent. Eg. if user ask "whats you opening hours tomorrow?" the agent needs to know current date and day.
Hi @Jakoblj,
Welcome to Google Cloud Community!
To enable a Vertex AI agent to effectively handle queries involving the current date or time, such as "What are your opening hours tomorrow?", you need to ensure that the agent can access and process date-related information. With regard to this, you can consider the following, which might help you answer your current scenario on how you can send the "current date" to a Vertex AI agent:
Integrate with a Date and Time API: You can connect your agent to an external API that provides the current date and time. With this, you can use a service like Google’s Cloud Time Zone API to get the current date. This will work when the agent starts a conversation or recognizes a question about opening hours, it can call this API to fetch the current date.
Use a Custom Date Function: Implement custom date functions directly within the Vertex AI agent to handle date-related queries. This approach involves creating custom functions that compute and return date-related information. You can write a piece of code (a function) that retrieves the current date. Use a programming language like Python with its datetime library to get the current date. This function can be called whenever your agent needs to know the current date, just like the API method. You can also consider integrating a webhook to process complex date-related logic and return responses to the agent.
Utilize Dialogflow CX Messenger JavaScript Functions: If you’re using Dialogflow CX Messenger, you can use built-in JavaScript functions to send the current date directly to the agent. Functions like setQueryParameters or setContext let you add the current date to the agent’s context. This allows the agent to use the date information immediately while processing user queries.
You can also visit Vertex AI Agent documentation for more information.
I hope the above information is helpful.
Hi Ibaui,
Thanks for your elaborate answer. We are using Dialogflow CX Messenger. Can describe in detail how we can use the built-in javascript function to send current date directly to the agent?
@xavidop do you have a quick tip for how to get "current date/time" to our Vertex AI Agent with Dialogflow CX Messenger? Think via setQueryParameters but how to practically do this eg. code, python, function?
Thanks!!! 🙂
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |