id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
e46363bff785-7
Examples using WeaviateHybridSearchRetriever¶ Weaviate Hybrid Search
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.weaviate_hybrid_search.WeaviateHybridSearchRetriever.html
e141f5d507ce-0
langchain.retrievers.self_query.pinecone.PineconeTranslator¶ class langchain.retrievers.self_query.pinecone.PineconeTranslator[source]¶ Translate Pinecone internal query language elements to valid filters. Attributes allowed_comparators Subset of allowed logical comparators. allowed_operators Subset of allowed logical ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.pinecone.PineconeTranslator.html
194cc57d0cb0-0
langchain.retrievers.document_compressors.base.BaseDocumentCompressor¶ class langchain.retrievers.document_compressors.base.BaseDocumentCompressor[source]¶ Bases: BaseModel, ABC Base class for document compressors. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.BaseDocumentCompressor.html
194cc57d0cb0-1
the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.BaseDocumentCompressor.html
194cc57d0cb0-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.BaseDocumentCompressor.html
8e4c476bee0f-0
langchain.retrievers.self_query.milvus.MilvusTranslator¶ class langchain.retrievers.self_query.milvus.MilvusTranslator[source]¶ Translate Milvus internal query language elements to valid filters. Attributes allowed_comparators allowed_operators Subset of allowed logical comparators. Methods __init__() visit_comparison(...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.milvus.MilvusTranslator.html
fa18de894b2e-0
langchain.retrievers.multi_vector.MultiVectorRetriever¶ class langchain.retrievers.multi_vector.MultiVectorRetriever[source]¶ Bases: BaseRetriever Retrieve from a set of multiple embeddings for the same document. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if t...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-1
Subclasses should override this method if they can batch more efficiently. async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Asynchronously get documents ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-3
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-4
namespace is [“langchain”, “llms”, “openai”] get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Retrieve documents relevant to a query. :param query: string to fi...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with e...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
fa18de894b2e-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_vector.MultiVectorRetriever.html
4b5302f1215f-0
langchain.retrievers.document_compressors.base.DocumentCompressorPipeline¶ class langchain.retrievers.document_compressors.base.DocumentCompressorPipeline[source]¶ Bases: BaseDocumentCompressor Document compressor that uses a pipeline of Transformers. Create a new model by parsing and validating input data from keyword...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.DocumentCompressorPipeline.html
4b5302f1215f-1
Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep co...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.DocumentCompressorPipeline.html
4b5302f1215f-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.base.DocumentCompressorPipeline.html
15c53a2810c6-0
langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever¶ class langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever[source]¶ Bases: BaseRetriever Retriever that combines embedding similarity with recency in retrieving values. Create a new model by parsing and validating in...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a retriever with its use case. param vectorstore: langchain.schema.vectorstore.VectorStore [Required]¶ The vectorstore to store documents and determine salience. async aadd_documents(documents: List[Doc...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-2
and passed as arguments to the handlers defined in callbacks. Returns List of relevant documents async ainvoke(input: str, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → List[Document]¶ Default implementation of ainvoke, which calls invoke in a thread pool. Subclasses should override this method if...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-3
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can ba...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-4
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-5
Return documents that are salient to the query. invoke(input: str, config: Optional[RunnableConfig] = None) → List[Document]¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, Mapp...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-6
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
15c53a2810c6-7
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ property InputType: Type[langchain.schema.runnable.utils.Input]¶ property OutputType: Type[langchain.schema.runna...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever.html
46d6d3014d75-0
langchain.retrievers.contextual_compression.ContextualCompressionRetriever¶ class langchain.retrievers.contextual_compression.ContextualCompressionRetriever[source]¶ Bases: BaseRetriever Retriever that wraps a base retriever and compresses the results. Create a new model by parsing and validating input data from keywor...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-1
Subclasses should override this method if they can batch more efficiently. async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Asynchronously get documents ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-3
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-4
namespace is [“langchain”, “llms”, “openai”] get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Retrieve documents relevant to a query. :param query: string to fi...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with e...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
46d6d3014d75-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.contextual_compression.ContextualCompressionRetriever.html
ae1befadd494-0
langchain.retrievers.multi_query.LineList¶ class langchain.retrievers.multi_query.LineList[source]¶ Bases: BaseModel List of lines. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param lines: List[str] [Req...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_query.LineList.html
ae1befadd494-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_query.LineList.html
ae1befadd494-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.multi_query.LineList.html
a3e3e4294fff-0
langchain.retrievers.document_compressors.chain_extract.default_get_input¶ langchain.retrievers.document_compressors.chain_extract.default_get_input(query: str, doc: Document) → Dict[str, Any][source]¶ Return the compression chain input.
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.chain_extract.default_get_input.html
ddf6ae402aa9-0
langchain.retrievers.chaindesk.ChaindeskRetriever¶ class langchain.retrievers.chaindesk.ChaindeskRetriever[source]¶ Bases: BaseRetriever Chaindesk API retriever. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid mode...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-1
Asynchronously get documents relevant to a query. :param query: string to find relevant documents for :param callbacks: Callback manager or list of callbacks :param tags: Optional list of tags associated with the retriever. Defaults to None These tags will be associated with each call to this retriever, and passed as a...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-2
jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default im...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-4
This metadata will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks. Returns List of relevant documents invoke(input: str, config: Optional[RunnableConfig] = None) → List[Document]¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, i...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-5
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
ddf6ae402aa9-6
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ property InputType: Type[langchain.schema.runnable.utils.Input]¶ property OutputType: Type[langchain.schema.runna...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.chaindesk.ChaindeskRetriever.html
72e482770d52-0
langchain.retrievers.self_query.dashvector.DashvectorTranslator¶ class langchain.retrievers.self_query.dashvector.DashvectorTranslator[source]¶ Logic for converting internal query language elements to valid filters. Attributes allowed_comparators allowed_operators map_dict Methods __init__() visit_comparison(comparison...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.dashvector.DashvectorTranslator.html
4e4043bf67ae-0
langchain.retrievers.pinecone_hybrid_search.create_index¶ langchain.retrievers.pinecone_hybrid_search.create_index(contexts: List[str], index: Any, embeddings: Embeddings, sparse_encoder: Any, ids: Optional[List[str]] = None, metadatas: Optional[List[dict]] = None, namespace: Optional[str] = None) → None[source]¶ Creat...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.pinecone_hybrid_search.create_index.html
c40922fb11a8-0
langchain.retrievers.wikipedia.WikipediaRetriever¶ class langchain.retrievers.wikipedia.WikipediaRetriever[source]¶ Bases: BaseRetriever, WikipediaAPIWrapper Wikipedia API retriever. It wraps load() to get_relevant_documents(). It uses all WikipediaAPIWrapper arguments without any change. Create a new model by parsing ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-1
Subclasses should override this method if they can batch more efficiently. async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Asynchronously get documents ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-3
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-4
namespace is [“langchain”, “llms”, “openai”] get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Retrieve documents relevant to a query. :param query: string to fi...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. load(query: str) → List[Document]¶ Run Wikipedia search and get the article text plus the meta information. See Returns: a list of documents. ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
c40922fb11a8-6
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.wikipedia.WikipediaRetriever.html
464db904fb53-0
langchain.retrievers.document_compressors.cohere_rerank.CohereRerank¶ class langchain.retrievers.document_compressors.cohere_rerank.CohereRerank[source]¶ Bases: BaseDocumentCompressor Document compressor that uses Cohere Rerank API. Create a new model by parsing and validating input data from keyword arguments. Raises ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.cohere_rerank.CohereRerank.html
464db904fb53-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.cohere_rerank.CohereRerank.html
464db904fb53-2
classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_n...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.document_compressors.cohere_rerank.CohereRerank.html
fe8426ea603c-0
langchain.retrievers.bm25.BM25Retriever¶ class langchain.retrievers.bm25.BM25Retriever[source]¶ Bases: BaseRetriever BM25 retriever without Elasticsearch. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. para...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-1
Subclasses should override this method if they can batch more efficiently. async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶ Asynchronously get documents ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-3
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-4
Create a BM25Retriever from a list of Documents. :param documents: A list of Documents to vectorize. :param bm25_params: Parameters to pass to the BM25 vectorizer. :param preprocess_func: A function to preprocess each text before vectorization. :param **kwargs: Any other arguments to pass to the retriever. Returns A BM...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-5
Retrieve documents relevant to a query. :param query: string to find relevant documents for :param callbacks: Callback manager or list of callbacks :param tags: Optional list of tags associated with the retriever. Defaults to None These tags will be associated with each call to this retriever, and passed as arguments t...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-6
by calling invoke() with each input. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
fe8426ea603c-7
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.bm25.BM25Retriever.html
b84dcc69b84d-0
langchain.retrievers.self_query.deeplake.can_cast_to_float¶ langchain.retrievers.self_query.deeplake.can_cast_to_float(string: str) → bool[source]¶ Check if a string can be cast to a float.
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.deeplake.can_cast_to_float.html
c97403fc3b89-0
langchain.retrievers.self_query.elasticsearch.ElasticsearchTranslator¶ class langchain.retrievers.self_query.elasticsearch.ElasticsearchTranslator[source]¶ Translate Elasticsearch internal query language elements to valid filters. Attributes allowed_comparators Subset of allowed logical comparators. allowed_operators S...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.elasticsearch.ElasticsearchTranslator.html
8e46e295c812-0
langchain.retrievers.svm.SVMRetriever¶ class langchain.retrievers.svm.SVMRetriever[source]¶ Bases: BaseRetriever SVM retriever. Largely based on https://github.com/karpathy/randomfun/blob/master/knn_vs_svm.ipynb Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if th...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-1
param texts: List[str] [Required]¶ List of texts to index. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation of abatch, which calls ainvoke N times. Subclasses should...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-3
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-4
classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-6
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
8e46e295c812-7
Examples using SVMRetriever¶ SVM Question Answering
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.svm.SVMRetriever.html
2dbd1e2ae386-0
langchain.retrievers.knn.create_index¶ langchain.retrievers.knn.create_index(contexts: List[str], embeddings: Embeddings) → ndarray[source]¶ Create an index of embeddings for a list of contexts. Parameters contexts – List of contexts to embed. embeddings – Embeddings model to use. Returns Index of embeddings.
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.knn.create_index.html
5b1c6d7d9a7b-0
langchain.retrievers.self_query.opensearch.OpenSearchTranslator¶ class langchain.retrievers.self_query.opensearch.OpenSearchTranslator[source]¶ Translate OpenSearch internal query domain-specific language elements to valid filters. Attributes allowed_comparators Subset of allowed logical comparators. allowed_operators ...
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.self_query.opensearch.OpenSearchTranslator.html
bb9fc61d7a1b-0
langchain.retrievers.milvus.MilvusRetreiver¶ langchain.retrievers.milvus.MilvusRetreiver(*args: Any, **kwargs: Any) → MilvusRetriever[source]¶ Deprecated MilvusRetreiver. Please use MilvusRetriever (‘i’ before ‘e’) instead. Parameters *args – **kwargs – Returns MilvusRetriever
https://api.python.langchain.com/en/latest/retrievers/langchain.retrievers.milvus.MilvusRetreiver.html
5c2dfc147fca-0
langchain.document_transformers.html2text.Html2TextTransformer¶ class langchain.document_transformers.html2text.Html2TextTransformer(ignore_links: bool = True, ignore_images: bool = True)[source]¶ Replace occurrences of a particular search pattern with a replacement string Parameters ignore_links – Whether links should...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.html2text.Html2TextTransformer.html
74b79e72709c-0
langchain.document_transformers.openai_functions.create_metadata_tagger¶ langchain.document_transformers.openai_functions.create_metadata_tagger(metadata_schema: Union[Dict[str, Any], Type[BaseModel]], llm: BaseLanguageModel, prompt: Optional[ChatPromptTemplate] = None, *, tagging_chain_kwargs: Optional[Dict] = None) →...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.create_metadata_tagger.html
74b79e72709c-1
} # Must be an OpenAI model that supports functions llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613") document_transformer = create_metadata_tagger(schema, llm) original_documents = [ Document(page_content="Review of The Bee Movie By Roger Ebert This is the greatest movie ever made. 4 out of 5 stars.”), D...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.create_metadata_tagger.html
c887431a2324-0
langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor¶ class langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor(properties: List[dict], openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None)[source]¶ Extract properties from text documents using d...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor.html
c887431a2324-1
Methods __init__(properties[, openai_api_key, ...]) atransform_documents(documents, **kwargs) Extracts properties from text documents using doctran. transform_documents(documents, **kwargs) Transform a list of documents. __init__(properties: List[dict], openai_api_key: Optional[str] = None, openai_api_model: Optional[s...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor.html
957708181e30-0
langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents¶ langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents(documents: Sequence[Document]) → Sequence[_DocumentWithState][source]¶ Convert a list of documents to a list of documents with state. Parameters document...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents.html
35d783a32caf-0
langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer¶ class langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer[source]¶ Transform HTML content by extracting specific tags and removing unwanted ones. Example Initialize the transformer. This checks if the Be...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html
35d783a32caf-1
Returns A cleaned string with unnecessary lines removed. static remove_unwanted_tags(html_content: str, unwanted_tags: List[str]) → str[source]¶ Remove unwanted tags from a given HTML content. Parameters html_content – The original HTML content string. unwanted_tags – A list of tags to be removed from the HTML. Returns...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html
69b02e06b621-0
langchain.document_transformers.doctran_text_qa.DoctranQATransformer¶ class langchain.document_transformers.doctran_text_qa.DoctranQATransformer(openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None)[source]¶ Extract QA from text documents using doctran. Parameters openai_api_key – OpenAI API key...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_qa.DoctranQATransformer.html
64a5ad323c09-0
langchain.document_transformers.openai_functions.OpenAIMetadataTagger¶ class langchain.document_transformers.openai_functions.OpenAIMetadataTagger[source]¶ Bases: BaseDocumentTransformer, BaseModel Extract metadata tags from document contents using OpenAI functions. Example:from langchain.chat_models import ChatOpenAI ...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html
64a5ad323c09-1
Raises ValidationError if the input data cannot be parsed to form a valid model. param tagging_chain: langchain.chains.llm.LLMChain [Required]¶ The chain used to extract metadata from each document. async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶ Asynchronously tra...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html
64a5ad323c09-2
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html
64a5ad323c09-3
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Documen...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html
ef0bfacc91fa-0
langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter¶ class langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter[source]¶ Bases: BaseDocumentTransformer, BaseModel Perform K-means clustering on document vectors. Returns an arbitrary number of documents...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html
ef0bfacc91fa-1
documents – A sequence of Documents to be transformed. Returns A list of transformed Documents. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other valid...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html
ef0bfacc91fa-2
classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_n...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html
ef0bfacc91fa-3
classmethod validate(value: Any) → Model¶ Examples using EmbeddingsClusteringFilter¶ LOTR (Merger Retriever)
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html
fe2123833559-0
langchain.document_transformers.long_context_reorder.LongContextReorder¶ class langchain.document_transformers.long_context_reorder.LongContextReorder[source]¶ Bases: BaseDocumentTransformer, BaseModel Lost in the middle: Performance degrades when models must access relevant information in the middle of long contexts. ...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html
fe2123833559-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html
fe2123833559-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Documen...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html
c44979b781a2-0
langchain.document_transformers.doctran_text_translate.DoctranTextTranslator¶ class langchain.document_transformers.doctran_text_translate.DoctranTextTranslator(openai_api_key: Optional[str] = None, language: str = 'english', openai_api_model: Optional[str] = None)[source]¶ Translate text documents using doctran. Param...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_translate.DoctranTextTranslator.html
97d03126bda4-0
langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer¶ class langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer(nua: NucliaUnderstandingAPI)[source]¶ The Nuclia Understanding API splits into paragraphs and sentences, identifies entities, provides a summary of the text and ...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer.html
c13e4ea59f7c-0
langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter¶ class langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter[source]¶ Bases: BaseDocumentTransformer, BaseModel Filter that drops redundant documents by comparing their embeddings. Create a new model by...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html
c13e4ea59f7c-1
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html
c13e4ea59f7c-2
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto...
https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html