save ParentDocumentRetriever in local path _🤖_ #20315
Labels
🤖:docs
Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
Ɑ: embeddings
Related to text embedding models module
🔌: openai
Primarily related to OpenAI integrations
Ɑ: retriever
Related to retriever module
Ɑ: text splitters
Related to text splitters package
Ɑ: vector store
Related to vector store module
Hey @nithinreddyyyyyy, back for more adventures in code, I see! Always a pleasure to dive into these challenges with you. 🚀
Based on the information you provided and the similar issue I found in the LangChain repository, you can use FAISS for ParentDocumentRetriever in the LangChain framework as follows:
This code snippet includes the use of
child_splitter
andparent_splitter
with FAISS as requested by the user. You can find more details in the related issue.For retrieving relevant documents with additional metadata and filtering capabilities, you can follow the pattern shown in the test cases for the FAISS class:
In this example,
relevant_docs
will contain the most relevant document to the query that also matches the filter criteria. You can adjust thek
parameter to retrieve more documents and thefilter
parameter to apply different filtering rules. For asynchronous use cases, you can use theawait FAISS.afrom_texts
andawait docsearch.asimilarity_search
methods with the same parameters. You can find more details in the test cases for the FAISS class.The
FAISS.from_texts
method in the LangChain framework is a class method that constructs a FAISS (Facebook AI Similarity Search) wrapper from raw documents. This method is a user-friendly interface that embeds documents, creates an in-memory docstore, and initializes the FAISS database. It is intended to be a quick way to get started with the framework. You can find more details in the FAISS class source code.I hope this helps! If you have any further questions, feel free to ask.
Sources
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Originally posted by @dosubot[bot] in #17576 (comment)
The text was updated successfully, but these errors were encountered: