id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
59
127
fe18070e4f36-22
load_questions_and_answers(url_override: Optional[str] = None) β†’ List[langchain.schema.Document][source]# static load_suggestions(query: str = '', doc_type: str = 'all') β†’ List[langchain.schema.Document][source]# class langchain.document_loaders.IMSDbLoader(web_path: Union[str, List[str]], header_template: Optional[dic...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-23
[β€œβ€, β€œβ€, β€œβ€] -> schema = .[] load() β†’ List[langchain.schema.Document][source]# Load and return documents from the JSON file. class langchain.document_loaders.JoplinLoader(access_token: Optional[str] = None, port: int = 41184, host: str = 'localhost')[source]# Loader that fetches notes from Joplin. In order to use this ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-24
encoding (str, optional) – Charset encoding, defaults to β€œutf8” load() β†’ List[langchain.schema.Document][source]# Load from file path. class langchain.document_loaders.MastodonTootsLoader(mastodon_accounts: Sequence[str], number_toots: Optional[int] = 100, exclude_replies: bool = False, access_token: Optional[str] = No...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-25
Convenience constructor that builds the MaxCompute API wrapper fromgiven parameters. Parameters query – SQL query to execute. endpoint – MaxCompute endpoint. project – A project is a basic organizational unit of MaxCompute, which is similar to a database. access_id – MaxCompute access ID. Should be passed in directly o...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-26
:type request_timeout_sec: int load() β†’ List[langchain.schema.Document][source]# Load documents from the Notion database. :returns: List of documents. :rtype: List[Document] load_page(page_id: str) β†’ langchain.schema.Document[source]# Read a page. class langchain.document_loaders.NotionDirectoryLoader(path: str)[source...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-27
Return type List[Document] Raises ValueError – If the specified drive ID does not correspond to a drive in the OneDrive storage. – class langchain.document_loaders.OnlinePDFLoader(file_path: str)[source]# Loader that loads online PDFs. load() β†’ List[langchain.schema.Document][source]# Load documents. class langchain.d...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-28
alias of langchain.document_loaders.pdf.PyPDFLoader class langchain.document_loaders.PlaywrightURLLoader(urls: List[str], continue_on_failure: bool = True, headless: bool = True, remove_selectors: Optional[List[str]] = None)[source]# Loader that uses Playwright and to load a page and unstructured to load the html. This...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-29
load() β†’ List[langchain.schema.Document][source]# Load data into document objects. class langchain.document_loaders.PyPDFLoader(file_path: str)[source]# Loads a PDF with pypdf and chunks at character level. Loader also stores page numbers in metadatas. lazy_load() β†’ Iterator[langchain.schema.Document][source]# Lazy loa...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-30
Load Python files, respecting any non-default encoding if specified. class langchain.document_loaders.ReadTheDocsLoader(path: Union[str, pathlib.Path], encoding: Optional[str] = None, errors: Optional[str] = None, custom_html_tag: Optional[Tuple[str, dict]] = None, **kwargs: Optional[Any])[source]# Loader that loads Re...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-31
Loader for .srt (subtitle) files. load() β†’ List[langchain.schema.Document][source]# Load using pysrt file. class langchain.document_loaders.SeleniumURLLoader(urls: List[str], continue_on_failure: bool = True, browser: Literal['chrome', 'firefox'] = 'chrome', binary_location: Optional[str] = None, executable_path: Optio...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-32
Loader that fetches a sitemap and loads those URLs. load() β†’ List[langchain.schema.Document][source]# Load sitemap. parse_sitemap(soup: Any) β†’ List[dict][source]# Parse sitemap xml and load into a list of dicts. class langchain.document_loaders.SlackDirectoryLoader(zip_path: str, workspace_url: Optional[str] = None)[so...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-33
load() β†’ List[langchain.schema.Document][source]# Load data into document objects. class langchain.document_loaders.TelegramChatApiLoader(chat_entity: Optional[EntityLike] = None, api_id: Optional[int] = None, api_hash: Optional[str] = None, username: Optional[str] = None, file_path: str = 'telegram_data.json')[source]...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-34
Lazily load the file. load() β†’ List[langchain.schema.Document][source]# Load file. class langchain.document_loaders.TomlLoader(source: Union[str, pathlib.Path])[source]# A TOML document loader that inherits from the BaseLoader class. This class can be initialized with either a single source file or a source directory c...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-35
include_comments – Whether to include the comments on the card in the document. include_checklist – Whether to include the checklist on the card in the document. card_filter – Filter on card status. Valid values are β€œclosed”, β€œopen”, β€œall”. extra_metadata – List of additional metadata fields to include as document meta...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-36
load() β†’ List[langchain.schema.Document][source]# Load tweets. class langchain.document_loaders.UnstructuredAPIFileIOLoader(file: Union[IO, Sequence[IO]], mode: str = 'single', url: str = 'https://api.unstructured.io/general/v0/general', api_key: str = '', **unstructured_kwargs: Any)[source]# Loader that uses the unstr...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-37
Loader that uses unstructured to load file IO objects. class langchain.document_loaders.UnstructuredFileLoader(file_path: Union[str, List[str]], mode: str = 'single', **unstructured_kwargs: Any)[source]# Loader that uses unstructured to load files. class langchain.document_loaders.UnstructuredHTMLLoader(file_path: Unio...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-38
Loader that uses unstructured to load rtf files. class langchain.document_loaders.UnstructuredURLLoader(urls: List[str], continue_on_failure: bool = True, mode: str = 'single', **unstructured_kwargs: Any)[source]# Loader that uses unstructured to load HTML files. load() β†’ List[langchain.schema.Document][source]# Load f...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-39
aload() β†’ List[langchain.schema.Document][source]# Load text from the urls in web_path async into Documents. default_parser: str = 'html.parser'# Default parser to use for BeautifulSoup. async fetch_all(urls: List[str]) β†’ Any[source]# Fetch all urls concurrently with rate limiting. load() β†’ List[langchain.schema.Docume...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
fe18070e4f36-40
Load data into document objects. class langchain.document_loaders.YoutubeLoader(video_id: str, add_video_info: bool = False, language: Union[str, Sequence[str]] = 'en', translation: str = 'en', continue_on_failure: bool = False)[source]# Loader that loads Youtube transcripts. static extract_video_id(youtube_url: str) β†’...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html
0efe78fd32e2-0
.rst .pdf SerpAPI SerpAPI# For backwards compatiblity. pydantic model langchain.serpapi.SerpAPIWrapper[source]# Wrapper around SerpAPI. 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 param...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/serpapi.html
6d5c37c1dbcb-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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-5
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 relevance optimizes for similar...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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 – ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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[...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-12
Parameters documents (List[Document]) – List of documents to add to the vectorstore. embedding (Optional[Embeddings]) – Embedding function. Defaults to None. table_name (str) – Name of the collection to create. logging_and_data_dir (Optional[str]) – Directory to persist the table. client (Optional[awadb.Client]) – AwaD...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-13
Return docs most similar to query. similarity_search_by_vector(embedding: Optional[List[float]] = None, k: int = 4, scores: Optional[list] = None, **kwargs: Any) β†’ List[langchain.schema.Document][source]# Return docs most similar to embedding vector. Parameters embedding – Embedding to look up documents similar to. k –...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-14
Add texts data to an existing index. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, azure_search_endpoint: str = '', azure_search_key: str = '', index_name: str = 'langchain-index', **kwargs: Any) β†’ langchain.vectorstores.azuresearch.Azu...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-15
Return type List[Document] semantic_hybrid_search_with_score(query: str, k: int = 4, filters: Optional[str] = None) β†’ List[Tuple[langchain.schema.Document, float]][source]# Return docs most similar to query with an hybrid query. Parameters query – Text to look up documents similar to. k – Number of Documents to return....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-16
Returns List of Documents most similar to the query and score for each class langchain.vectorstores.Chroma(collection_name: str = 'langchain', embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, collection_metadata: Option...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-17
Create a Chroma vectorstore from a list of documents. If a persist_directory is specified, the collection will be persisted there. Otherwise, the data will be ephemeral in-memory. Parameters collection_name (str) – Name of the collection to create. persist_directory (Optional[str]) – Directory to persist the collection...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-18
ids (Optional[List[str]]) – List of document IDs. Defaults to None. client_settings (Optional[chromadb.config.Settings]) – Chroma client settings Returns Chroma vectorstore. Return type Chroma get(include: Optional[List[str]] = None) β†’ Dict[str, Any][source]# Gets the collection. Parameters include (Optional[List[str]]...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-19
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters embedding – Embedding to look up documents similar to. k – Number of Documents to return. Defaults to 4. fetch_k – Number of Documents to fetch to pass to MMR algorithm. lambda_mult – Number between 0 and 1 t...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-20
:param k: Number of Documents to return. Defaults to 4. :type k: int :param filter: Filter by metadata. Defaults to None. :type filter: Optional[Dict[str, str]] Returns List of Documents most similar to the query vector. similarity_search_with_score(query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwa...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-21
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, batch_size: int = 32, ids: Optional[Iterable[str]] = None, **kwargs: Any) β†’ List[str][source]# Insert more texts through the embeddings and add to the VectorStore. Parameters texts – Iterable of strings to add to the VectorStore. ids – Optional lis...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-22
Returns ClickHouse Index property metadata_column: str# similarity_search(query: str, k: int = 4, where_str: Optional[str] = None, **kwargs: Any) β†’ List[langchain.schema.Document][source]# Perform a similarity search with ClickHouse Parameters query (str) – query string k (int, optional) – Top K neighbors to retrieve. ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-23
Perform a similarity search with ClickHouse Parameters query (str) – query string k (int, optional) – Top K neighbors to retrieve. Defaults to 4. where_str (Optional[str], optional) – where condition string. Defaults to None. NOTE – Please do not let end-user to fill this and always be aware of SQL injection. When deal...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-24
β€˜uuid’: β€˜global_unique_id’ β€˜embedding’: β€˜text_embedding’, β€˜document’: β€˜text_plain’, β€˜metadata’: β€˜metadata_dictionary_in_json’, } Defaults to identity map. Show JSON schema{ "title": "ClickhouseSettings",
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-25
Show JSON schema{ "title": "ClickhouseSettings", "description": "ClickHouse Client Configuration\n\nAttribute:\n clickhouse_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n clickhouse_port (int) : URL port to connect with HTTP. Defaults to 8443.\n us...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-26
"type": "object", "properties": { "host": { "title": "Host", "default": "localhost", "env_names": "{'clickhouse_host'}", "type": "string" }, "port": { "title": "Port", "default": 8123, "env_names": "{'clickhouse_port'}", "type"...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-27
"type": "string" } }, "column_map": { "title": "Column Map", "default": { "id": "id", "uuid": "uuid", "document": "document", "embedding": "embedding", "metadata": "metadata" }, "env_names": "{'clickhous...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-28
port (int) table (str) username (Optional[str]) field column_map: Dict[str, str] = {'document': 'document', 'embedding': 'embedding', 'id': 'id', 'metadata': 'metadata', 'uuid': 'uuid'}# field database: str = 'default'# field host: str = 'localhost'# field index_param: Optional[Union[List, Dict]] = [100, "'L2Distance'"...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-29
To use, you should have the deeplake python package installed. Example from langchain.vectorstores import DeepLake from langchain.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings() vectorstore = DeepLake("langchain_store", embeddings.embed_query) add_texts(texts: Iterable[str], metadatas: Optiona...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-30
Force delete dataset by path classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, dataset_path: str = './deeplake/', **kwargs: Any) β†’ langchain.vectorstores.deeplake.DeepLake[source]# Create a ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-31
Returns Deep Lake dataset. Return type DeepLake 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 relevance optimizes for similarity to q...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-32
persist() β†’ None[source]# Persist the collection. similarity_search(query: str, k: int = 4, **kwargs: Any) β†’ List[langchain.schema.Document][source]# Return docs most similar to query. Parameters query – text to embed and run the query on. k – Number of Documents to return. Defaults to 4. query – Text to look up docume...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-33
Run similarity search with Deep Lake with distance returned. Parameters query (str) – Query text to search for. distance_metric – L2 for Euclidean, L1 for Nuclear, max L-infinity distance, cos for cosine similarity, β€˜dot’ for dot product. Defaults to L2. k (int) – Number of results to return. Defaults to 4. filter (Opt...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-34
n_dim (int) – dimension of an embedding. dist_metric (str) – Distance metric for DocArrayHnswSearch can be one of: β€œcosine”, β€œip”, and β€œl2”. Defaults to β€œcosine”. max_elements (int) – Maximum number of vectors that can be stored. Defaults to 1024. index (bool) – Whether an index should be built for this field. Defaults...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-35
n_dim (int) – dimension of an embedding. **kwargs – Other keyword arguments to be passed to the __init__ method. Returns DocArrayHnswSearch Vector Store class langchain.vectorstores.DocArrayInMemorySearch(doc_index: BaseDocIndex, embedding: langchain.embeddings.base.Embeddings)[source]# Wrapper around in-memory storage...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-36
if it exists. Defaults to None. metric (str) – metric for exact nearest-neighbor search. Can be one of: β€œcosine_sim”, β€œeuclidean_dist” and β€œsqeuclidean_dist”. Defaults to β€œcosine_sim”. Returns DocArrayInMemorySearch Vector Store class langchain.vectorstores.ElasticVectorSearch(elasticsearch_url: str, index_name: str, e...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-37
Locate the β€œelastic” user and click β€œEdit” Click β€œReset password” Follow the prompts to reset the password The format for Elastic Cloud URLs is https://username:password@cluster_id.region_id.gcp.cloud.es.io:9243. Example from langchain import ElasticVectorSearch from langchain.embeddings import OpenAIEmbeddings embeddi...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-38
create_index(client: Any, index_name: str, mapping: Dict) β†’ None[source]# classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, elasticsearch_url: Optional[str] = None, index_name: Optional[str] = None, refresh_indices: bool = True, **kwargs: A...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-39
:param k: Number of Documents to return. Defaults to 4. Returns List of Documents most similar to the query. class langchain.vectorstores.FAISS(embedding_function: typing.Callable, index: typing.Any, docstore: langchain.docstore.base.Docstore, index_to_docstore_id: typing.Dict[int, str], relevance_score_fn: typing.Opti...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-40
Returns List of ids from adding the texts into the vectorstore. classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) β†’ langchain.vectorstores.faiss.FAISS[source...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-41
Load FAISS index, docstore, and index_to_docstore_id from disk. Parameters folder_path – folder path to load index, docstore, and index_to_docstore_id from. embeddings – Embeddings to use when generating queries index_name – for saving with a specific index file name max_marginal_relevance_search(query: str, k: int = 4...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-42
k – Number of Documents to return. Defaults to 4. fetch_k – Number of Documents to fetch before filtering 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. Return...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-43
Defaults to 20. Returns List of Documents most similar to the query. similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, Any]] = None, fetch_k: int = 20, **kwargs: Any) β†’ List[langchain.schema.Document][source]# Return docs most similar to embedding vector. Parameters embedding – ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-44
Return docs most similar to query. Parameters embedding – Embedding vector to look up documents similar to. k – Number of Documents to return. Defaults to 4. filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. fetch_k – (Optional[int]) Number of Documents to fetch before filtering. Defaults to 20....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-45
kwargs – vectorstore specific parameters add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = 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. metada...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-46
Construct Hologres wrapper from raw documents and pre- generated embeddings. Return VectorStore initialized from documents and embeddings. Postgres connection string is required β€œEither pass it as a parameter or set the HOLOGRES_CONNECTION_STRING environment variable. Example from langchain import Hologres from langcha...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-47
Run similarity search with Hologres with distance. Parameters query (str) – Query text to search for. 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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-48
Wrapper around LanceDB vector database. To use, you should have lancedb python package installed. Example db = lancedb.connect('./lancedb') table = db.open_table('my_table') vectorstore = LanceDB(table, embedding_function) vectorstore.add_texts(['text1', 'text2']) result = vectorstore.similarity_search('text1') add_tex...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-49
Returns List of documents most similar to the query. class langchain.vectorstores.MatchingEngine(project_id: str, index: MatchingEngineIndex, endpoint: MatchingEngineIndexEndpoint, embedding: Embeddings, gcs_client: storage.Client, gcs_bucket_name: str, credentials: Optional[Credentials] = None)[source]# Vertex Matchin...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-50
region – The default location making the API calls. It must have regional. (the same location as the GCS bucket and must be) – gcs_bucket_name – The location where the vectors will be stored in created. (order for the index to be) – index_id – The id of the created index. endpoint_id – The id of the created endpoint....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-51
Wrapper around the Milvus vector database. add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, timeout: Optional[int] = None, batch_size: int = 1000, **kwargs: Any) β†’ List[str][source]# Insert text data into Milvus. Inserting data when the collection has not be made yet will result in creating a new...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-52
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': ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-53
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-54
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 ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-55
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-56
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-57
To use, you should have both: - the pymongo python package installed - a connection string associated with a MongoDB Atlas Cluster having deployed an Atlas Search index Example from langchain.vectorstores import MongoDBAtlasVectorSearch from langchain.embeddings.openai import OpenAIEmbeddings from pymongo import MongoC...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-58
This is intended to be a quick way to get started. Example similarity_search(query: str, k: int = 4, pre_filter: Optional[dict] = None, post_filter_pipeline: Optional[List[Dict]] = None, **kwargs: Any) β†’ List[langchain.schema.Document][source]# Return MongoDB documents most similar to query. Use the knnBeta Operator av...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-59
Parameters query – Text to look up documents similar to. k – Optional Number of Documents to return. Defaults to 4. pre_filter – Optional Dictionary of argument(s) to prefilter on document fields. post_filter_pipeline – Optional Pipeline of MongoDB aggregation stages following the knnBeta search. Returns List of Docume...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-60
Helper function: Drop data escape_str(value: str) β†’ str[source]# classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, config: Optional[langchain.vectorstores.myscale.MyScaleSettings] = None, text_ids: Optional[Iterable[str]] = None, ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-61
of SQL injection. When dealing with metadatas, remember to use {self.metadata_column}.attribute instead of attribute alone. The default name for it is metadata. Returns List of Documents Return type List[Document] similarity_search_by_vector(embedding: List[float], k: int = 4, where_str: Optional[str] = None, **kwargs:...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-62
List of documents most similar to the query text and cosine distance in float for each. Lower score represents more similarity. Return type List[Document] pydantic settings langchain.vectorstores.MyScaleSettings[source]# MyScale Client Configuration Attribute: myscale_host (str)An URL to connect to MyScale backend.Defa...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-63
Show JSON schema{ "title": "MyScaleSettings", "description": "MyScale Client Configuration\n\nAttribute:\n myscale_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.\n username (str)...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-64
}, "port": { "title": "Port", "default": 8443, "env_names": "{'myscale_port'}", "type": "integer" }, "username": { "title": "Username", "env_names": "{'myscale_username'}", "type": "string" }, "password": { "title": "P...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-65
}, "table": { "title": "Table", "default": "langchain", "env_names": "{'myscale_table'}", "type": "string" }, "metric": { "title": "Metric", "default": "cosine", "env_names": "{'myscale_metric'}", "type": "string" } }, ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-66
Example from langchain import OpenSearchVectorSearch opensearch_vector_search = OpenSearchVectorSearch( "http://localhost:9200", "embeddings", embedding_function ) add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **kwargs: Any) β†’ List[str][source]# Run more texts...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-67
search through Script Scoring and Painless Scripting. 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”. Optional Keyword Args for Approximate Search:engine: β€œnmslib”, β€œfaiss”, β€œlucene”; d...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-68
metadata_field: Document field that metadata is stored in. Defaults to β€œmetadata”. Can be set to a special value β€œ*” to include the entire document. Optional Args for Approximate Search:search_type: β€œapproximate_search”; default: β€œapproximate_search” boolean_filter: A Boolean filter consists of a Boolean query that con...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-69
k – Number of Documents to return. Defaults to 4. Returns List of Documents along with its scores most similar to the query. Optional Args:same as similarity_search class langchain.vectorstores.Pinecone(index: Any, embedding_function: Callable, text_key: str, namespace: Optional[str] = None)[source]# Wrapper around Pin...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-70
Load pinecone vectorstore from index name. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_size: int = 32, text_key: str = 'text', index_name: Optional[str] = None, namespace: Optional[str] = None, *...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-71
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_marginal_relevance_search_by_vector(embedding: List[float], k: int =...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-72
Returns List of Documents most similar to the query and score for each similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None) β†’ List[Tuple[langchain.schema.Document, float]][source]# Return pinecone documents most similar to query, along with scores. Paramet...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-73
Parameters texts – Iterable of strings to add to the vectorstore. metadatas – Optional list of metadatas associated with the texts. ids – Optional list of ids to associate with the texts. Ids have to be uuid-like strings. batch_size – How many vectors upload per-request. Default: 64 Returns List of ids from adding the ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-74
Construct Qdrant wrapper from a list of texts. Parameters texts – A list of texts to be indexed in Qdrant. embedding – A subclass of Embeddings, responsible for text vectorization. metadatas – An optional list of metadata. If provided it has to be of the same length as a list of texts. ids – Optional list of ids to ass...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-75
collection_name – Name of the Qdrant collection to be used. If not provided, it will be created randomly. Default: None distance_func – Distance function. One of: β€œCosine” / β€œEuclid” / β€œDot”. Default: β€œCosine” content_payload_key – A payload key used to store the content of the document. Default: β€œpage_content” metadat...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-76
init_from – Use data stored in another collection to initialize this collection **kwargs – Additional arguments passed directly into REST client initialization This is a user-friendly interface that: 1. Creates embeddings, one for each text 2. Initializes the Qdrant database as an in-memory docstore by default (and ove...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-77
Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. similarity_search(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.Re...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-78
Returns List of Documents most similar to the query. similarity_search_with_score(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = No...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html
6d5c37c1dbcb-79
distance in float for each. Lower score represents more similarity. class langchain.vectorstores.Redis(redis_url: str, index_name: str, embedding_function: typing.Callable, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', relevance_score_fn: typing.Optional[typing.Callab...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html