id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 49 117 |
|---|---|---|
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-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 |
4dc2e35c1208-15 | field account_sid: Optional[str] = None#
Twilio account string identifier.
field auth_token: Optional[str] = None#
Twilio auth token.
field from_number: Optional[str] = None#
A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164)
format, an
[alphanumeric sender ID](https://www.twilio.com/docs/... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
4dc2e35c1208-16 | fetch page summaries. By default, it will return the page summaries
of the top-k results.
It limits the Document content by doc_content_chars_max.
field doc_content_chars_max: int = 4000#
field lang: str = 'en'#
field load_all_available_meta: bool = False#
field top_k_results: int = 3#
load(query: str) β List[langchain... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-47 | Return docs and itβs scores most similar to query.
By default supports Approximate Search.
Also supports Script Scoring and Painless Scripting.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
Returns
List of Documents along with its scores most similar to the q... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-48 | Returns
List of ids from adding the texts into the vectorstore.
classmethod from_existing_index(index_name: str, embedding: langchain.embeddings.base.Embeddings, text_key: str = 'text', namespace: Optional[str] = None) β langchain.vectorstores.pinecone.Pinecone[source]#
Load pinecone vectorstore from index name.
classm... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-49 | 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 similar to the query and score for each
similarity_search_with_score(query: str, k: int = 4, filter: Optional... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-50 | Run more texts through the embeddings and add to the vectorstore.
Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
Returns
List of ids from adding the texts into the vectorstore.
classmethod from_texts(texts: List[str], embedding: langch... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-51 | port β Port of the REST API interface. Default: 6333
grpc_port β Port of the gRPC interface. Default: 6334
prefer_grpc β If true - use gPRC interface whenever possible in custom methods.
Default: False
https β If true - use HTTPS(SSL) protocol. Default: None
api_key β API key for authentication in Qdrant Cloud. Default... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-52 | This is intended to be a quick way to get started.
Example
from langchain import Qdrant
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
qdrant = Qdrant.from_texts(texts, embeddings, "localhost")
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-53 | 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.
Parameters
query β Text to look up documents simila... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-54 | 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.
keys (Optional[List[str]], optional)... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-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 |
81aeebd1004b-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 |
81aeebd1004b-57 | Run more texts through the embeddings and add to the vectorstore.
Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
kwargs β vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
classmethod from_... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-58 | 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, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-59 | 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 requires that query_name returns matched
embeddings alongside the match documents. The following function ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-60 | 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(embedding: List[float], k: int = 4, **kwargs: Any) β List[langchain.schema... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-61 | 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 |
81aeebd1004b-62 | 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 |
81aeebd1004b-63 | "connection_timeout_seconds": 2
}
)
typesense_collection_name = "langchain-memory"
embedding = OpenAIEmbeddings()
vectorstore = Typesense(
typesense_client,
typesense_collection_name,
embedding.embed_query,
"text",
)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Option... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-64 | protocol="http",
typesense_collection_name="langchain-memory",
)
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, typesense_client: Optional[Client] = None, typesense_client_params: Optional[dict] = None, typesense_collection_na... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-65 | Implementation of Vector Store using Vectara (https://vectara.com).
.. rubric:: Example
from langchain.vectorstores import Vectara
vectorstore = Vectara(
vectara_customer_id=vectara_customer_id,
vectara_corpus_id=vectara_corpus_id,
vectara_api_key=vectara_api_key
)
add_texts(texts: Iterable[str], metadatas:... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-66 | Return Vectara documents most similar to query, along with scores.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 5.
filter β Dictionary of argument(s) to filter on metadata. For example a
filter can be βdoc.rating > 3.0 and part.lang = βdeuββ} see
https://docs.v... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-67 | Returns
List of IDs of the added texts.
Return type
List[str]
async aadd_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.
add_documents(documents: List[langchain.schema.Document], **kwargs: Any) β Li... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-68 | Return VectorStore initialized from texts and embeddings.
async amax_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.
async amax_marginal_relevance_search_by... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-69 | Return VectorStore initialized from documents and embeddings.
abstract classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) β langchain.vectorstores.base.VST[source]#
Return VectorStore initialized from texts and embeddings.
max... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-70 | 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.
search(query: str, search_type: str, **kwargs: Any) β List[langchain.sch... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-71 | Returns
List of Tuples of (doc, similarity_score)
class langchain.vectorstores.Weaviate(client: typing.Any, index_name: str, text_key: str, embedding: typing.Optional[langchain.embeddings.base.Embeddings] = None, attributes: typing.Optional[typing.List[str]] = None, relevance_score_fn: typing.Optional[typing.Callable[[... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-72 | weaviate = Weaviate.from_texts(
texts,
embeddings,
weaviate_url="http://localhost:8080"
)
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.
Ma... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-73 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
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 t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
81aeebd1004b-74 | 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] = {}, consistency_level: str = 'Session', index_params: Optional[dict] = None, search_params: Optional[dict] = N... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
d9791a2a267c-0 | .rst
.pdf
Document Compressors
Document Compressors#
pydantic model langchain.retrievers.document_compressors.CohereRerank[source]#
field client: Client [Required]#
field model: str = 'rerank-english-v2.0'#
field top_n: int = 3#
async acompress_documents(documents: Sequence[langchain.schema.Document], query: str) β Seq... | https://python.langchain.com/en/latest/reference/modules/document_compressors.html |
d9791a2a267c-1 | similarity_threshold must be specified. Defaults to 20.
field similarity_fn: Callable = <function cosine_similarity>#
Similarity function for comparing documents. Function expected to take as input
two matrices (List[List[float]]) and return a matrix of scores where higher values
indicate greater similarity.
field simi... | https://python.langchain.com/en/latest/reference/modules/document_compressors.html |
d9791a2a267c-2 | Compress page content of raw documents.
classmethod from_llm(llm: langchain.base_language.BaseLanguageModel, prompt: Optional[langchain.prompts.prompt.PromptTemplate] = None, get_input: Optional[Callable[[str, langchain.schema.Document], str]] = None, llm_chain_kwargs: Optional[dict] = None) β langchain.retrievers.docu... | https://python.langchain.com/en/latest/reference/modules/document_compressors.html |
16a9fc0a6309-0 | .rst
.pdf
Retrievers
Retrievers#
pydantic model langchain.retrievers.ArxivRetriever[source]#
It is effectively a wrapper for ArxivAPIWrapper.
It wraps load() to get_relevant_documents().
It uses all ArxivAPIWrapper arguments without any change.
async aget_relevant_documents(query: str) β List[langchain.schema.Document]... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-1 | get_relevant_documents(query: str) β List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
pydantic model langchain.retrievers.ChatGPTPluginRetriever[source]#
field aiosession: Optional[aiohttp.client.Clie... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-2 | Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
Sequence of relevant documents
class langchain.retrievers.DataberryRetriever(datastore_url: str, top_k: Optional[int] = None, api_key: Optional[str] = None)[source]#
async aget_relevant_documents(query: str) β List[lang... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-3 | 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.
add_texts(texts: Iterable[str], refresh_indices: bool = True) β List[str][source]#
Run more texts through t... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-4 | Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
classmethod from_texts(texts: List[str], embeddings: langchain.embeddings.base.Embeddings, **kwargs: Any) β langchain.retrievers.knn.KNNRetriever[source]#
get_relevant_documents(query: str) β ... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-5 | Parameters
query β string to find relevant documents for
Returns
List of relevant documents
get_relevant_documents(query: str) β List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
pydantic model langcha... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-6 | get_relevant_documents(query: str) β List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
pydantic model langchain.retrievers.SelfQueryRetriever[source]#
Retriever that wraps around a vector store and use... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-7 | get_relevant_documents(query: str) β List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
pydantic model langchain.retrievers.TFIDFRetriever[source]#
field docs: List[langchain.schema.Document] [Required]... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-8 | field default_salience: Optional[float] = None#
The salience to assign memories not retrieved from the vector store.
None assigns no salience to documents not fetched from the vector store.
field k: int = 4#
The maximum number of documents to retrieve in a given call.
field memory_stream: List[langchain.schema.Document... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-9 | Get documents relevant for a query.
Parameters
query β string to find relevant documents for
Returns
List of relevant documents
classmethod from_params(url: str, content_field: str, *, k: Optional[int] = None, metadata_fields: Union[Sequence[str], Literal['*']] = (), sources: Optional[Union[Sequence[str], Literal['*']]... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-10 | class langchain.retrievers.WeaviateHybridSearchRetriever(client: Any, index_name: str, text_key: str, alpha: float = 0.5, k: int = 4, attributes: Optional[List[str]] = None, create_schema_if_missing: bool = True)[source]#
class Config[source]#
Configuration for this pydantic object.
arbitrary_types_allowed = True#
extr... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
16a9fc0a6309-11 | Parameters
query β string to find relevant documents for
Returns
List of relevant documents
class langchain.retrievers.ZepRetriever(session_id: str, url: str, top_k: Optional[int] = None)[source]#
A Retriever implementation for the Zep long-term memory store. Search your
userβs long-term chat history with Zep.
Note: Yo... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
3f8e72e88e34-0 | .rst
.pdf
Docstore
Docstore#
Wrappers on top of docstores.
class langchain.docstore.InMemoryDocstore(_dict: Dict[str, langchain.schema.Document])[source]#
Simple in memory docstore in the form of a dict.
add(texts: Dict[str, langchain.schema.Document]) β None[source]#
Add texts to in memory dictionary.
search(search: s... | https://python.langchain.com/en/latest/reference/modules/docstore.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.