-
Notifications
You must be signed in to change notification settings - Fork 2k
-
Hello everyone, I need some guidance.
I’m using a vectorStore and want to build a prompt that includes two distinct contexts, both retrieved from the vector store, for example:
Given the context below:
-----------------
<context1> // result set #1 from vectorStore (e.g., filter A / topK1)
-----------------
Write a document using the model below:
-----------------
<context2> // result set #2 from vectorStore (e.g., filter B / topK2)
-----------------
I’m currently using QuestionAnswerAdvisory like this:
chatClient.prompt() .advisors(advisorSpec -> advisorSpec .param(CONVERSATION_ID, id)) .param(TOP_K, 100) .param(QuestionAnswerAdvisor.FILTER_EXPRESSION, "key == '" + key + "'") ;
What’s the recommended Spring AI pattern to run two separate vectorStore queries (with different filters/topK) and inject both result sets into a single prompt?
- Is it possible to attach two QuestionAnswerAdvisors (one per filter) and have them both contribute to the final context?
- Or should I run two queries manually (pre-prompt), then pass them as separate variables/sections in the prompt template (e.g.,
<context1>and<context2>) viaprompt().param(...)?
Any code snippet or best practice for merging multiple retrievals into one prompt would be greatly appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment