Hi there! I'm trying to figure out how to extract a product name mentioned by a user during an LLM conversation and use it as a source for my GraphQL query to retrieve more product details. Specifically, how can I define the variables required to populate the query?
For example, if the user says: "I am looking for more details on product X"
How do I capture "product X" and pass it as a variable to my GraphQL query?
Hello! You might be able to achieve this using something similar to the following:
You would need to craft a clear prompt for the AI agent, detailing its function, what it should identify, and so on.
Regarding the GraphQL Tool, you can let the AI Agent determine the appropriate content for the query.
Hello, thanks for your input. I have this configured, but I'm still unsure how to make product_name
a variable within the GraphQL query and how to pass data from the user conversation to that field. The prompt configuration and the GraphQL API call itself are working fine. What are the necessary steps to source the contextual data into the correct field?
Firstly, since you have two tools for GraphQL, you'll need to explain this in the AI Agent's system prompt. Detail when to call these tools and what fields are required when invoking them.
Subsequently, within each of those tools, you can provide a very clear description for the fields that need to be filled. The description I'm referring to is shown in the image below:
Have you tried this approach? If not, please give it a go and let me know your results!
That's interesting. I provided descriptions, and then the test popup returned an error. Is there any documentation available regarding formatting conventions?
Found a solution! It turns out the execute step wasn't functioning as expected, but I managed to run my query with dynamic data.