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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.