langchain-ai / chat-langchain

https://chat.langchain.com
MIT License
5.17k stars 1.24k forks source link

Extract metada from query and use it for pre-filtering in Weaviate #359

Open shanumas opened 2 months ago

shanumas commented 2 months ago

I want to extract "title preference" from user query. For example, user is interested in documents for which the title has "usa" in it.

I want to extact this during using llm during the query phase and use it for pre-filtering in weaviate. How can I do this ?

I see that the metadata_extractor is attached in the ingest.py . But I want to use metadata_extractor during query phase also.

vbarda commented 2 months ago

@shanumas check out this section of langchain docs https://python.langchain.com/v0.2/docs/how_to/query_constructing_filters/

kuttybuski commented 1 week ago

This worked great. Thanks @vbarda