Self-Query: how to provide all possible filter values for AttributeInfo to self-query constructor? #20611
Replies: 2 comments
-
You're right in your understanding that LangChain's self-query engine currently does not support a direct way to specify a list of possible filter values for The For more detailed insights into how If you have any more questions or need further assistance, feel free to ask. Sources
|
Beta Was this translation helpful? Give feedback.
-
I am having the same problem, that you, I was wondering how did you managed to solve it? |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
My RAG application allows users to apply filters & type a query to find relevant documents (in my case these documents are related to customer feedback). I am trying to use LangChain self-querying to extract filter values from the prompt (e.g. if the user types "positive feedback about X", without applying any filters, I want to be able to extract filters from the prompt and apply them automatically when querying the DB)
Because I'm using the LangChain output to filter my DB, I need the extracted filters to be exact string matches, and don't want to extract filters which do not exist.
I was hoping there would be some sort of
possible values
parameter where I could provide a list of possible filter values which the self-query engine could choose from. But I haven't been able to find anything like this.At the moment I'm just listing the possible options in the AttributeInfo description, and I plan to have some logic after the filter generation to remove any filters which are not exact matches. But it'd be a lot better if I could just provide the string options to the self-query engine in the first place to avoid this workaround.
Would appreciate any help or advice!
System Info
langchain==0.1.16
langchain-community==0.0.33
langchain-core==0.1.43
langchain-openai==0.1.3
langchain-text-splitters==0.0.1
Beta Was this translation helpful? Give feedback.
All reactions