Culmulative messages being sent via default Query ...
# support
b
The hidden default query tool in Vapi for accessing Knowledge Bases seems to be stacking prior utterances into a cumulative query body instead of starting fresh for each request. So for example, my queries in Trieve (that have come from a Vapi conversation) look like this: For context: Note the user is trying to order from a food menu in this instance. Query 1: Hi there. Can I get number 5, please? Query 2: Hi there. Can I get number 5, please?. Yeah. Can I get number 1 3 3? Query 3: Hi there. Can I get number 5, please?. Yeah. Can I get number 1 3 3?. I thought 1 3 3 was the house special fried rice. As you would imagine, this has the effect of the first request being understood correctly, but then Trieve subsequently misunderstanding thereafter. To this end, I'm trying to create a custom query tool in Vapi that'll enable me to control the messages send to Trieve. I just want it to send each request seperately instead of stacking them. Reading the Vapi Swagger doc it's not clear to me that this is something I have the ability to even change. https://api.vapi.ai/api#/Tools/ToolController_create Is this the intended behaviour or a bug? Is there anything I can do to get around this problem please? CallId: e9b95f3c-80de-45a0-806c-b16c166657e9 Thank you
v
Hi there! 👋 I understand your frustration with the cumulative query behavior in Vapi's default Query tool. While I can't definitively say whether this is intended behavior or a bug, I can help with potential workarounds. Based on the information I have, creating a custom query tool is indeed a viable solution to your problem. Here's how you can approach this: ## Creating a Custom Query Tool You can create a custom tool in Vapi to control how messages are sent to Trieve: 1. Create a custom tool using the Vapi API endpoint
POST https://api.vapi.ai/tool
with your authentication token. According to [Vapi's documentation](https://docs.vapi.ai/api-reference/tools/create), you'll need to include appropriate headers and a request body. 2. Associate your tool with your assistant to ensure it's available during conversations. 3. Configure the data sent to your server when creating the tool. As mentioned in [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341356931465347093), you can configure what data is sent optionally and mandatorily. 4. Implement a transformer function on your server to format the payload correctly. According to [user reports](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1338507206051627073), "You have to implement an extra function on your own server to transform the payload" from Vapi into the format you need for Trieve. 5. Consider setting the "request-start" message to an empty string to avoid default messages being used, as suggested in [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333858668730515689).
Unfortunately, there doesn't appear to be a simple setting to disable the cumulative query behavior directly. The current tool handling system is described as "pretty inflexible" according to [user reports](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1337536512807403530). Would you like more specific details on any part of this custom tool creation process? Sources: - [Vapi API Reference Create Tool](https://docs.vapi.ai/api-reference/tools/create) - [Discord Thread Custom Tool Creation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333245023319494707) - [Discord Thread Transformer Function](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1338507206051627073) - [Discord Thread Request-start Message](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333858668730515689) - [Discord Thread Tool Handling Inflexibility](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1337536512807403530)
s
Hey Bilbo, this is the intended behavior - where we concatenate a few of user inputs/utterances together before sending to the KB provider. This is part of our RAG template where we concatenate few of user utterances and then send it out to KB provider. In case you want to change this behavior, you can either use a custom KB or raise an feature request for it. You can raise an feature request for it over here: https://roadmap.vapi.ai
3 Views