id
stringlengths
14
16
text
stringlengths
4
1.28k
source
stringlengths
54
121
4a1bad429950-189
namespace (Optional[str]) – Namespace to search in. Default will search in β€˜β€™ namespace. kwargs (Any) – Returns List of Documents most similar to the query and score for each Return type List[langchain.schema.Document] max_marginal_relevance_search_by_vector(embedding, k=4, fetch_k=20, lambda_mult=0.5, filter=None, na...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-190
of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5. filter (Optional[dict]) – namespace (Optional[str]) – kwargs (Any) – Returns List of Documents selected by maximal marginal relevance. Return type List[langchain.schema.Document] max_marginal_relevan...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-191
lambda_mult (float) – 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. filter (Optional[dict]) – namespace (Optional[str]) – kwargs (Any) – Returns List of Documents selected by maximal marginal rel...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-192
Example from langchain import Pinecone from langchain.embeddings import OpenAIEmbeddings import pinecone # The environment should be the one specified next to the API key # in your Pinecone console pinecone.init(api_key="***", environment="...") embeddings = OpenAIEmbeddings() pinecone = Pinecone.from_texts( texts,...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-193
classmethod from_existing_index(index_name, embedding, text_key='text', namespace=None)[source] Load pinecone vectorstore from index name. Parameters index_name (str) – embedding (langchain.embeddings.base.Embeddings) – text_key (str) – namespace (Optional[str]) – Return type langchain.vectorstores.pinecone.Pineco...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-194
Example from qdrant_client import QdrantClient from langchain import Qdrant client = QdrantClient() collection_name = "MyCollection" qdrant = Qdrant(client, collection_name, embedding_function) Parameters client (Any) – collection_name (str) – embeddings (Optional[Embeddings]) – content_payload_key (str) – metadata...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-195
metadatas (Optional[List[dict]]) – Optional list of metadatas associated with the texts. ids (Optional[Sequence[str]]) – Optional list of ids to associate with the texts. Ids have to be uuid-like strings. batch_size (int) – How many vectors upload per-request. Default: 64 kwargs (Any) – Returns List of ids from adding...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-196
search_params (Optional[common_types.SearchParams]) – Additional search params offset (int) – Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues. score_threshold (Optional[float]) – Define a minimal score threshold for the result. If defined, le...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-197
’quorum’ - query the majority of replicas, return values present inall of them ’all’ - query all replicas, and return values present in all replicas kwargs (Any) – Returns List of Documents most similar to the query. Return type List[Document] similarity_search_with_score(query, k=4, filter=None, search_params=None, o...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-198
May be used to paginate results. Note: large offset values may cause performance issues. score_threshold (Optional[float]) – Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-199
kwargs (Any) – Returns List of documents most similar to the query text and cosine distance in float for each. Lower score represents more similarity. Return type List[Tuple[Document, float]] similarity_search_by_vector(embedding, k=4, filter=None, search_params=None, offset=0, score_threshold=None, consistency=None, ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-200
score_threshold (Optional[float]) – Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-201
Return type List[Document] similarity_search_with_score_by_vector(embedding, k=4, filter=None, search_params=None, offset=0, score_threshold=None, consistency=None, **kwargs)[source] Return docs most similar to embedding vector. Parameters embedding (List[float]) – Embedding vector to look up documents similar to. k (...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-202
threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. consistency (Optional[common_types.ReadConsistency]) – Read consistency of the search. Defines how many replicas should be queried before returning the result. Values: - int - number of replicas to query, ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-203
List[Tuple[Document, float]] max_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters query (str) – Text to look up ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-204
Return type List[langchain.schema.Document] classmethod from_texts(texts, embedding, metadatas=None, ids=None, location=None, url=None, port=6333, grpc_port=6334, prefer_grpc=False, https=None, api_key=None, prefix=None, timeout=None, host=None, path=None, collection_name=None, distance_func='Cosine', content_payload_k...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-205
metadatas (Optional[List[dict]]) – An optional list of metadata. If provided it has to be of the same length as a list of texts. ids (Optional[Sequence[str]]) – Optional list of ids to associate with the texts. Ids have to be uuid-like strings. location (Optional[str]) – If :memory: - use in-memory Qdrant instance. If ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-206
Default: False https (Optional[bool]) – If true - use HTTPS(SSL) protocol. Default: None api_key (Optional[str]) – API key for authentication in Qdrant Cloud. Default: None prefix (Optional[str]) – If not None - add prefix to the REST URL path. Example: service/v1 will result in http://localhost:6333/service/v1/{qdrant...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-207
Default: None collection_name (Optional[str]) – Name of the Qdrant collection to be used. If not provided, it will be created randomly. Default: None distance_func (str) – Distance function. One of: β€œCosine” / β€œEuclid” / β€œDot”. Default: β€œCosine” content_payload_key (str) – A payload key used to store the content of the...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-208
Defines how many copies of each shard will be created. Have effect only in distributed mode. write_consistency_factor (Optional[int]) – Write consistency factor for collection. Default is 1, minimum is 1. Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-209
indexed - remain in RAM. hnsw_config (Optional[common_types.HnswConfigDiff]) – Params for HNSW index optimizers_config (Optional[common_types.OptimizersConfigDiff]) – Params for optimizer wal_config (Optional[common_types.WalConfigDiff]) – Params for Write-Ahead-Log quantization_config (Optional[common_types.Quantizati...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-210
Adds the text embeddings to the Qdrant database 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") class langchain.vectorstores.Redis(redis_ur...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-211
vectorstore = Redis( redis_url="redis://username:password@localhost:6379" index_name="my-index", embedding_function=embeddings.embed_query, ) Parameters redis_url (str) – index_name (str) – embedding_function (Callable) – content_key (str) – metadata_key (str) – vector_key (str) – relevance_score_fn (...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-212
Defaults to None. embeddings (Optional[List[List[float]]], optional) – Optional pre-generated embeddings. Defaults to None. keys (List[str]) or ids (List[str]) – Identifiers of entries. Defaults to None. batch_size (int, optional) – Batch size to use for writes. Defaults to 1000. kwargs (Any) – Returns List of ids add...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-213
Return type List[Document] similarity_search_limit_score(query, k=4, score_threshold=0.2, **kwargs)[source] 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 re...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-214
Return type List[Document] Parameters query (str) – k (int) – score_threshold (float) – kwargs (Any) – Note If there are no documents that satisfy the score_threshold value, an empty list is returned. similarity_search_with_score(query, k=4)[source] Return docs most similar to query. Parameters query (str) – Text ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-215
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. Returns the keys of the newly created documents. This is intended to be a quick way to get started. .. rubric:: E...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-216
classmethod from_texts(texts, embedding, metadatas=None, index_name=None, content_key='content', metadata_key='metadata', vector_key='content_vector', **kwargs)[source] Create a Redis vectorstore from raw documents. This is a user-friendly interface that: Embeds documents. Creates a new index for the embeddings in Red...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-217
Return type langchain.vectorstores.redis.Redis static delete(ids, **kwargs)[source] Delete a Redis entry. Parameters ids (List[str]) – List of ids (keys) to delete. kwargs (Any) – Returns Whether or not the deletions were successful. Return type bool static drop_index(index_name, delete_documents, **kwargs)[source] ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-218
Connect to an existing Redis index. Parameters embedding (langchain.embeddings.base.Embeddings) – index_name (str) – content_key (str) – metadata_key (str) – vector_key (str) – kwargs (Any) – Return type langchain.vectorstores.redis.Redis as_retriever(**kwargs)[source] Parameters kwargs (Any) – Return type lang...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-219
You must also ensure you use a Rockset ingest transformation to apply VECTOR_ENFORCE on the column being used to store embedding_key in the collection. See: https://rockset.com/blog/introducing-vector-search-on-rockset/ for more details Everything below assumes commons Rockset workspace. TODO: Add support for workspace...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-220
Parameters client (Any) – embeddings (Embeddings) – collection_name (str) – text_key (str) – embedding_key (str) – add_texts(texts, metadatas=None, ids=None, batch_size=32, **kwargs)[source] Run more texts through the embeddings and add to the vectorstore Args: texts: Iterable of strings to add to the vectorstore...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-221
kwargs (Any) – Return type List[str] classmethod from_texts(texts, embedding, metadatas=None, client=None, collection_name='', text_key='', embedding_key='', ids=None, batch_size=32, **kwargs)[source] Create Rockset wrapper with existing texts. This is intended as a quicker way to get started. Parameters texts (List[...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-222
class DistanceFunction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source] Bases: enum.Enum COSINE_SIM = 'COSINE_SIM' EUCLIDEAN_DIST = 'EUCLIDEAN_DIST' DOT_PRODUCT = 'DOT_PRODUCT' order_by()[source] Return type str similarity_search_with_relevance_scores(query, k=4, distanc...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-223
where_str (Optional[str], optional) – Metadata filters supplied as a SQL where condition string. Defaults to None. eg. β€œprice<=70.0 AND brand=’Nintendo’” NOTE – Please do not let end-user to fill this and always be aware of SQL injection. kwargs (Any) – Returns List of documents with their relevance score Return type ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-224
Return type List[Document] similarity_search_by_vector(embedding, k=4, distance_func=DistanceFunction.COSINE_SIM, where_str=None, **kwargs)[source] Accepts a query_embedding (vector), and returns documents with similar embeddings. Parameters embedding (List[float]) – k (int) – distance_func (DistanceFunction) – whe...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-225
distance_func (DistanceFunction) – where_str (Optional[str]) – kwargs (Any) – Return type List[Tuple[Document, float]] delete_texts(ids)[source] Delete a list of docs from the Rockset collection Parameters ids (List[str]) – Return type None class langchain.vectorstores.SKLearnVectorStore(embedding, *, persist_path...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-226
Return type None persist()[source] Return type None add_texts(texts, metadatas=None, ids=None, **kwargs)[source] Run more texts through the embeddings and add to the vectorstore. Parameters texts (Iterable[str]) – Iterable of strings to add to the vectorstore. metadatas (Optional[List[dict]]) – Optional list of metad...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-227
similarity_search(query, k=4, **kwargs)[source] Return docs most similar to query. Parameters query (str) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] max_marginal_relevance_search_by_vector(embedding, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maxi...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-228
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. Parameters embedding (List[float]) – k (int) – fetch_k (int) – lambda_mult (float) – kwargs (Any) – Return type List[langchain.sche...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-229
:param 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. Parameters query (str) – k (int) – fetch_k (int) – lambda_mult ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-230
persist_path (Optional[str]) – kwargs (Any) – Return type langchain.vectorstores.sklearn.SKLearnVectorStore class langchain.vectorstores.StarRocks(embedding, config=None, **kwargs)[source] Bases: langchain.vectorstores.base.VectorStore Wrapper around StarRocks vector database You need a pymysql python package, and a...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-231
kwargs (Any) – Return type None escape_str(value)[source] Parameters value (str) – Return type str add_texts(texts, metadatas=None, batch_size=32, ids=None, **kwargs)[source] Insert more texts through the embeddings and add to the VectorStore. Parameters texts (Iterable[str]) – Iterable of strings to add to the Vec...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-232
Return type List[str] classmethod from_texts(texts, embedding, metadatas=None, config=None, text_ids=None, batch_size=32, **kwargs)[source] Create StarRocks wrapper with existing texts Parameters embedding_function (Embeddings) – Function to extract text embedding texts (Iterable[str]) – List or tuple of strings to be...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-233
kwargs (Any) – Returns StarRocks Index Return type langchain.vectorstores.starrocks.StarRocks similarity_search(query, k=4, where_str=None, **kwargs)[source] Perform a similarity search with StarRocks Parameters query (str) – query string k (int, optional) – Top K neighbors to retrieve. Defaults to 4. where_str (Opti...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-234
Return type List[Document] similarity_search_by_vector(embedding, k=4, where_str=None, **kwargs)[source] Perform a similarity search with StarRocks by vectors Parameters query (str) – query string k (int, optional) – Top K neighbors to retrieve. Defaults to 4. where_str (Optional[str], optional) – where condition stri...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-235
Return type List[Document] similarity_search_with_relevance_scores(query, k=4, where_str=None, **kwargs)[source] Perform a similarity search with StarRocks Parameters query (str) – query string k (int, optional) – Top K neighbors to retrieve. Defaults to 4. where_str (Optional[str], optional) – where condition string....
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-236
None property metadata_column: str class langchain.vectorstores.SupabaseVectorStore(client, embedding, table_name, query_name=None)[source] Bases: langchain.vectorstores.base.VectorStore VectorStore for a Supabase postgres database. Assumes you have the pgvector extension installed and a match_documents (or similar) ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-237
embedding (Embeddings) – table_name (str) – query_name (Union[str, None]) – Return type None table_name: str query_name: str add_texts(texts, metadatas=None, ids=None, **kwargs)[source] Run more texts through the embeddings and add to the vectorstore. Parameters texts (Iterable[str]) – Iterable of strings to add ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-238
Return type List[str] classmethod from_texts(texts, embedding, metadatas=None, client=None, table_name='documents', query_name='match_documents', ids=None, **kwargs)[source] Return VectorStore initialized from texts and embeddings. Parameters texts (List[str]) – embedding (Embeddings) – metadatas (Optional[List[dict...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-239
Return type List[str] similarity_search(query, k=4, **kwargs)[source] Return docs most similar to query. Parameters query (str) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] similarity_search_by_vector(embedding, k=4, **kwargs)[source] Return docs most similar to embedding vector. Paramete...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-240
0 is dissimilar, 1 is most similar. Parameters query (str) – input text k (int) – Number of Documents to return. Defaults to 4. **kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 to filter the resulting set of retrieved docs kwargs (Any)...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-241
k (int) – Return type List[Tuple[langchain.schema.Document, float, numpy.ndarray[numpy.float32, Any]]] max_marginal_relevance_search_by_vector(embedding, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity t...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-242
Defaults to 0.5. kwargs (Any) – Returns List of Documents selected by maximal marginal relevance. Return type List[langchain.schema.Document] max_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maximal marginal relevance. Maximal marginal relevance o...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-243
Defaults to 0.5. kwargs (Any) – Returns List of Documents selected by maximal marginal relevance. Return type List[langchain.schema.Document] max_marginal_relevance_search requires that query_name returns matched embeddings alongside the match documents. The following function demonstrates how to do this: ```sql CREAT...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-244
``` delete(ids)[source] Delete by vector IDs. Parameters ids (List[str]) – List of ids to delete. Return type None class langchain.vectorstores.Tair(embedding_function, url, index_name, content_key='content', metadata_key='metadata', search_params=None, **kwargs)[source] Bases: langchain.vectorstores.base.VectorStore...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-245
distance_type (str) – index_type (str) – data_type (str) – kwargs (Any) – Return type bool add_texts(texts, metadatas=None, **kwargs)[source] Add texts data to an existing index. Parameters texts (Iterable[str]) – metadatas (Optional[List[dict]]) – kwargs (Any) – Return type List[str] similarity_search(query, k...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-246
Return type List[Document] classmethod from_texts(texts, embedding, metadatas=None, index_name='langchain', content_key='content', metadata_key='metadata', **kwargs)[source] Return VectorStore initialized from texts and embeddings. Parameters texts (List[str]) – embedding (langchain.embeddings.base.Embeddings) – met...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-247
embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) – index_name (str) – content_key (str) – metadata_key (str) – kwargs (Any) – Return type langchain.vectorstores.tair.Tair static drop_index(index_name='langchain', **kwargs)[source] Drop an existing index. Parameters index_name (...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-248
index_name (str) – content_key (str) – metadata_key (str) – kwargs (Any) – Return type langchain.vectorstores.tair.Tair class langchain.vectorstores.Tigris(client, embeddings, index_name)[source] Bases: langchain.vectorstores.base.VectorStore Parameters client (TigrisClient) – embeddings (Embeddings) – index_nam...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-249
ids (Optional[List[str]]) – Optional list of ids for documents. Ids will be autogenerated if not provided. kwargs (Any) – vectorstore specific parameters Returns List of ids from adding the texts into the vectorstore. Return type List[str] similarity_search(query, k=4, filter=None, **kwargs)[source] Return docs most s...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-250
filter (Optional[TigrisFilter]) – Filter by metadata. Defaults to None. Returns List of documents most similar to the querytext with distance in float. Return type List[Tuple[Document, float]] classmethod from_texts(texts, embedding, metadatas=None, ids=None, client=None, index_name=None, **kwargs)[source] Return Vect...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-251
Bases: langchain.vectorstores.base.VectorStore Wrapper around Typesense vector search. To use, you should have the typesense python package installed. Example from langchain.embedding.openai import OpenAIEmbeddings from langchain.vectorstores import Typesense import typesense node = { "host": "localhost", # For Ty...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-252
vectorstore = Typesense( typesense_client=typesense_client, embedding=embedding, typesense_collection_name=typesense_collection_name, text_key="text", ) Parameters typesense_client (Client) – embedding (Embeddings) – typesense_collection_name (Optional[str]) – text_key (str) – add_texts(texts, metad...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-253
Return type List[str] similarity_search_with_score(query, k=10, filter='')[source] Return typesense documents most similar to query, along with scores. Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 10. Minimum 10 results would be returned. filter (O...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-254
Minimum 10 results would be returned. filter (Optional[str]) – typesense filter_by expression to filter documents on kwargs (Any) – Returns List of Documents most similar to the query and score for each Return type List[langchain.schema.Document] classmethod from_client_params(embedding, *, host='localhost', port='810...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-255
) Parameters embedding (langchain.embeddings.base.Embeddings) – host (str) – port (Union[str, int]) – protocol (str) – typesense_api_key (Optional[str]) – connection_timeout_seconds (int) – kwargs (Any) – Return type langchain.vectorstores.typesense.Typesense classmethod from_texts(texts, embedding, metadatas=No...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-256
typesense_collection_name (Optional[str]) – text_key (str) – kwargs (Any) – Return type Typesense class langchain.vectorstores.Vectara(vectara_customer_id=None, vectara_corpus_id=None, vectara_api_key=None)[source] Bases: langchain.vectorstores.base.VectorStore Implementation of Vector Store using Vectara (https://...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-257
add_texts(texts, metadatas=None, **kwargs)[source] Run more texts through the embeddings and add to the vectorstore. Parameters texts (Iterable[str]) – Iterable of strings to add to the vectorstore. metadatas (Optional[List[dict]]) – Optional list of metadatas associated with the texts. kwargs (Any) – Returns List of...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-258
filter (Optional[str]) – 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.vectara.com/docs/search-apis/sql/filter-overview for more details. n_sentence_context (int) – number of sentences before/after the matching segment to add kwar...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-259
k (int) – Number of Documents to return. Defaults to 5. filter (Optional[str]) – 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.vectara.com/docs/search-apis/sql/filter-overview for more details. n_sentence_context (int) – number of...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-260
from langchain import Vectara vectara = Vectara.from_texts( texts, vectara_customer_id=customer_id, vectara_corpus_id=corpus_id, vectara_api_key=api_key, ) Parameters texts (List[str]) – embedding (Optional[langchain.embeddings.base.Embeddings]) – metadatas (Optional[List[dict]]) – kwargs (Any) – Re...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-261
Run more texts through the embeddings and add to the vectorstore. Parameters texts (Iterable[str]) – Iterable of strings to add to the vectorstore. metadatas (Optional[List[dict]]) – Optional list of metadatas associated with the texts. kwargs (Any) – vectorstore specific parameters Returns List of ids from adding the ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-262
kwargs (Any) – Return type List[str] add_documents(documents, **kwargs)[source] Run more documents through the embeddings and add to the vectorstore. Parameters (List[Document] (documents) – Documents to add to the vectorstore. documents (List[langchain.schema.Document]) – kwargs (Any) – Returns List of IDs of the ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-263
Return docs most similar to query using specified search type. Parameters query (str) – search_type (str) – kwargs (Any) – Return type List[langchain.schema.Document] async asearch(query, search_type, **kwargs)[source] Return docs most similar to query using specified search type. Parameters query (str) – search_t...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-264
Return docs and relevance scores in the range [0, 1]. 0 is dissimilar, 1 is most similar. Parameters query (str) – input text k (int) – Number of Documents to return. Defaults to 4. **kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 to f...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-265
async asimilarity_search(query, k=4, **kwargs)[source] Return docs most similar to query. Parameters query (str) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] similarity_search_by_vector(embedding, k=4, **kwargs)[source] Return docs most similar to embedding vector. Parameters embedding (L...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-266
Parameters embedding (List[float]) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] max_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query A...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-267
Defaults to 0.5. kwargs (Any) – Returns List of Documents selected by maximal marginal relevance. Return type List[langchain.schema.Document] async amax_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, **kwargs)[source] Return docs selected using the maximal marginal relevance. Parameters query (str...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-268
among selected documents. Parameters embedding (List[float]) – Embedding to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. fetch_k (int) – Number of Documents to fetch to pass to MMR algorithm. lambda_mult (float) – Number between 0 and 1 that determines the degree of diversity am...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-269
Parameters embedding (List[float]) – k (int) – fetch_k (int) – lambda_mult (float) – kwargs (Any) – Return type List[langchain.schema.Document] classmethod from_documents(documents, embedding, **kwargs)[source] Return VectorStore initialized from documents and embeddings. Parameters documents (List[langchain.sche...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-270
langchain.vectorstores.base.VST abstract classmethod from_texts(texts, embedding, metadatas=None, **kwargs)[source] Return VectorStore initialized from texts and embeddings. Parameters texts (List[str]) – embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) – kwargs (Any) – Return ty...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-271
Parameters kwargs (Any) – Return type langchain.vectorstores.base.VectorStoreRetriever class langchain.vectorstores.Weaviate(client, index_name, text_key, embedding=None, attributes=None, relevance_score_fn=<function _default_score_normalizer>, by_text=True)[source] Bases: langchain.vectorstores.base.VectorStore Wrap...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-272
attributes (Optional[List[str]]) – relevance_score_fn (Optional[Callable[[float], float]]) – by_text (bool) – add_texts(texts, metadatas=None, **kwargs)[source] Upload texts with metadata (properties) to Weaviate. Parameters texts (Iterable[str]) – metadatas (Optional[List[dict]]) – kwargs (Any) – Return type Li...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-273
List[langchain.schema.Document] similarity_search_by_text(query, k=4, **kwargs)[source] Return docs most similar to query. Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. kwargs (Any) – Returns List of Documents most similar to the query. Return t...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-274
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. fetch_k (int) – Number of Documents to fe...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-275
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters embedding (List[float]) – Embedding to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. fetch_k (int) – Number o...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-276
text and cosine distance in float for each. Lower score represents more similarity. Parameters query (str) – k (int) – kwargs (Any) – Return type List[Tuple[langchain.schema.Document, float]] classmethod from_texts(texts, embedding, metadatas=None, **kwargs)[source] Construct Weaviate wrapper from raw documents. Th...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
4a1bad429950-277
texts, embeddings, weaviate_url="http://localhost:8080" ) Parameters texts (List[str]) – embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) – kwargs (Any) – Return type langchain.vectorstores.weaviate.Weaviate delete(ids)[source] Delete by vector IDs. Parameters ids (List[s...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
0e0436a883fe-0
LLMs Wrappers on top of large language models APIs.
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-1
class langchain.llms.AI21(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model='j2-jumbo-instruct', temperature=0.7, maxTokens=256, minTokens=0, topP=1.0, presencePenalty=AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctuations=True, applyToNumbers=True, applyToStopwords=Tru...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-2
numResults=1, logitBias=None, ai21_api_key=None, stop=None, base_url=None)[source]
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-3
Bases: langchain.llms.base.LLM Wrapper around AI21 large language models. To use, you should have the environment variable AI21_API_KEY set with your API key. Example from langchain.llms import AI21 ai21 = AI21(model="j2-jumbo-instruct") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[L...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-4
countPenalty (langchain.llms.ai21.AI21PenaltyData) – frequencyPenalty (langchain.llms.ai21.AI21PenaltyData) – numResults (int) – logitBias (Optional[Dict[str, float]]) – ai21_api_key (Optional[str]) – stop (Optional[List[str]]) – base_url (Optional[str]) – Return type None attribute base_url: Optional[str] = Non...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-5
Penalizes repeated tokens according to count. attribute frequencyPenalty: langchain.llms.ai21.AI21PenaltyData = AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctuations=True, applyToNumbers=True, applyToStopwords=True, applyToEmojis=True) Penalizes repeated tokens according to frequency. attribute logitBi...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-6
attribute presencePenalty: langchain.llms.ai21.AI21PenaltyData = AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctuations=True, applyToNumbers=True, applyToStopwords=True, applyToEmojis=True) Penalizes repeated tokens. attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute tem...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-7
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type str async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameter...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-8
Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) P...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-9
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-10
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwarg...
https://api.python.langchain.com/en/latest/modules/llms.html