Question: does createQueryVectorTool support db schema
Our setup have schema isolated storage instances. I was able to setup vector stores in schema but when agent calls the createQueryVectorTool, it does not respect schema isolation.
If i create a custom tool to create embeddings on query and perform a vector search, it does work. But the custom tool does not get called easily with prompt engineering. I would like to use the native tool but have support for schema could be a key provided in
databaseConfig.pgVector?6 Replies
š Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10584
š If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
š Thank you for helping us improve Mastra!
Hi @Aman Zishan ill take a look
How are you setting up the tool, and your vector stores
Is it like this?
Thats is correct; we have a getStorage() function that gets called with the schema id from requestContext. GetStorage is responsible for init the instance just like you have here.
And for query tool setup as a workaround what i have now is use the native vector tool as base tool and overrode the execute function to manually fetch the correct vectorDB instance by passing the schema ID
Then return the query result to match the output schema of the native tool
I guess this way the framework level prompts know to call the vector tool correctly rather than completely using a custom tool and prompt engineer the agent to override framework prompt?
It would be very clean to avoid custom logic to fetch schema based vector store and utilise the native vector tool itself š
Do you mind sharing the code you have so I can inspect it and see the issue?
@Abhi Aiyer Ideally i would like to remove this workaround as i want to use just
createVectorQueryTool and createVectorQueryTool should be able to get the schema based storage instance.Okay i get you now! ill get a fix