Class SelfQueryRetriever
java.lang.Object
com.hw.langchain.retrievers.self.query.base.SelfQueryRetriever
- All Implemented Interfaces:
BaseRetriever
Retriever that wraps around a vector store and uses an LLM to generate the vector store queries.
- Author:
- HamaWhite
-
Constructor Summary
ConstructorDescriptionSelfQueryRetriever
(VectorStore vectorStore, LLMChain llmChain, Visitor structuredQueryTranslator, boolean useOriginalQuery) SelfQueryRetriever
(VectorStore vectorStore, LLMChain llmChain, SearchType searchType, Map<String, Object> searchKwargs, Visitor structuredQueryTranslator, boolean useOriginalQuery) -
Method Summary
Modifier and TypeMethodDescriptionstatic SelfQueryRetriever
fromLLM
(BaseLanguageModel llm, VectorStore vectorStore, String documentContents, List<AttributeInfo> metadataFieldInfo) static SelfQueryRetriever
fromLLM
(BaseLanguageModel llm, VectorStore vectorStore, String documentContents, List<AttributeInfo> metadataFieldInfo, Visitor structuredQueryTranslator, boolean enableLimit, boolean useOriginalQuery) getRelevantDocuments
(String query) Get documents relevant for a query.
-
Constructor Details
-
SelfQueryRetriever
public SelfQueryRetriever(VectorStore vectorStore, LLMChain llmChain, Visitor structuredQueryTranslator, boolean useOriginalQuery) -
SelfQueryRetriever
public SelfQueryRetriever(VectorStore vectorStore, LLMChain llmChain, SearchType searchType, Map<String, Object> searchKwargs, Visitor structuredQueryTranslator, boolean useOriginalQuery)
-
-
Method Details
-
getRelevantDocuments
Description copied from interface:BaseRetriever
Get documents relevant for a query.- Specified by:
getRelevantDocuments
in interfaceBaseRetriever
- Parameters:
query
- string to find relevant documents for- Returns:
- List of relevant documents
-
fromLLM
public static SelfQueryRetriever fromLLM(BaseLanguageModel llm, VectorStore vectorStore, String documentContents, List<AttributeInfo> metadataFieldInfo) -
fromLLM
public static SelfQueryRetriever fromLLM(BaseLanguageModel llm, VectorStore vectorStore, String documentContents, List<AttributeInfo> metadataFieldInfo, Visitor structuredQueryTranslator, boolean enableLimit, boolean useOriginalQuery)
-