id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
49
117
951d30d093a8-1
previous AWS S3 File next Azure Blob Storage File Contents Specifying a prefix By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 25, 2023.
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html
c58368f2494a-0
.rst .pdf Indexes Indexes# Indexes refer to ways to structure documents so that LLMs can best interact with them. LangChain has a number of modules that help you load, structure, store, and retrieve documents. Docstore Text Splitter Document Loaders Vector Stores Retrievers Document Compressors Document Transformers pr...
https://python.langchain.com/en/latest/reference/indexes.html
cda515043574-0
.rst .pdf Prompts Prompts# The reference guides here all relate to objects for working with Prompts. PromptTemplates Example Selector Output Parsers previous How to serialize prompts next PromptTemplates By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 25, 2023.
https://python.langchain.com/en/latest/reference/prompts.html
baabf7369cdb-0
.rst .pdf Agents Agents# Reference guide for Agents and associated abstractions. Agents Tools Agent Toolkits previous Memory next Agents By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 25, 2023.
https://python.langchain.com/en/latest/reference/agents.html
d9be7f943fdc-0
.md .pdf Installation Contents Official Releases Installing from source Installation# Official Releases# LangChain is available on PyPi, so to it is easily installable with: pip install langchain That will install the bare minimum requirements of LangChain. A lot of the value of LangChain comes when integrating it wi...
https://python.langchain.com/en/latest/reference/installation.html
f012f3c80887-0
.rst .pdf Models Models# LangChain provides interfaces and integrations for a number of different types of models. LLMs Chat Models Embeddings previous API References next Chat Models By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 25, 2023.
https://python.langchain.com/en/latest/reference/models.html
4f731d3581db-0
.rst .pdf Chat Models Chat Models# pydantic model langchain.chat_models.AzureChatOpenAI[source]# Wrapper around Azure OpenAI Chat Completion API. To use this class you must have a deployed model on Azure OpenAI. Use deployment_name in the constructor to refer to the “Model deployment name” in the Azure portal. In addit...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
4f731d3581db-1
pydantic model langchain.chat_models.ChatGooglePalm[source]# Wrapper around Google’s PaLM Chat API. To use you must have the google.generativeai Python package installed and either: The GOOGLE_API_KEY` environment varaible set with your API key, or Pass your API key using the google_api_key kwarg to the ChatGoogle cons...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
4f731d3581db-2
Example from langchain.chat_models import ChatOpenAI openai = ChatOpenAI(model_name="gpt-3.5-turbo") field max_retries: int = 6# Maximum number of retries to make when generating. field max_tokens: Optional[int] = None# Maximum number of tokens to generate. field model_kwargs: Dict[str, Any] [Optional]# Holds any model...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
4f731d3581db-3
get_token_ids(text: str) → List[int][source]# Get the tokens present in the text with tiktoken package. pydantic model langchain.chat_models.ChatVertexAI[source]# Wrapper around Vertex AI large language models. field model_name: str = 'chat-bison'# Model name to use. pydantic model langchain.chat_models.PromptLayerChat...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
fd066d966757-0
.rst .pdf Python REPL Python REPL# For backwards compatibility. pydantic model langchain.python.PythonREPL[source]# Simulates a standalone Python REPL. field globals: Optional[Dict] [Optional] (alias '_globals')# field locals: Optional[Dict] [Optional] (alias '_locals')# run(command: str) → str[source]# Run command wit...
https://python.langchain.com/en/latest/reference/modules/python.html
29533f494fc8-0
.rst .pdf Example Selector Example Selector# Logic for selecting examples to include in prompts. pydantic model langchain.prompts.example_selector.LengthBasedExampleSelector[source]# Select examples based on length. Validators calculate_example_text_lengths » example_text_lengths field example_prompt: langchain.prompts...
https://python.langchain.com/en/latest/reference/modules/example_selector.html
29533f494fc8-1
Create k-shot example selector using example list and embeddings. Reshuffles examples dynamically based on query similarity. Parameters examples – List of examples to use in the prompt. embeddings – An iniialized embedding API interface, e.g. OpenAIEmbeddings(). vectorstore_cls – A vector store DB interface class, e.g....
https://python.langchain.com/en/latest/reference/modules/example_selector.html
29533f494fc8-2
Create k-shot example selector using example list and embeddings. Reshuffles examples dynamically based on query similarity. Parameters examples – List of examples to use in the prompt. embeddings – An initialized embedding API interface, e.g. OpenAIEmbeddings(). vectorstore_cls – A vector store DB interface class, e.g...
https://python.langchain.com/en/latest/reference/modules/example_selector.html
b9f1454bf517-0
.rst .pdf Text Splitter Text Splitter# Functionality for splitting text. class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]# Implementation of splitting text that looks at characters. split_text(text: str) → List[str][source]# Split incoming text and return chunks. class...
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
b9f1454bf517-1
Split incoming text and return chunks. class langchain.text_splitter.TextSplitter(chunk_size: int = 4000, chunk_overlap: int = 200, length_function: typing.Callable[[str], int] = <built-in function len>)[source]# Interface for splitting text into chunks. async atransform_documents(documents: Sequence[langchain.schema.D...
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
b9f1454bf517-2
Transform sequence of documents by splitting them. class langchain.text_splitter.TokenTextSplitter(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any)[source]# Imp...
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
5497c75db358-0
.rst .pdf SearxNG Search Contents Quick Start Searching Engine Parameters Search Tips SearxNG Search# Utility for using SearxNG meta search API. SearxNG is a privacy-friendly free metasearch engine that aggregates results from multiple search engines and databases and supports the OpenSearch specification. More detai...
https://python.langchain.com/en/latest/reference/modules/searx_search.html
5497c75db358-1
# assuming the searx host is set as above or exported as an env variable s = SearxSearchWrapper(engines=['google', 'bing'], language='es') Search Tips# Searx offers a special search syntax that can also be used instead of passing engine parameters. For example the following query: s = SearxSearchWra...
https://python.langchain.com/en/latest/reference/modules/searx_search.html
5497c75db358-2
use a self hosted instance and disable the rate limiter. If you are self-hosting an instance you can customize the rate limiter for your own network as described here. For a list of public SearxNG instances see https://searx.space/ class langchain.utilities.searx_search.SearxResults(data: str)[source]# Dict like wrappe...
https://python.langchain.com/en/latest/reference/modules/searx_search.html
5497c75db358-3
field params: dict [Optional]# field query_suffix: Optional[str] = ''# field searx_host: str = ''# field unsecure: bool = False# async aresults(query: str, num_results: int, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → List[Dict][source]# Asynchronously query with json results...
https://python.langchain.com/en/latest/reference/modules/searx_search.html
5497c75db358-4
Run query through Searx API and parse results. You can pass any other params to the searx query API. Parameters query – The query to search for. query_suffix – Extra suffix appended to the query. engines – List of engines to use for the query. categories – List of categories to use for the query. **kwargs – extra param...
https://python.langchain.com/en/latest/reference/modules/searx_search.html
027ab647c113-0
.rst .pdf Utilities Utilities# General utilities. pydantic model langchain.utilities.ApifyWrapper[source]# Wrapper around Apify. To use, you should have the apify-client python package installed, and the environment variable APIFY_API_TOKEN set with your API key, or pass apify_api_token as a named parameter to the cons...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-1
Return type ApifyDatasetLoader call_actor(actor_id: str, run_input: Dict, dataset_mapping_function: Callable[[Dict], langchain.schema.Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → langchain.document_loaders.apify_dataset.ApifyDatasetLoader[source]#...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-2
Parameters top_k_results – number of the top-scored document used for the arxiv tool ARXIV_MAX_QUERY_LENGTH – the cut limit on the query used for the arxiv tool. load_max_docs – a limit to the number of loaded documents load_all_available_meta – if True: the metadata of the loaded Documents gets all available meta inf...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-3
pydantic model langchain.utilities.BingSearchAPIWrapper[source]# Wrapper for Bing Search API. In order to set this up, follow instructions at: https://levelup.gitconnected.com/api-tutorial-how-to-use-bing-web-search-api-in-python-4165d5592a7e field bing_search_url: str [Required]# field bing_subscription_key: str [Requ...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-4
Returns snippet - The description of the result. title - The title of the result. link - The link to the result. Return type A list of dictionaries with the following keys run(query: str) → str[source]# pydantic model langchain.utilities.GooglePlacesAPIWrapper[source]# Wrapper around Google Places API. To use, you shou...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-5
- Install the library using pip install google-api-python-client The current version of the library is 2.70.0 at this time 2. To create an API key: - Navigate to the APIs & Services→Credentials panel in Cloud Console. - Select Create credentials, then select API key from the drop-down menu. - The API key created dialog...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-6
title - The title of the result. link - The link to the result. Return type A list of dictionaries with the following keys run(query: str) → str[source]# Run query through GoogleSearch and parse result. pydantic model langchain.utilities.GoogleSerperAPIWrapper[source]# Wrapper around the Serper.dev Google Search API. Y...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-7
This wrapper will use the GraphQL API to conduct queries. field custom_headers: Optional[Dict[str, str]] = None# field graphql_endpoint: str [Required]# run(query: str) → str[source]# Run a GraphQL query and get the results. pydantic model langchain.utilities.LambdaWrapper[source]# Wrapper for AWS Lambda SDK. Docs for ...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-8
Wrapper for OpenWeatherMap API using PyOWM. Docs for using: Go to OpenWeatherMap and sign up for an API key Save your API KEY into OPENWEATHERMAP_API_KEY env variable pip install pyowm field openweathermap_api_key: Optional[str] = None# field owm: Any = None# run(location: str) → str[source]# Get the current weather in...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-9
get_schemas() → str[source]# Get the available schema’s. get_table_info(table_names: Optional[Union[List[str], str]] = None) → str[source]# Get information about specified tables. get_table_names() → Iterable[str][source]# Get names of tables available. run(command: str) → Any[source]# Execute a DAX command and return ...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-10
# note the unsecure parameter is not needed if you pass the url scheme as # http searx = SearxSearchWrapper(searx_host="http://localhost:8888", unsecure=True) Validators disable_ssl_warnings » unsecure validate_params » all fields field aiosession: Optional[Any] = None# field cat...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-11
**kwargs – extra parameters to pass to the searx API. Returns {snippet: The description of the result. title: The title of the result. link: The link to the result. engines: The engines used for the result. category: Searx category of the result. } Return type Dict with the following keys run(query: str, engines: Opt...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-12
To use, you should have the google-search-results python package installed, and the environment variable SERPAPI_API_KEY set with your API key, or pass serpapi_api_key as a named parameter to the constructor. Example from langchain import SerpAPIWrapper serpapi = SerpAPIWrapper() field aiosession: Optional[aiohttp.clie...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-13
For example: SparkSQL.from_uri(“sc://localhost:15002”) get_table_info(table_names: Optional[List[str]] = None) → str[source]# get_table_info_no_throw(table_names: Optional[List[str]] = None) → str[source]# Get information about specified tables. Follows best practices as specified in: Rajkumar et al, 2022 (https://arxi...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-14
PATCH the URL and return the text asynchronously. async apost(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]# POST to the URL and return the text asynchronously. async aput(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]# PUT the URL and return the text asynchronously. delete(url: str, **kwar...
https://python.langchain.com/en/latest/reference/modules/utilities.html
027ab647c113-15
See Returns: a list of documents. run(query: str) → str[source]# Run Wikipedia search and get page summaries. pydantic model langchain.utilities.WolframAlphaAPIWrapper[source]# Wrapper for Wolfram Alpha. Docs for using: Go to wolfram alpha and sign up for a developer account Create an app and get your APP ID Save your ...
https://python.langchain.com/en/latest/reference/modules/utilities.html
9d1020606394-0
.rst .pdf Vector Stores Vector Stores# Wrappers on top of vector stores. class langchain.vectorstores.AnalyticDB(connection_string: str, embedding_function: langchain.embeddings.base.Embeddings, collection_name: str = 'langchain', collection_metadata: Optional[dict] = None, pre_delete_collection: bool = False, logger: ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-1
Return connection string from database parameters. create_collection() → None[source]# create_tables_if_not_exists() → None[source]# delete_collection() → None[source]# drop_tables() → None[source]# classmethod from_documents(documents: List[langchain.schema.Document], embedding: langchain.embeddings.base.Embeddings, c...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-2
k (int) – Number of results to return. Defaults to 4. filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. Returns List of Documents most similar to the query. similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[langchain.schema.Docum...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-3
Example from langchain import Annoy db = Annoy(embedding_function, index, docstore, index_to_docstore_id) add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]# Run more texts through the embeddings and add to the vectorstore. Parameters texts – Iterable of strings t...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-4
text_embedding_pairs = list(zip(texts, text_embeddings)) db = Annoy.from_embeddings(text_embedding_pairs, embeddings) classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, metric: str = 'angular', trees: int = 100, n_jobs: int = - 1, **kwargs: ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-5
and index_to_docstore_id from. embeddings – Embeddings to use when generating queries. max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs selected using the maximal marginal relevance. Maximal marginal ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-6
Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. process_index_results(idxs: List[int], dists: List[float]) → List[Tuple[langchain.schema.Document, float]][source]# Turns annoy results into a list of documents and scores. Parameters idxs – List of indices of the documents in the index....
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-7
to n_trees * n if not provided Returns List of Documents most similar to the embedding. similarity_search_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to embedding vector. Parameters embedding – Embedding to look up...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-8
Returns List of Documents most similar to the query and score for each similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1) → List[Tuple[langchain.schema.Document, float]][source]# Return docs most similar to query. Parameters query – Text to look up documents similar to. k – ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-9
ids (Optional[List[str]]) – An optional list of ids. refresh (bool) – Whether or not to refresh indices with the updated data. Default True. Returns List of IDs of the added texts. Return type List[str] create_index(**kwargs: Any) → Any[source]# Creates an index in your project. See https://docs.nomic.ai/atlas_api.html...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-10
index_kwargs (Optional[dict]) – Dict of kwargs for index creation. See https://docs.nomic.ai/atlas_api.html Returns Nomic’s neural database and finest rhizomatic instrument Return type AtlasDB classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-11
Returns Nomic’s neural database and finest rhizomatic instrument Return type AtlasDB similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]# Run similarity search with AtlasDB Parameters query (str) – Query text to search for. k (int) – Number of results to return. Defaults t...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-12
Return type List[str] delete_collection() → None[source]# Delete the collection. classmethod from_documents(documents: List[Document], embedding: Optional[Embeddings] = None, ids: Optional[List[str]] = None, collection_name: str = 'langchain', persist_directory: Optional[str] = None, client_settings: Optional[chromadb....
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-13
Otherwise, the data will be ephemeral in-memory. Parameters texts (List[str]) – List of texts to add to the collection. collection_name (str) – Name of the collection to create. persist_directory (Optional[str]) – Directory to persist the collection. embedding (Optional[Embeddings]) – Embedding function. Defaults to No...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-14
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. Returns List of Documents selected by maximal marginal relevance. max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-15
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. Returns List of documents most similar to the query text. Return type List[Document] similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[langchain.schema.Document][source]...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-16
document (Document) – Document to update. class langchain.vectorstores.DeepLake(dataset_path: str = './deeplake/', token: Optional[str] = None, embedding_function: Optional[langchain.embeddings.base.Embeddings] = None, read_only: Optional[bool] = False, ingestion_batch_size: int = 1024, num_workers: int = 0, verbose: b...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-17
Returns List of IDs of the added texts. Return type List[str] delete(ids: Any[List[str], None] = None, filter: Any[Dict[str, str], None] = None, delete_all: Any[bool, None] = None) → bool[source]# Delete the entities in the dataset Parameters ids (Optional[List[str]], optional) – The document_ids to delete. Defaults to...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-18
in either the environment Local file system path of the form ./path/to/dataset or~/path/to/dataset or path/to/dataset. In-memory path of the form mem://path/to/dataset which doesn’tsave the dataset, but keeps it in memory instead. Should be used only for testing as it does not persist. documents (List[Document]) – List...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-19
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. :param embedding: Embedding to look up documents similar to. :param k: Number of Documents to return. Defaults to 4. :param fetch_k: Number of Documents to fetc...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-20
Returns List of Documents most similar to the query vector. similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to embedding vector. Parameters embedding – Embedding to look up documents similar to. k – Number of Documents to...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-21
You can install it with pip install “langchain[docarray]”. classmethod from_params(embedding: langchain.embeddings.base.Embeddings, work_dir: str, n_dim: int, dist_metric: Literal['cosine', 'ip', 'l2'] = 'cosine', max_elements: int = 1024, index: bool = True, ef_construction: int = 200, ef: int = 10, M: int = 16, allow...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-22
num_threads (int) – Sets the number of cpu threads to use. Defaults to 1. **kwargs – Other keyword arguments to be passed to the get_doc_cls method. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, work_dir: Optional[str] = None, n_dim: Op...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-23
Parameters embedding (Embeddings) – Embedding function. metric (str) – metric for exact nearest-neighbor search. Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”. Defaults to “cosine_sim”. **kwargs – Other keyword arguments to be passed to the get_doc_cls method. classmethod from_texts(texts: List[s...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-24
elasticsearch_url="http://localhost:9200", index_name="test_index", embedding=embedding ) To connect to an Elasticsearch instance that requires login credentials, including Elastic Cloud, use the Elasticsearch URL format https://username:password@es_host:9243. For example, to connect to Elastic Cloud, create th...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-25
embedding (Embeddings) – An object that provides the ability to embed text. It should be an instance of a class that subclasses the Embeddings abstract base class, such as OpenAIEmbeddings() Raises ValueError – If the elasticsearch python package is not installed. add_texts(texts: Iterable[str], metadatas: Optional[Lis...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-26
embeddings, elasticsearch_url="http://localhost:9200" ) similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to query. Parameters query – Text to look up documents similar to. k – Number of Documents to return. De...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-27
Run more texts through the embeddings and add to the vectorstore. Parameters text_embeddings – Iterable pairs of string and embedding to add to the vectorstore. metadatas – Optional list of metadatas associated with the texts. ids – Optional list of unique IDs. Returns List of ids from adding the texts into the vectors...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-28
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings) classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → langchain.vectorstores.faiss.FAISS[source]# Construct FAISS wrapper from raw...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-29
fetch_k – Number of Documents to fetch to pass to MMR algorithm. lambda_mult – Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_mar...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-30
and index_to_docstore_id to. index_name – for saving with a specific index file name similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to query. Parameters query – Text to look up documents similar to. k – Number of Documents to return. Defaults...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-31
Returns List of Documents most similar to the query and score for each class langchain.vectorstores.LanceDB(connection: Any, embedding: langchain.embeddings.base.Embeddings, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text')[source]# Wrapper around LanceDB vector datab...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-32
Return documents most similar to the query Parameters query – String to query the vectorstore with. k – Number of documents to return. Returns List of documents most similar to the query. class langchain.vectorstores.Milvus(embedding_function: langchain.embeddings.base.Embeddings, collection_name: str = 'LangChainColle...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-33
Returns The resulting keys for each inserted element. Return type List[str] classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'LangChainCollection', connection_args: dict[str, Any] = {'host': 'localhost', 'password': ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-34
Returns Milvus Vector Store Return type Milvus max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[langchain.schema.Document][source]# Perform a search and return...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-35
Parameters embedding (str) – The embedding vector being searched. k (int, optional) – How many results to give. Defaults to 4. fetch_k (int, optional) – Total results to select k from. Defaults to 20. lambda_mult – Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-36
Returns Document results for search. Return type List[Document] similarity_search_by_vector(embedding: List[float], k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[langchain.schema.Document][source]# Perform a similarity search against the query...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-37
Defaults to None. expr (str, optional) – Filtering expression. Defaults to None. timeout (int, optional) – How long to wait before timeout error. Defaults to None. kwargs – Collection.search() keyword arguments. Return type List[float], List[Tuple[Document, any, any]] similarity_search_with_score_by_vector(embedding: L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-38
to connect to MyScale. MyScale can not only search with simple vector indexes, it also supports complex query with multiple conditions, constraints and even sub-queries. For more information, please visit[myscale official site](https://docs.myscale.com/en/overview/) add_texts(texts: Iterable[str], metadatas: Optional[L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-39
Defaults to 32. metadata (List[dict], optional) – metadata to texts. Defaults to None. into (Other keyword arguments will pass) – [clickhouse-connect](https://clickhouse.com/docs/en/integrations/python#clickhouse-connect-driver-api) Returns MyScale Index property metadata_column: str# similarity_search(query: str, k: i...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-40
Returns List of (Document, similarity) Return type List[Document] similarity_search_with_relevance_scores(query: str, k: int = 4, where_str: Optional[str] = None, **kwargs: Any) → List[Tuple[langchain.schema.Document, float]][source]# Perform a similarity search with MyScale Parameters query (str) – query string k (int...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-41
must be same size to number of columns. For example: .. code-block:: python { ‘id’: ‘text_id’, ‘vector’: ‘text_embedding’, ‘text’: ‘text_plain’, ‘metadata’: ‘metadata_dictionary_in_json’, } Defaults to identity map. Show JSON schema{ "title": "MyScaleSettings", "description": "MyScale Client Configuration\n\nAttr...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-42
"type": "object", "properties": { "host": { "title": "Host", "default": "localhost", "env_names": "{'myscale_host'}", "type": "string" }, "port": { "title": "Port", "default": 8443, "env_names": "{'myscale_port'}", "type": "int...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-43
"type": "string" } }, "database": { "title": "Database", "default": "default", "env_names": "{'myscale_database'}", "type": "string" }, "table": { "title": "Table", "default": "langchain", "env_names": "{'myscale_table'}", ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-44
field table: str = 'langchain'# field username: Optional[str] = None# class langchain.vectorstores.OpenSearchVectorSearch(opensearch_url: str, index_name: str, embedding_function: langchain.embeddings.base.Embeddings, **kwargs: Any)[source]# Wrapper around OpenSearch as a vector database. Example from langchain import ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-45
texts, embeddings, opensearch_url="http://localhost:9200" ) OpenSearch by default supports Approximate Search powered by nmslib, faiss and lucene engines recommended for large datasets. Also supports brute force search through Script Scoring and Painless Scripting. Optional Args:vector_field: Document field emb...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-46
Returns List of Documents most similar to the query. Optional Args:vector_field: Document field embeddings are stored in. Defaults to “vector_field”. text_field: Document field the text of the document is stored in. Defaults to “text”. metadata_field: Document field that metadata is stored in. Defaults to “metadata”. C...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-47
nearest neighbors; default: {“match_all”: {}} similarity_search_with_score(query: str, k: int = 4, **kwargs: Any) → List[Tuple[langchain.schema.Document, float]][source]# Return docs and it’s scores most similar to query. By default supports Approximate Search. Also supports Script Scoring and Painless Scripting. Param...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-48
metadatas – Optional list of metadatas associated with the texts. ids – Optional list of ids to associate with the texts. namespace – Optional pinecone namespace to add the texts to. Returns List of ids from adding the texts into the vectorstore. classmethod from_existing_index(index_name: str, embedding: langchain.emb...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-49
Return pinecone documents most similar to query. Parameters query – Text to look up documents similar to. k – Number of Documents to return. Defaults to 4. filter – Dictionary of argument(s) to filter on metadata namespace – Namespace to search in. Default will search in ‘’ namespace. Returns List of Documents most sim...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-50
CONTENT_KEY = 'page_content'# METADATA_KEY = 'metadata'# add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]# Run more texts through the embeddings and add to the vectorstore. Parameters texts – Iterable of strings to add to the vectorstore. metadatas – Optional li...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-51
If str - use it as a url parameter. If None - fallback to relying on host and port parameters. url – either host or str of “Optional[scheme], host, Optional[port], Optional[prefix]”. Default: None port – Port of the REST API interface. Default: 6333 grpc_port – Port of the gRPC interface. Default: 6334 prefer_grpc – If...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-52
This is a user friendly interface that: Creates embeddings, one for each text Initializes the Qdrant database as an in-memory docstore by default (and overridable to a remote docstore) Adds the text embeddings to the Qdrant database This is intended to be a quick way to get started. Example from langchain import Qdrant...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-53
filter – Filter by metadata. Defaults to None. Returns List of Documents most similar to the query. similarity_search_with_score(query: str, k: int = 4, filter: Optional[Dict[str, Union[str, int, bool, dict, list]]] = None) → List[Tuple[langchain.schema.Document, float]][source]# Return docs most similar to query. Para...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-54
Add more texts to the vectorstore. Parameters texts (Iterable[str]) – Iterable of strings/text to add to the vectorstore. metadatas (Optional[List[dict]], optional) – Optional list of metadatas. Defaults to None. embeddings (Optional[List[List[float]]], optional) – Optional pre-generated embeddings. Defaults to None. k...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-55
Create a Redis vectorstore from raw documents. This is a user-friendly interface that: Embeds documents. Creates a new index for the embeddings in Redis. Adds the documents to the newly created Redis index. This is intended to be a quick way to get started. .. rubric:: Example classmethod from_texts_return_keys(texts: ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-56
Returns the most similar indexed documents to the query text within the score_threshold range. Parameters query (str) – The query text for which to find similar documents. k (int) – The number of documents to return. Default is 4. score_threshold (float) – The minimum matching score required for a document 0.2. (to be ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-57
Note that the Supabase Python client does not yet support async operations. If you’d like to use max_marginal_relevance_search, please review the instructions below on modifying the match_documents function to return matched embeddings. add_texts(texts: Iterable[str], metadatas: Optional[List[dict[Any, Any]]] = None, *...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-58
fetch_k – Number of Documents to fetch to pass to MMR algorithm. lambda_mult – Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_mar...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-59
to maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. query_name: str# similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to query. similarity_search_by_vector(embeddin...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-60
Returns List of Tuples of (doc, similarity_score) table_name: str# class langchain.vectorstores.Tair(embedding_function: langchain.embeddings.base.Embeddings, url: str, index_name: str, content_key: str = 'content', metadata_key: str = 'metadata', search_params: Optional[dict] = None, **kwargs: Any)[source]# add_texts(...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
9d1020606394-61
Connect to an existing Tair index. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, index_name: str = 'langchain', content_key: str = 'content', metadata_key: str = 'metadata', **kwargs: Any) → langchain.vectorstores.tair.Tair[source]# Ret...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html