id
stringlengths 14
15
| text
stringlengths 35
2.07k
| embedding
sequence | source
stringlengths 61
154
|
---|---|---|---|
a427a6bad22a-10 | 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[Document][source]¶
Perform a similarity search against the query string.
Parameters
embedding (List[float]) – The embedding vector to search.
k (int, optional) – How many results to return. Defaults to 4.
param (dict, optional) – The search params for the index type.
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.
Returns
Document results for search.
Return type
List[Document]
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶ | [
16851,
198,
7676,
3135,
369,
2778,
627,
5715,
955,
198,
861,
58,
7676,
933,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
1719,
25,
12536,
58,
8644,
60,
284,
2290,
11,
15522,
25,
12536,
17752,
60,
284,
2290,
11,
9829,
25,
12536,
19155,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
48051,
264,
38723,
2778,
2403,
279,
3319,
925,
627,
9905,
198,
95711,
320,
861,
96481,
2526,
1389,
578,
40188,
4724,
311,
2778,
627,
74,
320,
396,
11,
10309,
8,
1389,
2650,
1690,
3135,
311,
471,
13,
37090,
311,
220,
19,
627,
913,
320,
8644,
11,
10309,
8,
1389,
578,
2778,
3712,
369,
279,
1963,
955,
627,
16672,
311,
2290,
627,
9600,
320,
496,
11,
10309,
8,
1389,
82631,
7645,
13,
37090,
311,
2290,
627,
14482,
320,
396,
11,
10309,
8,
1389,
2650,
1317,
311,
3868,
1603,
9829,
1493,
627,
16672,
311,
2290,
627,
9872,
1389,
11348,
9472,
368,
16570,
6105,
627,
16851,
198,
7676,
3135,
369,
2778,
627,
5715,
955,
198,
861,
58,
7676,
933,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
1719,
25,
12536,
58,
8644,
60,
284,
2290,
11,
15522,
25,
12536,
17752,
60,
284,
2290,
11,
9829,
25,
12536,
19155,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.milvus.Milvus.html |
a427a6bad22a-11 | Perform a search on a query string and return results with score.
For more information about the search parameters, take a look at the pymilvus
documentation found here:
https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Parameters
query (str) – The text being searched.
k (int, optional) – The amount of results ot return. Defaults to 4.
param (dict) – The search params for the specified index.
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: List[float], k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Perform a search on a query string and return results with score.
For more information about the search parameters, take a look at the pymilvus
documentation found here:
https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Parameters
embedding (List[float]) – The embedding vector being searched.
k (int, optional) – The amount of results ot return. Defaults to 4.
param (dict) – The search params for the specified index.
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. | [
48051,
264,
2778,
389,
264,
3319,
925,
323,
471,
3135,
449,
5573,
627,
2520,
810,
2038,
922,
279,
2778,
5137,
11,
1935,
264,
1427,
520,
279,
46860,
321,
85,
355,
198,
77403,
1766,
1618,
512,
2485,
1129,
73370,
85,
355,
4340,
10729,
73723,
4420,
1631,
321,
85,
355,
5574,
17,
13,
17,
13,
21,
14,
6618,
24042,
1020,
2329,
198,
9905,
198,
1663,
320,
496,
8,
1389,
578,
1495,
1694,
27600,
627,
74,
320,
396,
11,
10309,
8,
1389,
578,
3392,
315,
3135,
14479,
471,
13,
37090,
311,
220,
19,
627,
913,
320,
8644,
8,
1389,
578,
2778,
3712,
369,
279,
5300,
1963,
627,
16672,
311,
2290,
627,
9600,
320,
496,
11,
10309,
8,
1389,
82631,
7645,
13,
37090,
311,
2290,
627,
14482,
320,
396,
11,
10309,
8,
1389,
2650,
1317,
311,
3868,
1603,
9829,
1493,
627,
16672,
311,
2290,
627,
9872,
1389,
11348,
9472,
368,
16570,
6105,
627,
5715,
955,
198,
861,
96481,
1145,
1796,
20961,
6189,
58,
7676,
11,
904,
11,
904,
14623,
15124,
49325,
10947,
6753,
10622,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
1719,
25,
12536,
58,
8644,
60,
284,
2290,
11,
15522,
25,
12536,
17752,
60,
284,
2290,
11,
9829,
25,
12536,
19155,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
48051,
264,
2778,
389,
264,
3319,
925,
323,
471,
3135,
449,
5573,
627,
2520,
810,
2038,
922,
279,
2778,
5137,
11,
1935,
264,
1427,
520,
279,
46860,
321,
85,
355,
198,
77403,
1766,
1618,
512,
2485,
1129,
73370,
85,
355,
4340,
10729,
73723,
4420,
1631,
321,
85,
355,
5574,
17,
13,
17,
13,
21,
14,
6618,
24042,
1020,
2329,
198,
9905,
198,
95711,
320,
861,
96481,
2526,
1389,
578,
40188,
4724,
1694,
27600,
627,
74,
320,
396,
11,
10309,
8,
1389,
578,
3392,
315,
3135,
14479,
471,
13,
37090,
311,
220,
19,
627,
913,
320,
8644,
8,
1389,
578,
2778,
3712,
369,
279,
5300,
1963,
627,
16672,
311,
2290,
627,
9600,
320,
496,
11,
10309,
8,
1389,
82631,
7645,
13,
37090,
311,
2290,
627,
14482,
320,
396,
11,
10309,
8,
1389,
2650,
1317,
311,
3868,
1603,
9829,
1493,
627,
16672,
311,
2290,
627,
9872,
1389,
11348,
9472,
368,
16570,
6105,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.milvus.Milvus.html |
a427a6bad22a-12 | Defaults to None.
kwargs – Collection.search() keyword arguments.
Returns
Result doc and score.
Return type
List[Tuple[Document, float]] | [
16672,
311,
2290,
627,
9872,
1389,
11348,
9472,
368,
16570,
6105,
627,
16851,
198,
2122,
4733,
323,
5573,
627,
5715,
955,
198,
861,
20961,
6189,
58,
7676,
11,
2273,
5163
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.milvus.Milvus.html |
72a1837327f1-0 | langchain.vectorstores.qdrant.Qdrant¶
class langchain.vectorstores.qdrant.Qdrant(client: Any, collection_name: str, embeddings: Optional[Embeddings] = None, content_payload_key: str = 'page_content', metadata_payload_key: str = 'metadata', vector_name: Optional[str] = None, embedding_function: Optional[Callable] = None)[source]¶
Bases: VectorStore
Wrapper around Qdrant vector database.
To use you should have the qdrant-client package installed.
Example
from qdrant_client import QdrantClient
from langchain import Qdrant
client = QdrantClient()
collection_name = "MyCollection"
qdrant = Qdrant(client, collection_name, embedding_function)
Initialize with necessary components.
Methods
__init__(client, collection_name[, ...])
Initialize with necessary components.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids, batch_size])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance. | [
5317,
8995,
48203,
44569,
11608,
3696,
519,
10208,
3696,
519,
55609,
198,
1058,
8859,
8995,
48203,
44569,
11608,
3696,
519,
10208,
3696,
519,
13097,
25,
5884,
11,
4526,
1292,
25,
610,
11,
71647,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
2262,
33913,
3173,
25,
610,
284,
364,
2964,
7647,
518,
11408,
33913,
3173,
25,
610,
284,
364,
18103,
518,
4724,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
40188,
9353,
25,
12536,
58,
41510,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
1229,
3696,
519,
4724,
4729,
627,
1271,
1005,
499,
1288,
617,
279,
2874,
3696,
519,
31111,
6462,
10487,
627,
13617,
198,
1527,
2874,
3696,
519,
8342,
1179,
1229,
3696,
519,
3032,
198,
1527,
8859,
8995,
1179,
1229,
3696,
519,
198,
3045,
284,
1229,
3696,
519,
3032,
746,
13727,
1292,
284,
330,
5159,
6618,
702,
80,
3696,
519,
284,
1229,
3696,
519,
13097,
11,
4526,
1292,
11,
40188,
9353,
340,
10130,
449,
5995,
6956,
627,
18337,
198,
565,
2381,
3889,
3045,
11,
4194,
13727,
1292,
38372,
4194,
1131,
2608,
10130,
449,
5995,
6956,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
11,
4194,
14377,
2424,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-1 | Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Construct Qdrant wrapper from a list of texts.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter, ...])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k, ...])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, ...])
Return docs most similar to query.
similarity_search_with_score_by_vector(embedding)
Return docs most similar to embedding vector.
Attributes
CONTENT_KEY
METADATA_KEY
VECTOR_NAME
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
29568,
1229,
3696,
519,
13564,
505,
264,
1160,
315,
22755,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
11,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
6753,
10622,
3795,
12526,
50825,
7113,
340,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
10738,
198,
68972,
6738,
198,
45975,
40219,
6738,
198,
44787,
4813,
198,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-2 | Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[Sequence[str]] = None, batch_size: int = 64, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts. Ids have to be
uuid-like strings.
batch_size – How many vectors upload per-request.
Default: 64
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶ | [
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
1227,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
13,
5336,
82,
617,
311,
387,
198,
17566,
12970,
9246,
627,
14377,
2424,
1389,
2650,
1690,
23728,
8298,
824,
45908,
627,
3760,
25,
220,
1227,
198,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-3 | 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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings. | [
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-4 | Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[Sequence[str]] = None, location: Optional[str] = None, url: Optional[str] = None, port: Optional[int] = 6333, grpc_port: int = 6334, prefer_grpc: bool = False, https: Optional[bool] = None, api_key: Optional[str] = None, prefix: Optional[str] = None, timeout: Optional[float] = None, host: Optional[str] = None, path: Optional[str] = None, collection_name: Optional[str] = None, distance_func: str = 'Cosine', content_payload_key: str = 'page_content', metadata_payload_key: str = 'metadata', vector_name: Optional[str] = None, batch_size: int = 64, shard_number: Optional[int] = None, replication_factor: Optional[int] = None, write_consistency_factor: Optional[int] = None, on_disk_payload: Optional[bool] = None, hnsw_config: Optional[common_types.HnswConfigDiff] = None, optimizers_config: Optional[common_types.OptimizersConfigDiff] = None, wal_config: Optional[common_types.WalConfigDiff] = None, quantization_config: Optional[common_types.QuantizationConfig] = None, init_from: Optional[common_types.InitFrom] = None, **kwargs: Any) → Qdrant[source]¶
Construct Qdrant wrapper from a list of texts.
Parameters
texts – A list of texts to be indexed in Qdrant.
embedding – A subclass of Embeddings, responsible for text vectorization.
metadatas – An optional list of metadata. If provided it has to be of the same
length as a list of texts. | [
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3813,
25,
12536,
17752,
60,
284,
2290,
11,
2576,
25,
12536,
17752,
60,
284,
2290,
11,
2700,
25,
12536,
19155,
60,
284,
220,
23736,
18,
11,
49000,
8889,
25,
528,
284,
220,
23736,
19,
11,
10932,
16057,
4080,
25,
1845,
284,
3641,
11,
3788,
25,
12536,
58,
2707,
60,
284,
2290,
11,
6464,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
9436,
25,
12536,
17752,
60,
284,
2290,
11,
9829,
25,
12536,
96481,
60,
284,
2290,
11,
3552,
25,
12536,
17752,
60,
284,
2290,
11,
1853,
25,
12536,
17752,
60,
284,
2290,
11,
4526,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
6138,
9791,
25,
610,
284,
364,
55324,
483,
518,
2262,
33913,
3173,
25,
610,
284,
364,
2964,
7647,
518,
11408,
33913,
3173,
25,
610,
284,
364,
18103,
518,
4724,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
1227,
11,
53169,
5617,
25,
12536,
19155,
60,
284,
2290,
11,
48891,
19100,
25,
12536,
19155,
60,
284,
2290,
11,
3350,
33071,
48194,
19100,
25,
12536,
19155,
60,
284,
2290,
11,
389,
42787,
33913,
25,
12536,
58,
2707,
60,
284,
2290,
11,
96338,
2332,
5445,
25,
12536,
58,
5581,
9962,
3924,
77,
2332,
2714,
22499,
60,
284,
2290,
11,
7706,
12509,
5445,
25,
12536,
58,
5581,
9962,
8548,
418,
318,
12509,
2714,
22499,
60,
284,
2290,
11,
41926,
5445,
25,
12536,
58,
5581,
9962,
1196,
278,
2714,
22499,
60,
284,
2290,
11,
10484,
2065,
5445,
25,
12536,
58,
5581,
9962,
35007,
519,
2065,
2714,
60,
284,
2290,
11,
3003,
5791,
25,
12536,
58,
5581,
9962,
27947,
3915,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1229,
3696,
519,
76747,
60,
55609,
198,
29568,
1229,
3696,
519,
13564,
505,
264,
1160,
315,
22755,
627,
9905,
198,
87042,
1389,
362,
1160,
315,
22755,
311,
387,
31681,
304,
1229,
3696,
519,
627,
95711,
1389,
362,
38290,
315,
38168,
25624,
11,
8647,
369,
1495,
4724,
2065,
627,
4150,
329,
19907,
1389,
1556,
10309,
1160,
315,
11408,
13,
1442,
3984,
433,
706,
311,
387,
315,
279,
1890,
198,
4222,
439,
264,
1160,
315,
22755,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-5 | length as a list of texts.
ids – Optional list of ids to associate with the texts. Ids have to be
uuid-like strings.
location – If :memory: - use in-memory Qdrant instance.
If str - use it as a url parameter.
If None - fallback to relying on host and port parameters.
url – either host or str of “Optional[scheme], host, Optional[port],
Optional[prefix]”. Default: None
port – Port of the REST API interface. Default: 6333
grpc_port – Port of the gRPC interface. Default: 6334
prefer_grpc – If 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: None
prefix – If not None - add prefix to the REST URL path.
Example: service/v1 will result in
http://localhost:6333/service/v1/{qdrant-endpoint} for REST API.
Default: None
timeout – Timeout for REST and gRPC API requests.
Default: 5.0 seconds for REST and unlimited for gRPC
host – Host name of Qdrant service. If url and host are None, set to
‘localhost’. Default: None
path – Path in which the vectors will be stored while using local mode.
Default: None
collection_name – Name of the Qdrant collection to be used. If not provided,
it will be created randomly. Default: None
distance_func – Distance function. One of: “Cosine” / “Euclid” / “Dot”.
Default: “Cosine”
content_payload_key – A payload key used to store the content of the document.
Default: “page_content” | [
4222,
439,
264,
1160,
315,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
13,
5336,
82,
617,
311,
387,
198,
17566,
12970,
9246,
627,
2588,
1389,
1442,
551,
17717,
25,
482,
1005,
304,
65196,
1229,
3696,
519,
2937,
627,
2746,
610,
482,
1005,
433,
439,
264,
2576,
5852,
627,
2746,
2290,
482,
33872,
311,
39661,
389,
3552,
323,
2700,
5137,
627,
1103,
1389,
3060,
3552,
477,
610,
315,
1054,
15669,
12144,
8218,
1145,
3552,
11,
12536,
97585,
1282,
15669,
11661,
5170,
60,
11453,
8058,
25,
2290,
198,
403,
1389,
5896,
315,
279,
26487,
5446,
3834,
13,
8058,
25,
220,
23736,
18,
198,
57685,
8889,
1389,
5896,
315,
279,
342,
30628,
3834,
13,
8058,
25,
220,
23736,
19,
198,
81160,
16057,
4080,
1389,
1442,
837,
482,
1005,
342,
6616,
34,
3834,
15716,
3284,
304,
2587,
5528,
627,
3760,
25,
3641,
198,
2485,
1389,
1442,
837,
482,
1005,
62144,
7,
23416,
8,
11766,
13,
8058,
25,
2290,
198,
2113,
3173,
1389,
5446,
1401,
369,
17066,
304,
1229,
3696,
519,
15161,
13,
8058,
25,
2290,
198,
12113,
1389,
1442,
539,
2290,
482,
923,
9436,
311,
279,
26487,
5665,
1853,
627,
13617,
25,
2532,
5574,
16,
690,
1121,
304,
198,
1277,
1129,
8465,
25,
23736,
18,
35286,
5574,
16,
9573,
80,
3696,
519,
13368,
2837,
92,
369,
26487,
5446,
627,
3760,
25,
2290,
198,
14482,
1389,
40480,
369,
26487,
323,
342,
30628,
5446,
7540,
627,
3760,
25,
220,
20,
13,
15,
6622,
369,
26487,
323,
27862,
369,
342,
30628,
198,
3875,
1389,
16492,
836,
315,
1229,
3696,
519,
2532,
13,
1442,
2576,
323,
3552,
527,
2290,
11,
743,
311,
198,
14336,
8465,
24535,
8058,
25,
2290,
198,
2398,
1389,
8092,
304,
902,
279,
23728,
690,
387,
9967,
1418,
1701,
2254,
3941,
627,
3760,
25,
2290,
198,
13727,
1292,
1389,
4076,
315,
279,
1229,
3696,
519,
4526,
311,
387,
1511,
13,
1442,
539,
3984,
345,
275,
690,
387,
3549,
27716,
13,
8058,
25,
2290,
198,
19909,
9791,
1389,
32235,
734,
13,
3861,
315,
25,
1054,
55324,
483,
863,
611,
1054,
55218,
76144,
863,
611,
1054,
35307,
863,
627,
3760,
25,
1054,
55324,
483,
89874,
1834,
33913,
3173,
1389,
362,
7885,
1401,
1511,
311,
3637,
279,
2262,
315,
279,
2246,
627,
3760,
25,
1054,
2964,
7647,
863
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-6 | Default: “page_content”
metadata_payload_key – A payload key used to store the metadata of the document.
Default: “metadata”
vector_name – Name of the vector to be used internally in Qdrant.
Default: None
batch_size – How many vectors upload per-request.
Default: 64
shard_number – Number of shards in collection. Default is 1, minimum is 1.
replication_factor – Replication factor for collection. Default is 1, minimum is 1.
Defines how many copies of each shard will be created.
Have effect only in distributed mode.
write_consistency_factor – 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 make the collection more
resilient to inconsistencies, but will also make it fail if not enough
replicas are available.
Does not have any performance impact.
Have effect only in distributed mode.
on_disk_payload – If true - point`s payload will not be stored in memory.
It will be read from the disk every time it is requested.
This setting saves RAM by (slightly) increasing the response time.
Note: those payload values that are involved in filtering and are
indexed - remain in RAM.
hnsw_config – Params for HNSW index
optimizers_config – Params for optimizer
wal_config – Params for Write-Ahead-Log
quantization_config – Params for quantization, if None - quantization will be disabled
init_from – Use data stored in another collection to initialize this collection
**kwargs – Additional arguments passed directly into REST client initialization
This is a user-friendly interface that:
1. Creates embeddings, one for each text
2. Initializes the Qdrant database as an in-memory docstore by default | [
3760,
25,
1054,
2964,
7647,
89874,
18103,
33913,
3173,
1389,
362,
7885,
1401,
1511,
311,
3637,
279,
11408,
315,
279,
2246,
627,
3760,
25,
1054,
18103,
89874,
3295,
1292,
1389,
4076,
315,
279,
4724,
311,
387,
1511,
34167,
304,
1229,
3696,
519,
627,
3760,
25,
2290,
198,
14377,
2424,
1389,
2650,
1690,
23728,
8298,
824,
45908,
627,
3760,
25,
220,
1227,
198,
939,
569,
5617,
1389,
5742,
315,
75210,
304,
4526,
13,
8058,
374,
220,
16,
11,
8187,
374,
220,
16,
627,
10200,
1728,
19100,
1389,
3402,
1728,
8331,
369,
4526,
13,
8058,
374,
220,
16,
11,
8187,
374,
220,
16,
627,
74916,
1268,
1690,
11236,
315,
1855,
53169,
690,
387,
3549,
627,
12389,
2515,
1193,
304,
4332,
3941,
627,
5040,
33071,
48194,
19100,
1389,
9842,
29237,
8331,
369,
4526,
13,
8058,
374,
220,
16,
11,
8187,
374,
220,
16,
627,
74916,
1268,
1690,
81901,
1288,
3881,
279,
5784,
369,
603,
311,
2980,
198,
275,
6992,
13,
74540,
420,
1396,
690,
1304,
279,
4526,
810,
198,
417,
321,
1188,
311,
92922,
11,
719,
690,
1101,
1304,
433,
3775,
422,
539,
3403,
198,
10200,
53310,
527,
2561,
627,
22186,
539,
617,
904,
5178,
5536,
627,
12389,
2515,
1193,
304,
4332,
3941,
627,
263,
42787,
33913,
1389,
1442,
837,
482,
1486,
40929,
7885,
690,
539,
387,
9967,
304,
5044,
627,
2181,
690,
387,
1373,
505,
279,
13668,
1475,
892,
433,
374,
11472,
627,
2028,
6376,
27024,
22813,
555,
320,
3306,
73048,
8,
7859,
279,
2077,
892,
627,
9290,
25,
1884,
7885,
2819,
430,
527,
6532,
304,
30770,
323,
527,
198,
98573,
482,
7293,
304,
22813,
627,
25105,
2332,
5445,
1389,
35452,
369,
473,
2507,
54,
1963,
198,
19680,
12509,
5445,
1389,
35452,
369,
26714,
198,
27495,
5445,
1389,
35452,
369,
9842,
6830,
2025,
12,
2250,
198,
31548,
2065,
5445,
1389,
35452,
369,
10484,
2065,
11,
422,
2290,
482,
10484,
2065,
690,
387,
8552,
198,
2381,
5791,
1389,
5560,
828,
9967,
304,
2500,
4526,
311,
9656,
420,
4526,
198,
334,
9872,
1389,
24086,
6105,
5946,
6089,
1139,
26487,
3016,
17923,
198,
2028,
374,
264,
1217,
22658,
3834,
430,
512,
16,
13,
15026,
71647,
11,
832,
369,
1855,
1495,
198,
17,
13,
32982,
279,
1229,
3696,
519,
4729,
439,
459,
304,
65196,
4733,
4412,
555,
1670
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-7 | 2. Initializes the Qdrant database as an in-memory docstore by default
(and overridable to a remote docstore)
Adds the text embeddings to the Qdrant database
This is intended to be a quick way to get started.
Example
from langchain import Qdrant
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 = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4. | [
17,
13,
32982,
279,
1229,
3696,
519,
4729,
439,
459,
304,
65196,
4733,
4412,
555,
1670,
198,
61011,
927,
1907,
481,
311,
264,
8870,
4733,
4412,
340,
73211,
279,
1495,
71647,
311,
279,
1229,
3696,
519,
4729,
198,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
13617,
198,
1527,
8859,
8995,
1179,
1229,
3696,
519,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
80,
3696,
519,
284,
1229,
3696,
519,
6521,
80746,
7383,
82,
11,
71647,
11,
330,
8465,
1158,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
16672,
311,
220,
508,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-8 | k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – Filter by metadata. Defaults to None.
search_params – Additional search params
offset – Offset of the first result to return.
May be used to paginate results.
Note: large offset values may cause performance issues.
score_threshold – 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.
consistency – Read consistency of the search. Defines how many replicas should be
queried before returning the result.
Values:
- int - number of replicas to query, values should present in all
queried replicas | [
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
14952,
5750,
60,
284,
2290,
11,
2778,
6887,
25,
12536,
58,
5581,
9962,
33003,
4975,
60,
284,
2290,
11,
4445,
25,
528,
284,
220,
15,
11,
5573,
22616,
25,
12536,
96481,
60,
284,
2290,
11,
29237,
25,
12536,
58,
5581,
9962,
6639,
15577,
48194,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
1874,
6887,
1389,
24086,
2778,
3712,
198,
3255,
1389,
17286,
315,
279,
1176,
1121,
311,
471,
627,
11356,
387,
1511,
311,
83074,
3135,
627,
9290,
25,
3544,
4445,
2819,
1253,
5353,
5178,
4819,
627,
12618,
22616,
1389,
19127,
264,
17832,
5573,
12447,
369,
279,
1121,
627,
2746,
4613,
11,
2753,
4528,
3135,
690,
539,
387,
6052,
627,
10793,
315,
279,
6052,
1121,
2643,
387,
5190,
477,
9333,
1109,
279,
198,
30002,
11911,
389,
279,
32235,
734,
1511,
627,
36,
1326,
13,
369,
76359,
38723,
1193,
5190,
12483,
690,
387,
6052,
627,
6387,
48194,
1389,
4557,
29237,
315,
279,
2778,
13,
38926,
1268,
1690,
81901,
1288,
387,
198,
16339,
1142,
1603,
13758,
279,
1121,
627,
6359,
512,
12,
528,
482,
1396,
315,
81901,
311,
3319,
11,
2819,
1288,
3118,
304,
682,
198,
16339,
1142,
81901
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-9 | - int - number of replicas to query, values should present in all
queried replicas
’majority’ - query all replicas, but return values present in themajority of replicas
’quorum’ - query the majority of replicas, return values present inall of them
’all’ - query all replicas, and return values present in all replicas
Returns
List of Documents most similar to the query.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding vector to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – Filter by metadata. Defaults to None.
search_params – Additional search params
offset – Offset of the first result to return.
May be used to paginate results.
Note: large offset values may cause performance issues.
score_threshold – 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.
consistency – Read consistency of the search. Defines how many replicas should be
queried before returning the result.
Values:
- int - number of replicas to query, values should present in all
queried replicas
’majority’ - query all replicas, but return values present in themajority of replicas | [
12,
528,
482,
1396,
315,
81901,
311,
3319,
11,
2819,
1288,
3118,
304,
682,
198,
16339,
1142,
81901,
198,
4344,
3111,
488,
529,
482,
3319,
682,
81901,
11,
719,
471,
2819,
3118,
304,
1124,
3111,
488,
315,
81901,
198,
529,
447,
34106,
529,
482,
3319,
279,
8857,
315,
81901,
11,
471,
2819,
3118,
304,
543,
315,
1124,
198,
92748,
529,
482,
3319,
682,
81901,
11,
323,
471,
2819,
3118,
304,
682,
81901,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
14952,
5750,
60,
284,
2290,
11,
2778,
6887,
25,
12536,
58,
5581,
9962,
33003,
4975,
60,
284,
2290,
11,
4445,
25,
528,
284,
220,
15,
11,
5573,
22616,
25,
12536,
96481,
60,
284,
2290,
11,
29237,
25,
12536,
58,
5581,
9962,
6639,
15577,
48194,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
4724,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
1874,
6887,
1389,
24086,
2778,
3712,
198,
3255,
1389,
17286,
315,
279,
1176,
1121,
311,
471,
627,
11356,
387,
1511,
311,
83074,
3135,
627,
9290,
25,
3544,
4445,
2819,
1253,
5353,
5178,
4819,
627,
12618,
22616,
1389,
19127,
264,
17832,
5573,
12447,
369,
279,
1121,
627,
2746,
4613,
11,
2753,
4528,
3135,
690,
539,
387,
6052,
627,
10793,
315,
279,
6052,
1121,
2643,
387,
5190,
477,
9333,
1109,
279,
198,
30002,
11911,
389,
279,
32235,
734,
1511,
627,
36,
1326,
13,
369,
76359,
38723,
1193,
5190,
12483,
690,
387,
6052,
627,
6387,
48194,
1389,
4557,
29237,
315,
279,
2778,
13,
38926,
1268,
1690,
81901,
1288,
387,
198,
16339,
1142,
1603,
13758,
279,
1121,
627,
6359,
512,
12,
528,
482,
1396,
315,
81901,
311,
3319,
11,
2819,
1288,
3118,
304,
682,
198,
16339,
1142,
81901,
198,
4344,
3111,
488,
529,
482,
3319,
682,
81901,
11,
719,
471,
2819,
3118,
304,
1124,
3111,
488,
315,
81901
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-10 | ’majority’ - query all replicas, but return values present in themajority of replicas
’quorum’ - query the majority of replicas, return values present inall of them
’all’ - query all replicas, and return values present in all replicas
Returns
List of Documents most similar to the query.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – Filter by metadata. Defaults to None.
search_params – Additional search params
offset – Offset of the first result to return.
May be used to paginate results.
Note: large offset values may cause performance issues.
score_threshold – Define a minimal score threshold for the result.
If defined, less similar results will not be returned. | [
4344,
3111,
488,
529,
482,
3319,
682,
81901,
11,
719,
471,
2819,
3118,
304,
1124,
3111,
488,
315,
81901,
198,
529,
447,
34106,
529,
482,
3319,
279,
8857,
315,
81901,
11,
471,
2819,
3118,
304,
543,
315,
1124,
198,
92748,
529,
482,
3319,
682,
81901,
11,
323,
471,
2819,
3118,
304,
682,
81901,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
14952,
5750,
60,
284,
2290,
11,
2778,
6887,
25,
12536,
58,
5581,
9962,
33003,
4975,
60,
284,
2290,
11,
4445,
25,
528,
284,
220,
15,
11,
5573,
22616,
25,
12536,
96481,
60,
284,
2290,
11,
29237,
25,
12536,
58,
5581,
9962,
6639,
15577,
48194,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
1874,
6887,
1389,
24086,
2778,
3712,
198,
3255,
1389,
17286,
315,
279,
1176,
1121,
311,
471,
627,
11356,
387,
1511,
311,
83074,
3135,
627,
9290,
25,
3544,
4445,
2819,
1253,
5353,
5178,
4819,
627,
12618,
22616,
1389,
19127,
264,
17832,
5573,
12447,
369,
279,
1121,
627,
2746,
4613,
11,
2753,
4528,
3135,
690,
539,
387,
6052,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-11 | 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.
consistency – Read consistency of the search. Defines how many replicas should be
queried before returning the result.
Values:
- int - number of replicas to query, values should present in all
queried replicas
’majority’ - query all replicas, but return values present in themajority of replicas
’quorum’ - query the majority of replicas, return values present inall of them
’all’ - query all replicas, and return values present in all replicas
Returns
List of documents most similar to the query text and cosine
distance in float for each.
Lower score represents more similarity.
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding vector to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – Filter by metadata. Defaults to None.
search_params – Additional search params
offset – Offset of the first result to return.
May be used to paginate results.
Note: large offset values may cause performance issues.
score_threshold – 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. | [
2746,
4613,
11,
2753,
4528,
3135,
690,
539,
387,
6052,
627,
10793,
315,
279,
6052,
1121,
2643,
387,
5190,
477,
9333,
1109,
279,
198,
30002,
11911,
389,
279,
32235,
734,
1511,
627,
36,
1326,
13,
369,
76359,
38723,
1193,
5190,
12483,
690,
387,
6052,
627,
6387,
48194,
1389,
4557,
29237,
315,
279,
2778,
13,
38926,
1268,
1690,
81901,
1288,
387,
198,
16339,
1142,
1603,
13758,
279,
1121,
627,
6359,
512,
12,
528,
482,
1396,
315,
81901,
311,
3319,
11,
2819,
1288,
3118,
304,
682,
198,
16339,
1142,
81901,
198,
4344,
3111,
488,
529,
482,
3319,
682,
81901,
11,
719,
471,
2819,
3118,
304,
1124,
3111,
488,
315,
81901,
198,
529,
447,
34106,
529,
482,
3319,
279,
8857,
315,
81901,
11,
471,
2819,
3118,
304,
543,
315,
1124,
198,
92748,
529,
482,
3319,
682,
81901,
11,
323,
471,
2819,
3118,
304,
682,
81901,
198,
16851,
198,
861,
315,
9477,
1455,
4528,
311,
279,
3319,
1495,
323,
76359,
198,
19909,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
15124,
49325,
10947,
6753,
10622,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
14952,
5750,
60,
284,
2290,
11,
2778,
6887,
25,
12536,
58,
5581,
9962,
33003,
4975,
60,
284,
2290,
11,
4445,
25,
528,
284,
220,
15,
11,
5573,
22616,
25,
12536,
96481,
60,
284,
2290,
11,
29237,
25,
12536,
58,
5581,
9962,
6639,
15577,
48194,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
4724,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
1874,
6887,
1389,
24086,
2778,
3712,
198,
3255,
1389,
17286,
315,
279,
1176,
1121,
311,
471,
627,
11356,
387,
1511,
311,
83074,
3135,
627,
9290,
25,
3544,
4445,
2819,
1253,
5353,
5178,
4819,
627,
12618,
22616,
1389,
19127,
264,
17832,
5573,
12447,
369,
279,
1121,
627,
2746,
4613,
11,
2753,
4528,
3135,
690,
539,
387,
6052,
627,
10793,
315,
279,
6052,
1121,
2643,
387,
5190,
477,
9333,
1109,
279,
198,
30002,
11911,
389,
279,
32235,
734,
1511,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
72a1837327f1-12 | threshold depending on the Distance function used.
E.g. for cosine similarity only higher scores will be returned.
consistency – Read consistency of the search. Defines how many replicas should be
queried before returning the result.
Values:
- int - number of replicas to query, values should present in all
queried replicas
’majority’ - query all replicas, but return values present in themajority of replicas
’quorum’ - query the majority of replicas, return values present inall of them
’all’ - query all replicas, and return values present in all replicas
Returns
List of documents most similar to the query text and cosine
distance in float for each.
Lower score represents more similarity.
CONTENT_KEY = 'page_content'¶
METADATA_KEY = 'metadata'¶
VECTOR_NAME = None¶ | [
30002,
11911,
389,
279,
32235,
734,
1511,
627,
36,
1326,
13,
369,
76359,
38723,
1193,
5190,
12483,
690,
387,
6052,
627,
6387,
48194,
1389,
4557,
29237,
315,
279,
2778,
13,
38926,
1268,
1690,
81901,
1288,
387,
198,
16339,
1142,
1603,
13758,
279,
1121,
627,
6359,
512,
12,
528,
482,
1396,
315,
81901,
311,
3319,
11,
2819,
1288,
3118,
304,
682,
198,
16339,
1142,
81901,
198,
4344,
3111,
488,
529,
482,
3319,
682,
81901,
11,
719,
471,
2819,
3118,
304,
1124,
3111,
488,
315,
81901,
198,
529,
447,
34106,
529,
482,
3319,
279,
8857,
315,
81901,
11,
471,
2819,
3118,
304,
543,
315,
1124,
198,
92748,
529,
482,
3319,
682,
81901,
11,
323,
471,
2819,
3118,
304,
682,
81901,
198,
16851,
198,
861,
315,
9477,
1455,
4528,
311,
279,
3319,
1495,
323,
76359,
198,
19909,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
68972,
6738,
284,
364,
2964,
7647,
6,
55609,
198,
45975,
40219,
6738,
284,
364,
18103,
6,
55609,
198,
44787,
4813,
284,
2290,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.qdrant.Qdrant.html |
6198c80ac0f8-0 | langchain.vectorstores.clarifai.Clarifai¶
class langchain.vectorstores.clarifai.Clarifai(user_id: Optional[str] = None, app_id: Optional[str] = None, pat: Optional[str] = None, number_of_docs: Optional[int] = None, api_base: Optional[str] = None)[source]¶
Bases: VectorStore
Wrapper around Clarifai AI platform’s vector store.
To use, you should have the clarifai python package installed.
Example
from langchain.vectorstores import Clarifai
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Clarifai("langchain_store", embeddings.embed_query)
Initialize with Clarifai client.
Parameters
user_id (Optional[str], optional) – User ID. Defaults to None.
app_id (Optional[str], optional) – App ID. Defaults to None.
pat (Optional[str], optional) – Personal access token. Defaults to None.
number_of_docs (Optional[int], optional) – Number of documents to return
None. (during vector search. Defaults to) –
api_base (Optional[str], optional) – API base. Defaults to None.
Raises
ValueError – If user ID, app ID or personal access token is not provided.
Methods
__init__([user_id, app_id, pat, ...])
Initialize with Clarifai client.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore. | [
5317,
8995,
48203,
44569,
6894,
277,
333,
2192,
732,
14115,
333,
2192,
55609,
198,
1058,
8859,
8995,
48203,
44569,
6894,
277,
333,
2192,
732,
14115,
333,
2192,
4374,
851,
25,
12536,
17752,
60,
284,
2290,
11,
917,
851,
25,
12536,
17752,
60,
284,
2290,
11,
3352,
25,
12536,
17752,
60,
284,
2290,
11,
1396,
3659,
50792,
25,
12536,
19155,
60,
284,
2290,
11,
6464,
7806,
25,
12536,
17752,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
31181,
333,
2192,
15592,
5452,
753,
4724,
3637,
627,
1271,
1005,
11,
499,
1288,
617,
279,
20064,
333,
2192,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
31181,
333,
2192,
198,
1527,
8859,
8995,
41541,
25624,
5949,
2192,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
3295,
4412,
284,
31181,
333,
2192,
446,
5317,
8995,
15153,
498,
71647,
41541,
5857,
340,
10130,
449,
31181,
333,
2192,
3016,
627,
9905,
198,
882,
851,
320,
15669,
17752,
1145,
10309,
8,
1389,
2724,
3110,
13,
37090,
311,
2290,
627,
680,
851,
320,
15669,
17752,
1145,
10309,
8,
1389,
1883,
3110,
13,
37090,
311,
2290,
627,
4781,
320,
15669,
17752,
1145,
10309,
8,
1389,
19758,
2680,
4037,
13,
37090,
311,
2290,
627,
4174,
3659,
50792,
320,
15669,
19155,
1145,
10309,
8,
1389,
5742,
315,
9477,
311,
471,
198,
4155,
13,
320,
82977,
4724,
2778,
13,
37090,
311,
8,
1389,
720,
2113,
7806,
320,
15669,
17752,
1145,
10309,
8,
1389,
5446,
2385,
13,
37090,
311,
2290,
627,
36120,
198,
1150,
1480,
1389,
1442,
1217,
3110,
11,
917,
3110,
477,
4443,
2680,
4037,
374,
539,
3984,
627,
18337,
198,
565,
2381,
565,
2625,
882,
851,
11,
4194,
680,
851,
11,
4194,
4781,
11,
4194,
1131,
2608,
10130,
449,
31181,
333,
2192,
3016,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-1 | Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids])
Add texts to the Clarifai vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_documents(documents[, embedding, ...])
Create a Clarifai vectorstore from a list of documents.
from_texts(texts[, embedding, metadatas, ...])
Create a Clarifai vectorstore from a list of texts.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Run similarity search using Clarifai.
similarity_search_by_vector(embedding[, k]) | [
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
2608,
2261,
22755,
311,
279,
31181,
333,
2192,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
38372,
4194,
95711,
11,
4194,
1131,
2608,
4110,
264,
31181,
333,
2192,
4724,
4412,
505,
264,
1160,
315,
9477,
627,
1527,
80746,
7383,
82,
38372,
4194,
95711,
11,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
4110,
264,
31181,
333,
2192,
4724,
4412,
505,
264,
1160,
315,
22755,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
6869,
38723,
2778,
1701,
31181,
333,
2192,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-2 | similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, ...])
Run similarity search with score using Clarifai.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶
Add texts to the Clarifai vectorstore. This will push the text
to a Clarifai application.
Application use base workflow that create and store embedding for each text.
Make sure you are using a base workflow that is compatible with text
(such as Language Understanding).
Parameters
texts (Iterable[str]) – Texts to add to the vectorstore. | [
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
6869,
38723,
2778,
449,
5573,
1701,
31181,
333,
2192,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
2261,
22755,
311,
279,
31181,
333,
2192,
4724,
4412,
13,
1115,
690,
4585,
279,
1495,
198,
998,
264,
31181,
333,
2192,
3851,
627,
5095,
1005,
2385,
29388,
430,
1893,
323,
3637,
40188,
369,
1855,
1495,
627,
8238,
2771,
499,
527,
1701,
264,
2385,
29388,
430,
374,
18641,
449,
1495,
198,
1161,
1412,
439,
11688,
46551,
4390,
9905,
198,
87042,
320,
51735,
17752,
2526,
1389,
2991,
82,
311,
923,
311,
279,
4724,
4412,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-3 | Parameters
texts (Iterable[str]) – Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
ids (Optional[List[str]], optional) – Optional list of IDs.
Returns
List of IDs of the added texts.
Return type
List[str]
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query. | [
9905,
198,
87042,
320,
51735,
17752,
2526,
1389,
2991,
82,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
21128,
10309,
8,
1389,
12536,
1160,
315,
2322,
329,
19907,
627,
3447,
320,
15669,
53094,
17752,
21128,
10309,
8,
1389,
12536,
1160,
315,
29460,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-4 | Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Optional[Embeddings] = None, user_id: Optional[str] = None, app_id: Optional[str] = None, pat: Optional[str] = None, number_of_docs: Optional[int] = None, api_base: Optional[str] = None, **kwargs: Any) → Clarifai[source]¶
Create a Clarifai vectorstore from a list of documents.
Parameters
user_id (str) – User ID.
app_id (str) – App ID.
documents (List[Document]) – List of documents to add.
pat (Optional[str]) – Personal access token. Defaults to None.
number_of_docs (Optional[int]) – Number of documents to return
None. (during vector search. Defaults to) –
api_base (Optional[str]) – API base. Defaults to None.
Returns
Clarifai vectorstore.
Return type
Clarifai | [
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
1217,
851,
25,
12536,
17752,
60,
284,
2290,
11,
917,
851,
25,
12536,
17752,
60,
284,
2290,
11,
3352,
25,
12536,
17752,
60,
284,
2290,
11,
1396,
3659,
50792,
25,
12536,
19155,
60,
284,
2290,
11,
6464,
7806,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
31181,
333,
2192,
76747,
60,
55609,
198,
4110,
264,
31181,
333,
2192,
4724,
4412,
505,
264,
1160,
315,
9477,
627,
9905,
198,
882,
851,
320,
496,
8,
1389,
2724,
3110,
627,
680,
851,
320,
496,
8,
1389,
1883,
3110,
627,
51878,
320,
861,
58,
7676,
2526,
1389,
1796,
315,
9477,
311,
923,
627,
4781,
320,
15669,
17752,
2526,
1389,
19758,
2680,
4037,
13,
37090,
311,
2290,
627,
4174,
3659,
50792,
320,
15669,
19155,
2526,
1389,
5742,
315,
9477,
311,
471,
198,
4155,
13,
320,
82977,
4724,
2778,
13,
37090,
311,
8,
1389,
720,
2113,
7806,
320,
15669,
17752,
2526,
1389,
5446,
2385,
13,
37090,
311,
2290,
627,
16851,
198,
100069,
333,
2192,
4724,
4412,
627,
5715,
955,
198,
100069,
333,
2192
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-5 | Returns
Clarifai vectorstore.
Return type
Clarifai
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, user_id: Optional[str] = None, app_id: Optional[str] = None, pat: Optional[str] = None, number_of_docs: Optional[int] = None, api_base: Optional[str] = None, **kwargs: Any) → Clarifai[source]¶
Create a Clarifai vectorstore from a list of texts.
Parameters
user_id (str) – User ID.
app_id (str) – App ID.
texts (List[str]) – List of texts to add.
pat (Optional[str]) – Personal access token. Defaults to None.
number_of_docs (Optional[int]) – Number of documents to return
None. (Defaults to) –
api_base (Optional[str]) – API base. Defaults to None.
metadatas (Optional[List[dict]]) – Optional list of metadatas.
None. –
Returns
Clarifai vectorstore.
Return type
Clarifai
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding | [
16851,
198,
100069,
333,
2192,
4724,
4412,
627,
5715,
955,
198,
100069,
333,
2192,
198,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
1217,
851,
25,
12536,
17752,
60,
284,
2290,
11,
917,
851,
25,
12536,
17752,
60,
284,
2290,
11,
3352,
25,
12536,
17752,
60,
284,
2290,
11,
1396,
3659,
50792,
25,
12536,
19155,
60,
284,
2290,
11,
6464,
7806,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
31181,
333,
2192,
76747,
60,
55609,
198,
4110,
264,
31181,
333,
2192,
4724,
4412,
505,
264,
1160,
315,
22755,
627,
9905,
198,
882,
851,
320,
496,
8,
1389,
2724,
3110,
627,
680,
851,
320,
496,
8,
1389,
1883,
3110,
627,
87042,
320,
861,
17752,
2526,
1389,
1796,
315,
22755,
311,
923,
627,
4781,
320,
15669,
17752,
2526,
1389,
19758,
2680,
4037,
13,
37090,
311,
2290,
627,
4174,
3659,
50792,
320,
15669,
19155,
2526,
1389,
5742,
315,
9477,
311,
471,
198,
4155,
13,
320,
16672,
311,
8,
1389,
720,
2113,
7806,
320,
15669,
17752,
2526,
1389,
5446,
2385,
13,
37090,
311,
2290,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
30716,
1389,
12536,
1160,
315,
2322,
329,
19907,
627,
4155,
13,
1389,
720,
16851,
198,
100069,
333,
2192,
4724,
4412,
627,
5715,
955,
198,
100069,
333,
2192,
198,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-6 | of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Run similarity search using Clarifai.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query and score for each
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to. | [
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
6869,
38723,
2778,
1701,
31181,
333,
2192,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
6198c80ac0f8-7 | Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Run similarity search with score using Clarifai.
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata.
None. (Defaults to) –
Returns
List of documents most simmilar to the query text.
Return type
List[Document] | [
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
6869,
38723,
2778,
449,
5573,
1701,
31181,
333,
2192,
627,
9905,
198,
1663,
320,
496,
8,
1389,
11615,
1495,
311,
2778,
369,
627,
74,
320,
396,
8,
1389,
5742,
315,
3135,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
627,
4155,
13,
320,
16672,
311,
8,
1389,
720,
16851,
198,
861,
315,
9477,
1455,
1675,
76,
3653,
311,
279,
3319,
1495,
627,
5715,
955,
198,
861,
58,
7676,
60
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.clarifai.Clarifai.html |
4d06c14adde5-0 | langchain.vectorstores.base.VectorStore¶
class langchain.vectorstores.base.VectorStore[source]¶
Bases: ABC
Interface for vector stores.
Methods
__init__()
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings. | [
5317,
8995,
48203,
44569,
9105,
14621,
6221,
55609,
198,
1058,
8859,
8995,
48203,
44569,
9105,
14621,
6221,
76747,
60,
55609,
198,
33,
2315,
25,
19921,
198,
5160,
369,
4724,
10756,
627,
18337,
198,
565,
2381,
33716,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
4d06c14adde5-1 | Return VectorStore initialized from texts and embeddings.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str][source]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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[Document], **kwargs: Any) → List[str][source]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
abstract 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 | [
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
16647,
923,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
4d06c14adde5-2 | 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.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST[source]¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST[source]¶
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[Document][source]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever[source]¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query. | [
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
9872,
1389,
4724,
4412,
3230,
5137,
198,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
76747,
60,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
4d06c14adde5-3 | Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool][source]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST[source]¶
Return VectorStore initialized from documents and embeddings.
abstract classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST[source]¶
Return VectorStore initialized from texts and embeddings.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity. | [
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
1483,
2484,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
16647,
538,
4492,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
4d06c14adde5-4 | to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document][source]¶
Return docs most similar to query using specified search type.
abstract similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector. | [
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
16647,
38723,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
4d06c14adde5-5 | Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score) | [
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStore.html |
fbe1236d78b1-0 | langchain.vectorstores.typesense.Typesense¶
class langchain.vectorstores.typesense.Typesense(typesense_client: Client, embedding: Embeddings, *, typesense_collection_name: Optional[str] = None, text_key: str = 'text')[source]¶
Bases: 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 Typesense Cloud use xxx.a1.typesense.net
"port": "8108", # For Typesense Cloud use 443
"protocol": "http" # For Typesense Cloud use https
}
typesense_client = typesense.Client(
{
"nodes": [node],
"api_key": "<API_KEY>",
"connection_timeout_seconds": 2
}
)
typesense_collection_name = "langchain-memory"
embedding = OpenAIEmbeddings()
vectorstore = Typesense(
typesense_client=typesense_client,
embedding=embedding,
typesense_collection_name=typesense_collection_name,
text_key="text",
)
Initialize with Typesense client.
Methods
__init__(typesense_client, embedding, *[, ...])
Initialize with Typesense client.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore. | [
5317,
8995,
48203,
44569,
24104,
1137,
30247,
1137,
55609,
198,
1058,
8859,
8995,
48203,
44569,
24104,
1137,
30247,
1137,
53713,
1137,
8342,
25,
8589,
11,
40188,
25,
38168,
25624,
11,
12039,
4595,
1137,
26071,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
1495,
3173,
25,
610,
284,
364,
1342,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
21431,
1137,
4724,
2778,
627,
1271,
1005,
11,
499,
1288,
617,
279,
4595,
1137,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
68714,
5949,
2192,
1179,
5377,
15836,
26566,
25624,
198,
1527,
8859,
8995,
48203,
44569,
1179,
21431,
1137,
198,
475,
4595,
1137,
198,
3593,
284,
341,
262,
330,
3875,
794,
330,
8465,
498,
220,
674,
1789,
21431,
1137,
15161,
1005,
12599,
5973,
16,
24104,
1137,
5181,
198,
262,
330,
403,
794,
330,
19232,
23,
498,
996,
674,
1789,
21431,
1137,
15161,
1005,
220,
17147,
198,
262,
330,
17447,
794,
330,
1277,
1,
262,
674,
1789,
21431,
1137,
15161,
1005,
3788,
198,
534,
9426,
1137,
8342,
284,
4595,
1137,
11978,
1021,
262,
341,
415,
330,
20606,
794,
510,
3593,
1282,
415,
330,
2113,
3173,
794,
4145,
7227,
6738,
36552,
415,
330,
7898,
21179,
35925,
794,
220,
17,
198,
262,
457,
340,
9426,
1137,
26071,
1292,
284,
330,
5317,
8995,
65196,
702,
95711,
284,
5377,
15836,
26566,
25624,
746,
3295,
4412,
284,
21431,
1137,
1021,
262,
4595,
1137,
8342,
28,
9426,
1137,
8342,
345,
262,
40188,
28,
95711,
345,
262,
4595,
1137,
26071,
1292,
28,
9426,
1137,
26071,
1292,
345,
262,
1495,
3173,
429,
1342,
761,
340,
10130,
449,
21431,
1137,
3016,
627,
18337,
198,
565,
2381,
3889,
9426,
1137,
8342,
11,
4194,
95711,
11,
4194,
9,
38372,
4194,
1131,
2608,
10130,
449,
21431,
1137,
3016,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-1 | Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids])
Run more texts through the embedding and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_client_params(embedding, *[, host, ...])
Initialize Typesense directly from client parameters.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Construct Typesense wrapper from raw text.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter]) | [
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
2608,
6869,
810,
22755,
1555,
279,
40188,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
8342,
6887,
50825,
7113,
11,
4194,
9,
38372,
4194,
3875,
11,
4194,
1131,
2608,
10130,
21431,
1137,
6089,
505,
3016,
5137,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
29568,
21431,
1137,
13564,
505,
7257,
1495,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-2 | similarity_search(query[, k, filter])
Return typesense documents most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, filter])
Return typesense documents most similar to query, along with scores.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶
Run more texts through the embedding and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts.
Returns | [
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
2608,
5715,
4595,
1137,
9477,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
11,
4194,
5428,
2608,
5715,
4595,
1137,
9477,
1455,
4528,
311,
3319,
11,
3235,
449,
12483,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
40188,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
16851
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-3 | ids – Optional list of ids to associate with the texts.
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector. | [
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-4 | Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_client_params(embedding: Embeddings, *, host: str = 'localhost', port: Union[str, int] = '8108', protocol: str = 'http', typesense_api_key: Optional[str] = None, connection_timeout_seconds: int = 2, **kwargs: Any) → Typesense[source]¶
Initialize Typesense directly from client parameters.
Example
from langchain.embedding.openai import OpenAIEmbeddings
from langchain.vectorstores import Typesense
# Pass in typesense_api_key as kwarg or set env var "TYPESENSE_API_KEY".
vectorstore = Typesense(
OpenAIEmbeddings(),
host="localhost",
port="8108",
protocol="http",
typesense_collection_name="langchain-memory",
)
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings. | [
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
8342,
6887,
50825,
7113,
25,
38168,
25624,
11,
12039,
3552,
25,
610,
284,
364,
8465,
518,
2700,
25,
9323,
17752,
11,
528,
60,
284,
364,
19232,
23,
518,
11766,
25,
610,
284,
364,
1277,
518,
4595,
1137,
11959,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
3717,
21179,
35925,
25,
528,
284,
220,
17,
11,
3146,
9872,
25,
5884,
8,
11651,
21431,
1137,
76747,
60,
55609,
198,
10130,
21431,
1137,
6089,
505,
3016,
5137,
627,
13617,
198,
1527,
8859,
8995,
68714,
5949,
2192,
1179,
5377,
15836,
26566,
25624,
198,
1527,
8859,
8995,
48203,
44569,
1179,
21431,
1137,
198,
2,
10175,
304,
4595,
1137,
11959,
3173,
439,
30625,
867,
477,
743,
6233,
767,
330,
9692,
45856,
937,
11669,
6738,
23811,
3295,
4412,
284,
21431,
1137,
1021,
262,
5377,
15836,
26566,
25624,
3227,
262,
3552,
429,
8465,
761,
262,
2700,
429,
19232,
23,
761,
262,
11766,
429,
1277,
761,
262,
4595,
1137,
26071,
1292,
429,
5317,
8995,
65196,
761,
340,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-5 | Return VectorStore initialized from documents and embeddings.
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_name: Optional[str] = None, text_key: str = 'text', **kwargs: Any) → Typesense[source]¶
Construct Typesense wrapper from raw text.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4. | [
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
4595,
1137,
8342,
25,
12536,
58,
3032,
60,
284,
2290,
11,
4595,
1137,
8342,
6887,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4595,
1137,
26071,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
1495,
3173,
25,
610,
284,
364,
1342,
518,
3146,
9872,
25,
5884,
8,
11651,
21431,
1137,
76747,
60,
55609,
198,
29568,
21431,
1137,
13564,
505,
7257,
1495,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-6 | k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 10, filter: Optional[str] = '', **kwargs: Any) → List[Document][source]¶
Return typesense documents most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 10.
Minimum 10 results would be returned.
filter – typesense filter_by expression to filter documents on
Returns
List of Documents most similar to the query and score for each
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – Number of Documents to return. Defaults to 4. | [
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
605,
11,
4141,
25,
12536,
17752,
60,
284,
9158,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
4595,
1137,
9477,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
605,
627,
29795,
220,
605,
3135,
1053,
387,
6052,
627,
5428,
1389,
4595,
1137,
4141,
3795,
7645,
311,
4141,
9477,
389,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
fbe1236d78b1-7 | query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 10, filter: Optional[str] = '') → List[Tuple[Document, float]][source]¶
Return typesense 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 10.
Minimum 10 results would be returned.
filter – typesense filter_by expression to filter documents on
Returns
List of Documents most similar to the query and score for each | [
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
605,
11,
4141,
25,
12536,
17752,
60,
284,
13760,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
4595,
1137,
9477,
1455,
4528,
311,
3319,
11,
3235,
449,
12483,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
605,
627,
29795,
220,
605,
3135,
1053,
387,
6052,
627,
5428,
1389,
4595,
1137,
4141,
3795,
7645,
311,
4141,
9477,
389,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html |
95b186987582-0 | langchain.vectorstores.hologres.Hologres¶
class langchain.vectorstores.hologres.Hologres(connection_string: str, embedding_function: Embeddings, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', pre_delete_table: bool = False, logger: Optional[Logger] = None)[source]¶
Bases: VectorStore
VectorStore implementation using Hologres.
connection_string is a hologres connection string.
embedding_function any embedding function implementinglangchain.embeddings.base.Embeddings interface.
ndims is the number of dimensions of the embedding output.
table_name is the name of the table to store embeddings and data.(default: langchain_pg_embedding)
- NOTE: The table will be created when initializing the store (if not exists)
So, make sure the user has the right permissions to create tables.
pre_delete_table if True, will delete the table if it exists.(default: False)
- Useful for testing.
Methods
__init__(connection_string, embedding_function)
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_embeddings(texts, embeddings, metadatas, ...)
Add embeddings to the vectorstore.
add_texts(texts[, metadatas, ids])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas]) | [
5317,
8995,
48203,
44569,
870,
1640,
417,
3924,
1640,
417,
55609,
198,
1058,
8859,
8995,
48203,
44569,
870,
1640,
417,
3924,
1640,
417,
25119,
3991,
25,
610,
11,
40188,
9353,
25,
38168,
25624,
11,
15953,
5861,
25,
528,
284,
220,
9800,
21,
11,
2007,
1292,
25,
610,
284,
364,
5317,
8995,
59781,
52602,
518,
864,
11607,
5350,
25,
1845,
284,
3641,
11,
6050,
25,
12536,
58,
7547,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
3866,
6221,
8292,
1701,
473,
1640,
417,
627,
7898,
3991,
374,
264,
72927,
417,
3717,
925,
627,
95711,
9353,
904,
40188,
734,
25976,
5317,
8995,
41541,
25624,
9105,
58955,
25624,
3834,
627,
303,
5861,
374,
279,
1396,
315,
15696,
315,
279,
40188,
2612,
627,
2048,
1292,
374,
279,
836,
315,
279,
2007,
311,
3637,
71647,
323,
828,
13127,
2309,
25,
8859,
8995,
59781,
52602,
340,
12,
17160,
25,
578,
2007,
690,
387,
3549,
994,
58160,
279,
3637,
320,
333,
539,
6866,
340,
4516,
11,
1304,
2771,
279,
1217,
706,
279,
1314,
8709,
311,
1893,
12920,
627,
1762,
11607,
5350,
422,
3082,
11,
690,
3783,
279,
2007,
422,
433,
6866,
13127,
2309,
25,
3641,
340,
12,
51612,
369,
7649,
627,
18337,
198,
565,
2381,
3889,
7898,
3991,
11,
4194,
95711,
9353,
340,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
64872,
7383,
82,
11,
4194,
12529,
25624,
11,
4194,
4150,
329,
19907,
11,
4194,
32318,
2261,
71647,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-1 | afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
connection_string_from_db_params(host, port, ...)
Return connection string from database parameters.
create_table()
create_vector_extension()
delete(ids)
Delete by vector ID.
from_documents(documents, embedding[, ...])
Return VectorStore initialized from documents and embeddings.
from_embeddings(text_embeddings, embedding)
Construct Hologres wrapper from raw documents and pre- generated embeddings.
from_existing_index(embedding[, ndims, ...])
Get intsance of an existing Hologres store.This method will return the instance of the store without inserting any new embeddings
from_texts(texts, embedding[, metadatas, ...])
Return VectorStore initialized from texts and embeddings.
get_connection_string(kwargs)
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type. | [
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
7898,
3991,
5791,
8856,
6887,
20569,
11,
4194,
403,
11,
4194,
32318,
5715,
3717,
925,
505,
4729,
5137,
627,
3261,
5350,
746,
3261,
12526,
32135,
746,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
38372,
4194,
1131,
2608,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
64872,
7383,
64872,
11,
4194,
95711,
340,
29568,
473,
1640,
417,
13564,
505,
7257,
9477,
323,
864,
12,
8066,
71647,
627,
1527,
63730,
3644,
50825,
7113,
38372,
4194,
303,
5861,
11,
4194,
1131,
2608,
1991,
55824,
685,
315,
459,
6484,
473,
1640,
417,
3637,
29845,
1749,
690,
471,
279,
2937,
315,
279,
3637,
2085,
39398,
904,
502,
71647,
198,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
456,
16245,
3991,
71706,
340,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-2 | Return docs most similar to query using specified search type.
similarity_search(query[, k, filter])
Run similarity search with Hologres with distance.
similarity_search_by_vector(embedding[, k, ...])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, filter])
Return docs most similar to query.
similarity_search_with_score_by_vector(embedding)
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_embeddings(texts: Iterable[str], embeddings: List[List[float]], metadatas: List[dict], ids: List[str], **kwargs: Any) → None[source]¶
Add embeddings to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
embeddings – List of list of embedding vectors.
metadatas – List of metadatas associated with the texts. | [
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
2608,
6869,
38723,
2778,
449,
473,
1640,
417,
449,
6138,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
11,
4194,
5428,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
6753,
10622,
3795,
12526,
50825,
7113,
340,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
64872,
7383,
82,
25,
39116,
17752,
1145,
71647,
25,
1796,
53094,
96481,
21128,
2322,
329,
19907,
25,
1796,
58,
8644,
1145,
14483,
25,
1796,
17752,
1145,
3146,
9872,
25,
5884,
8,
11651,
2290,
76747,
60,
55609,
198,
2261,
71647,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
12529,
25624,
1389,
1796,
315,
1160,
315,
40188,
23728,
627,
4150,
329,
19907,
1389,
1796,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-3 | metadatas – List of metadatas associated with the texts.
kwargs – vectorstore specific parameters
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
kwargs – vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type. | [
4150,
329,
19907,
1389,
1796,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
9872,
1389,
4724,
4412,
3230,
5137,
198,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
9872,
1389,
4724,
4412,
3230,
5137,
198,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-4 | Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
classmethod connection_string_from_db_params(host: str, port: int, database: str, user: str, password: str) → str[source]¶
Return connection string from database parameters.
create_table() → None[source]¶
create_vector_extension() → None[source]¶
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any) → Hologres[source]¶
Return VectorStore initialized from documents and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the HOLOGRES_CONNECTION_STRING environment variable. | [
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
27853,
3717,
3991,
5791,
8856,
6887,
20569,
25,
610,
11,
2700,
25,
528,
11,
4729,
25,
610,
11,
1217,
25,
610,
11,
3636,
25,
610,
8,
11651,
610,
76747,
60,
55609,
198,
5715,
3717,
925,
505,
4729,
5137,
627,
3261,
5350,
368,
11651,
2290,
76747,
60,
55609,
198,
3261,
12526,
32135,
368,
11651,
2290,
76747,
60,
55609,
198,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
15953,
5861,
25,
528,
284,
220,
9800,
21,
11,
2007,
1292,
25,
610,
284,
364,
5317,
8995,
59781,
52602,
518,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
864,
11607,
26071,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
473,
1640,
417,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
4226,
18297,
3717,
925,
374,
2631,
198,
2118,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31350,
7391,
7157,
41808,
12563,
4676,
3977,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-5 | “Either pass it as a parameter
or set the HOLOGRES_CONNECTION_STRING environment variable.
classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', ids: Optional[List[str]] = None, pre_delete_table: bool = False, **kwargs: Any) → Hologres[source]¶
Construct Hologres wrapper from raw documents and pre-
generated embeddings.
Return VectorStore initialized from documents and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the HOLOGRES_CONNECTION_STRING environment variable.
Example
from langchain import Hologres
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
text_embeddings = embeddings.embed_documents(texts)
text_embedding_pairs = list(zip(texts, text_embeddings))
faiss = Hologres.from_embeddings(text_embedding_pairs, embeddings)
classmethod from_existing_index(embedding: Embeddings, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', pre_delete_table: bool = False, **kwargs: Any) → Hologres[source]¶
Get intsance of an existing Hologres store.This method will
return the instance of the store without inserting any new
embeddings
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', ids: Optional[List[str]] = None, pre_delete_table: bool = False, **kwargs: Any) → Hologres[source]¶
Return VectorStore initialized from texts and embeddings.
Postgres connection string is required | [
2118,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31350,
7391,
7157,
41808,
12563,
4676,
3977,
627,
27853,
505,
64872,
7383,
64872,
25,
1796,
20961,
6189,
17752,
11,
1796,
96481,
5163,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
15953,
5861,
25,
528,
284,
220,
9800,
21,
11,
2007,
1292,
25,
610,
284,
364,
5317,
8995,
59781,
52602,
518,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
864,
11607,
5350,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
473,
1640,
417,
76747,
60,
55609,
198,
29568,
473,
1640,
417,
13564,
505,
7257,
9477,
323,
864,
7058,
16583,
71647,
627,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
4226,
18297,
3717,
925,
374,
2631,
198,
2118,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31350,
7391,
7157,
41808,
12563,
4676,
3977,
627,
13617,
198,
1527,
8859,
8995,
1179,
473,
1640,
417,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
1342,
64872,
284,
71647,
41541,
77027,
7383,
82,
340,
1342,
52602,
37530,
284,
1160,
39349,
7383,
82,
11,
1495,
64872,
1192,
3716,
1056,
284,
473,
1640,
417,
6521,
64872,
7383,
52602,
37530,
11,
71647,
340,
27853,
505,
63730,
3644,
50825,
7113,
25,
38168,
25624,
11,
15953,
5861,
25,
528,
284,
220,
9800,
21,
11,
2007,
1292,
25,
610,
284,
364,
5317,
8995,
59781,
52602,
518,
864,
11607,
5350,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
473,
1640,
417,
76747,
60,
55609,
198,
1991,
55824,
685,
315,
459,
6484,
473,
1640,
417,
3637,
29845,
1749,
690,
198,
693,
279,
2937,
315,
279,
3637,
2085,
39398,
904,
502,
198,
12529,
25624,
198,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
15953,
5861,
25,
528,
284,
220,
9800,
21,
11,
2007,
1292,
25,
610,
284,
364,
5317,
8995,
59781,
52602,
518,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
864,
11607,
5350,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
473,
1640,
417,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
4226,
18297,
3717,
925,
374,
2631
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-6 | Return VectorStore initialized from texts and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the HOLOGRES_CONNECTION_STRING environment variable.
classmethod get_connection_string(kwargs: Dict[str, Any]) → str[source]¶
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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 | [
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
4226,
18297,
3717,
925,
374,
2631,
198,
2118,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31350,
7391,
7157,
41808,
12563,
4676,
3977,
627,
27853,
636,
16245,
3991,
71706,
25,
30226,
17752,
11,
5884,
2526,
11651,
610,
76747,
60,
55609,
198,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-7 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
search(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Run similarity search with Hologres with distance.
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
Returns
List of Documents most similar to the query.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns | [
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
6869,
38723,
2778,
449,
473,
1640,
417,
449,
6138,
627,
9905,
198,
1663,
320,
496,
8,
1389,
11615,
1495,
311,
2778,
369,
627,
74,
320,
396,
8,
1389,
5742,
315,
3135,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
95b186987582-8 | filter the resulting set of retrieved docs
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
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, filter: Optional[dict] = None) → List[Tuple[Document, float]][source]¶ | [
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
15124,
49325,
10947,
6753,
10622,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.hologres.Hologres.html |
6aeb83cd23bb-0 | langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch¶
class langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch(opensearch_url: str, index_name: str, embedding_function: Embeddings, **kwargs: Any)[source]¶
Bases: VectorStore
Wrapper around OpenSearch as a vector database.
Example
from langchain import OpenSearchVectorSearch
opensearch_vector_search = OpenSearchVectorSearch(
"http://localhost:9200",
"embeddings",
embedding_function
)
Initialize with necessary components.
Methods
__init__(opensearch_url, index_name, ...)
Initialize with necessary components.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids, bulk_size])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k]) | [
5317,
8995,
48203,
44569,
12298,
1137,
1132,
12526,
10947,
13250,
6014,
3866,
6014,
55609,
198,
1058,
8859,
8995,
48203,
44569,
12298,
1137,
1132,
12526,
10947,
13250,
6014,
3866,
6014,
17534,
1137,
1132,
2975,
25,
610,
11,
1963,
1292,
25,
610,
11,
40188,
9353,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
5377,
6014,
439,
264,
4724,
4729,
627,
13617,
198,
1527,
8859,
8995,
1179,
5377,
6014,
3866,
6014,
198,
454,
1137,
1132,
12526,
10947,
284,
5377,
6014,
3866,
6014,
1021,
262,
330,
1277,
1129,
8465,
25,
18485,
15,
761,
262,
330,
12529,
25624,
761,
262,
40188,
9353,
198,
340,
10130,
449,
5995,
6956,
627,
18337,
198,
565,
2381,
3889,
454,
1137,
1132,
2975,
11,
4194,
1275,
1292,
11,
4194,
32318,
10130,
449,
5995,
6956,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
11,
4194,
68242,
2424,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-1 | asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Construct OpenSearchVectorSearch wrapper from raw documents.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k])
Return docs and it's scores most similar to query.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore. | [
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
29568,
5377,
6014,
3866,
6014,
13564,
505,
7257,
9477,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
2608,
5715,
27437,
323,
433,
596,
12483,
1455,
4528,
311,
3319,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-2 | Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, bulk_size: int = 500, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts.
bulk_size – Bulk API request count; Default: 500
Returns
List of ids from adding the texts into the vectorstore.
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”.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶ | [
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
20155,
2424,
25,
528,
284,
220,
2636,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
68242,
2424,
1389,
62020,
5446,
1715,
1797,
26,
8058,
25,
220,
2636,
198,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
15669,
18161,
25,
3295,
5121,
25,
12051,
2115,
71647,
527,
9967,
304,
13,
37090,
311,
198,
2118,
3295,
5121,
863,
627,
1342,
5121,
25,
12051,
2115,
279,
1495,
315,
279,
2246,
374,
9967,
304,
13,
37090,
198,
998,
1054,
1342,
863,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-3 | Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **kwargs: Any) → OpenSearchVectorSearch[source]¶
Construct OpenSearchVectorSearch wrapper from raw documents.
Example | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
20155,
2424,
25,
528,
284,
220,
2636,
11,
3146,
9872,
25,
5884,
8,
11651,
5377,
6014,
3866,
6014,
76747,
60,
55609,
198,
29568,
5377,
6014,
3866,
6014,
13564,
505,
7257,
9477,
627,
13617
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-4 | Construct OpenSearchVectorSearch wrapper from raw documents.
Example
from langchain import OpenSearchVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
opensearch_vector_search = OpenSearchVectorSearch.from_texts(
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 embeddings are stored in. Defaults to
“vector_field”.
text_field: Document field the text of the document is stored in. Defaults
to “text”.
Optional Keyword Args for Approximate Search:engine: “nmslib”, “faiss”, “lucene”; default: “nmslib”
space_type: “l2”, “l1”, “cosinesimil”, “linf”, “innerproduct”; default: “l2”
ef_search: Size of the dynamic list used during k-NN searches. Higher values
lead to more accurate but slower searches; default: 512
ef_construction: Size of the dynamic list used during k-NN graph creation.
Higher values lead to more accurate graph but slower indexing speed;
default: 512
m: Number of bidirectional links created for each new element. Large impact
on memory consumption. Between 2 and 100; default: 16
Keyword Args for Script Scoring or Painless Scripting:is_appx_search: False
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]¶ | [
29568,
5377,
6014,
3866,
6014,
13564,
505,
7257,
9477,
627,
13617,
198,
1527,
8859,
8995,
1179,
5377,
6014,
3866,
6014,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
454,
1137,
1132,
12526,
10947,
284,
5377,
6014,
3866,
6014,
6521,
80746,
1021,
262,
22755,
345,
262,
71647,
345,
262,
1200,
1137,
1132,
2975,
429,
1277,
1129,
8465,
25,
18485,
15,
702,
340,
5109,
6014,
555,
1670,
11815,
44919,
3509,
7694,
23134,
555,
308,
1026,
2808,
11,
2267,
1056,
198,
438,
27016,
1994,
21787,
11349,
369,
3544,
30525,
13,
7429,
11815,
65198,
5457,
198,
1874,
1555,
14025,
2522,
5620,
323,
393,
16864,
14025,
287,
627,
15669,
18161,
25,
3295,
5121,
25,
12051,
2115,
71647,
527,
9967,
304,
13,
37090,
311,
198,
2118,
3295,
5121,
863,
627,
1342,
5121,
25,
12051,
2115,
279,
1495,
315,
279,
2246,
374,
9967,
304,
13,
37090,
198,
998,
1054,
1342,
863,
627,
15669,
50070,
18161,
369,
44919,
3509,
7694,
25,
8680,
25,
1054,
77,
1026,
2808,
9520,
1054,
3716,
1056,
9520,
1054,
75,
59154,
66545,
1670,
25,
1054,
77,
1026,
2808,
89874,
8920,
1857,
25,
1054,
75,
17,
9520,
1054,
75,
16,
9520,
1054,
9594,
1572,
318,
321,
9520,
1054,
3817,
69,
9520,
1054,
4481,
3107,
66545,
1670,
25,
1054,
75,
17,
89874,
830,
10947,
25,
8645,
315,
279,
8915,
1160,
1511,
2391,
597,
12,
9944,
27573,
13,
35321,
2819,
198,
27152,
311,
810,
13687,
719,
29493,
27573,
26,
1670,
25,
220,
8358,
198,
830,
3464,
3099,
25,
8645,
315,
279,
8915,
1160,
1511,
2391,
597,
12,
9944,
4876,
9886,
627,
88545,
2819,
3063,
311,
810,
13687,
4876,
719,
29493,
53080,
4732,
280,
2309,
25,
220,
8358,
198,
76,
25,
5742,
315,
14435,
45770,
7902,
3549,
369,
1855,
502,
2449,
13,
20902,
5536,
198,
263,
5044,
15652,
13,
28232,
220,
17,
323,
220,
1041,
26,
1670,
25,
220,
845,
198,
35581,
18161,
369,
14025,
2522,
5620,
477,
393,
16864,
14025,
287,
25,
285,
8354,
87,
10947,
25,
3641,
198,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1160,
58,
5317,
8995,
31992,
27352,
1483,
2484,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-5 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
By default, supports Approximate Search. | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
16672,
311,
220,
508,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
1383,
1670,
11,
11815,
44919,
3509,
7694,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-6 | Return docs 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 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”.
Can be set to a special value “*” to include the entire document.
Optional Args for Approximate Search:search_type: “approximate_search”; default: “approximate_search”
boolean_filter: A Boolean filter consists of a Boolean query that
contains a k-NN query and a filter.
subquery_clause: Query clause on the knn vector field; default: “must”
lucene_filter: the Lucene algorithm decides whether to perform an exact
k-NN search with pre-filtering or an approximate search with modified
post-filtering.
Optional Args for Script Scoring Search:search_type: “script_scoring”; default: “approximate_search”
space_type: “l2”, “l1”, “linf”, “cosinesimil”, “innerproduct”,
“hammingbit”; default: “l2”
pre_filter: script_score query to pre-filter documents before identifying
nearest neighbors; default: {“match_all”: {}}
Optional Args for Painless Scripting Search:search_type: “painless_scripting”; default: “approximate_search”
space_type: “l2Squared”, “l1Norm”, “cosineSimilarity”; default: “l2Squared”
pre_filter: script_score query to pre-filter documents before identifying | [
5715,
27437,
1455,
4528,
311,
3319,
627,
1383,
1670,
11,
11815,
44919,
3509,
7694,
627,
13699,
11815,
14025,
2522,
5620,
323,
393,
16864,
14025,
287,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
627,
15669,
18161,
25,
3295,
5121,
25,
12051,
2115,
71647,
527,
9967,
304,
13,
37090,
311,
198,
2118,
3295,
5121,
863,
627,
1342,
5121,
25,
12051,
2115,
279,
1495,
315,
279,
2246,
374,
9967,
304,
13,
37090,
198,
998,
1054,
1342,
863,
627,
18103,
5121,
25,
12051,
2115,
430,
11408,
374,
9967,
304,
13,
37090,
311,
198,
2118,
18103,
863,
627,
6854,
387,
743,
311,
264,
3361,
907,
1054,
9,
863,
311,
2997,
279,
4553,
2246,
627,
15669,
18161,
369,
44919,
3509,
7694,
25,
1874,
1857,
25,
1054,
49153,
3509,
10947,
66545,
1670,
25,
1054,
49153,
3509,
10947,
89874,
6245,
8901,
25,
362,
7137,
4141,
17610,
315,
264,
7137,
3319,
430,
198,
13676,
264,
597,
12,
9944,
3319,
323,
264,
4141,
627,
2008,
1663,
58630,
25,
11615,
22381,
389,
279,
1168,
77,
4724,
2115,
26,
1670,
25,
1054,
25849,
89874,
75,
59154,
8901,
25,
279,
14103,
1994,
12384,
28727,
3508,
311,
2804,
459,
4839,
198,
74,
12,
9944,
2778,
449,
864,
33548,
287,
477,
459,
45968,
2778,
449,
11041,
198,
2252,
33548,
287,
627,
15669,
18161,
369,
14025,
2522,
5620,
7694,
25,
1874,
1857,
25,
1054,
2334,
13473,
5620,
66545,
1670,
25,
1054,
49153,
3509,
10947,
89874,
8920,
1857,
25,
1054,
75,
17,
9520,
1054,
75,
16,
9520,
1054,
3817,
69,
9520,
1054,
9594,
1572,
318,
321,
9520,
1054,
4481,
3107,
863,
345,
2118,
5721,
5424,
4590,
66545,
1670,
25,
1054,
75,
17,
89874,
1762,
8901,
25,
5429,
10622,
3319,
311,
864,
33548,
9477,
1603,
25607,
198,
70611,
19228,
26,
1670,
25,
314,
2118,
6481,
5823,
57633,
4792,
534,
15669,
18161,
369,
393,
16864,
14025,
287,
7694,
25,
1874,
1857,
25,
1054,
79,
16864,
15002,
287,
66545,
1670,
25,
1054,
49153,
3509,
10947,
89874,
8920,
1857,
25,
1054,
75,
17,
89394,
9520,
1054,
75,
16,
26042,
9520,
1054,
9594,
483,
35502,
488,
66545,
1670,
25,
1054,
75,
17,
89394,
89874,
1762,
8901,
25,
5429,
10622,
3319,
311,
864,
33548,
9477,
1603,
25607
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
6aeb83cd23bb-7 | pre_filter: script_score query to pre-filter documents before identifying
nearest neighbors; default: {“match_all”: {}}
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs and it’s scores most similar to query.
By default, supports Approximate Search.
Also supports Script Scoring and Painless Scripting.
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 query.
Optional Args:same as similarity_search | [
1762,
8901,
25,
5429,
10622,
3319,
311,
864,
33548,
9477,
1603,
25607,
198,
70611,
19228,
26,
1670,
25,
314,
2118,
6481,
5823,
57633,
4792,
534,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
323,
433,
753,
12483,
1455,
4528,
311,
3319,
627,
1383,
1670,
11,
11815,
44919,
3509,
7694,
627,
13699,
11815,
14025,
2522,
5620,
323,
393,
16864,
14025,
287,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
3235,
449,
1202,
12483,
1455,
4528,
311,
279,
3319,
627,
15669,
18161,
14835,
373,
439,
38723,
10947
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
68598a981156-0 | langchain.vectorstores.deeplake.DeepLake¶
class langchain.vectorstores.deeplake.DeepLake(dataset_path: str = './deeplake/', token: Optional[str] = None, embedding_function: Optional[Embeddings] = None, read_only: bool = False, ingestion_batch_size: int = 1000, num_workers: int = 0, verbose: bool = True, exec_option: str = 'python', **kwargs: Any)[source]¶
Bases: VectorStore
Wrapper around Deep Lake, a data lake for deep learning applications.
We integrated deeplake’s similarity search and filtering for fast prototyping,
Now, it supports Tensor Query Language (TQL) for production use cases
over billion rows.
Why Deep Lake?
Not only stores embeddings, but also the original data with version control.
Serverless, doesn’t require another service and can be used with majorcloud providers (S3, GCS, etc.)
More than just a multi-modal vector store. You can use the datasetto fine-tune your own LLM models.
To use, you should have the deeplake python package installed.
Example
from langchain.vectorstores import DeepLake
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = DeepLake("langchain_store", embeddings.embed_query)
Creates an empty DeepLakeVectorStore or loads an existing one.
The DeepLakeVectorStore is located at the specified path.
Examples
>>> # Create a vector store with default tensors
>>> deeplake_vectorstore = DeepLake(
... path = <path_for_storing_Data>,
... )
>>>
>>> # Create a vector store in the Deep Lake Managed Tensor Database
>>> data = DeepLake(
... path = "hub://org_id/dataset_name", | [
5317,
8995,
48203,
44569,
2337,
68,
501,
731,
56702,
82389,
55609,
198,
1058,
8859,
8995,
48203,
44569,
2337,
68,
501,
731,
56702,
82389,
31635,
2703,
25,
610,
284,
2825,
58994,
501,
731,
14688,
4037,
25,
12536,
17752,
60,
284,
2290,
11,
40188,
9353,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
1373,
18917,
25,
1845,
284,
3641,
11,
88447,
14876,
2424,
25,
528,
284,
220,
1041,
15,
11,
1661,
44657,
25,
528,
284,
220,
15,
11,
14008,
25,
1845,
284,
3082,
11,
3969,
9869,
25,
610,
284,
364,
12958,
518,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
18682,
11940,
11,
264,
828,
22553,
369,
5655,
6975,
8522,
627,
1687,
18751,
45833,
501,
731,
753,
38723,
2778,
323,
30770,
369,
5043,
1760,
67247,
345,
7184,
11,
433,
11815,
27127,
11615,
11688,
320,
51,
3672,
8,
369,
5788,
1005,
5157,
198,
2017,
7239,
7123,
627,
10445,
18682,
11940,
5380,
2688,
1193,
10756,
71647,
11,
719,
1101,
279,
4113,
828,
449,
2373,
2585,
627,
5592,
1752,
11,
3250,
1431,
1397,
2500,
2532,
323,
649,
387,
1511,
449,
3682,
12641,
12850,
320,
50,
18,
11,
480,
6546,
11,
5099,
29275,
7816,
1109,
1120,
264,
7447,
26177,
4724,
3637,
13,
1472,
649,
1005,
279,
10550,
998,
7060,
2442,
2957,
701,
1866,
445,
11237,
4211,
627,
1271,
1005,
11,
499,
1288,
617,
279,
45833,
501,
731,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
18682,
82389,
198,
1527,
8859,
8995,
41541,
25624,
5949,
2192,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
3295,
4412,
284,
18682,
82389,
446,
5317,
8995,
15153,
498,
71647,
41541,
5857,
340,
55968,
459,
4384,
18682,
82389,
3866,
6221,
477,
21577,
459,
6484,
832,
627,
791,
18682,
82389,
3866,
6221,
374,
7559,
520,
279,
5300,
1853,
627,
41481,
198,
20761,
674,
4324,
264,
4724,
3637,
449,
1670,
78187,
198,
20761,
45833,
501,
731,
12526,
4412,
284,
18682,
82389,
1021,
1131,
286,
1853,
284,
366,
2398,
5595,
1284,
5620,
18296,
12803,
1131,
1763,
2511,
397,
20761,
674,
4324,
264,
4724,
3637,
304,
279,
18682,
11940,
61844,
27127,
10199,
198,
20761,
828,
284,
18682,
82389,
1021,
1131,
286,
1853,
284,
330,
27780,
1129,
1813,
851,
3529,
8534,
1292,
498
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-1 | ... path = "hub://org_id/dataset_name",
... exec_option = "tensor_db",
... )
Parameters
dataset_path (str) – Path to existing dataset or where to create
a new one. Defaults to _LANGCHAIN_DEFAULT_DEEPLAKE_PATH.
token (str, optional) – Activeloop token, for fetching credentials
to the dataset at path if it is a Deep Lake dataset.
Tokens are normally autogenerated. Optional.
embedding_function (str, optional) – Function to convert
either documents or query. Optional.
read_only (bool) – Open dataset in read-only mode. Default is False.
ingestion_batch_size (int) – During data ingestion, data is divided
into batches. Batch size is the size of each batch.
Default is 1000.
num_workers (int) – Number of workers to use during data ingestion.
Default is 0.
verbose (bool) – Print dataset summary after each operation.
Default is True.
exec_option (str) – DeepLakeVectorStore supports 3 ways to perform
searching - “python”, “compute_engine”, “tensor_db”.
Default is “python”.
- python - Pure-python implementation that runs on the client.
WARNING: using this with big datasets can lead to memory
issues. Data can be stored anywhere.
- compute_engine - C++ implementation of the Deep Lake Compute
Engine that runs on the client. Can be used for any data stored in
or connected to Deep Lake. Not for in-memory or local datasets.
- tensor_db - Hosted Managed Tensor Database that is
responsible for storage and query execution. Only for data stored in
the Deep Lake Managed Database. Use runtime = {“db_engine”: True} during
dataset creation.
**kwargs – Other optional keyword arguments.
Raises
ValueError – If some condition is not met. | [
1131,
286,
1853,
284,
330,
27780,
1129,
1813,
851,
3529,
8534,
1292,
761,
1131,
286,
3969,
9869,
284,
330,
47211,
8856,
761,
1131,
1763,
9905,
198,
22090,
2703,
320,
496,
8,
1389,
8092,
311,
6484,
10550,
477,
1405,
311,
1893,
198,
64,
502,
832,
13,
37090,
311,
721,
20598,
91833,
14131,
2952,
36,
2989,
26553,
8103,
627,
5963,
320,
496,
11,
10309,
8,
1389,
15050,
20782,
454,
4037,
11,
369,
45334,
16792,
198,
998,
279,
10550,
520,
1853,
422,
433,
374,
264,
18682,
11940,
10550,
627,
30400,
527,
14614,
82933,
13,
12536,
627,
95711,
9353,
320,
496,
11,
10309,
8,
1389,
5830,
311,
5625,
198,
50998,
9477,
477,
3319,
13,
12536,
627,
888,
18917,
320,
2707,
8,
1389,
5377,
10550,
304,
1373,
15744,
3941,
13,
8058,
374,
3641,
627,
287,
43598,
14876,
2424,
320,
396,
8,
1389,
12220,
828,
88447,
11,
828,
374,
18255,
198,
18614,
45892,
13,
35004,
1404,
374,
279,
1404,
315,
1855,
7309,
627,
3760,
374,
220,
1041,
15,
627,
2470,
44657,
320,
396,
8,
1389,
5742,
315,
7487,
311,
1005,
2391,
828,
88447,
627,
3760,
374,
220,
15,
627,
15228,
320,
2707,
8,
1389,
8377,
10550,
12399,
1306,
1855,
5784,
627,
3760,
374,
3082,
627,
12010,
9869,
320,
496,
8,
1389,
18682,
82389,
3866,
6221,
11815,
220,
18,
5627,
311,
2804,
198,
1874,
287,
482,
1054,
12958,
9520,
1054,
28806,
25860,
9520,
1054,
47211,
8856,
863,
627,
3760,
374,
1054,
12958,
863,
627,
12,
10344,
482,
30688,
73029,
8292,
430,
8640,
389,
279,
3016,
627,
33804,
25,
1701,
420,
449,
2466,
30525,
649,
3063,
311,
5044,
198,
18934,
13,
2956,
649,
387,
9967,
12660,
627,
12,
12849,
25860,
482,
356,
1044,
8292,
315,
279,
18682,
11940,
23426,
198,
4674,
430,
8640,
389,
279,
3016,
13,
3053,
387,
1511,
369,
904,
828,
9967,
304,
198,
269,
8599,
311,
18682,
11940,
13,
2876,
369,
304,
65196,
477,
2254,
30525,
627,
12,
16000,
8856,
482,
16492,
291,
61844,
27127,
10199,
430,
374,
198,
417,
43419,
369,
5942,
323,
3319,
11572,
13,
8442,
369,
828,
9967,
304,
198,
1820,
18682,
11940,
61844,
10199,
13,
5560,
15964,
284,
314,
2118,
2042,
25860,
57633,
3082,
92,
2391,
198,
22090,
9886,
627,
334,
9872,
1389,
7089,
10309,
16570,
6105,
627,
36120,
198,
1150,
1480,
1389,
1442,
1063,
3044,
374,
539,
2322,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-2 | Raises
ValueError – If some condition is not met.
Methods
__init__([dataset_path, token, ...])
Creates an empty DeepLakeVectorStore or loads an existing one.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete([ids, filter, delete_all])
Delete the entities in the dataset.
delete_dataset()
Delete the collection.
force_delete_by_path(path)
Force delete dataset by path.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings. | [
36120,
198,
1150,
1480,
1389,
1442,
1063,
3044,
374,
539,
2322,
627,
18337,
198,
565,
2381,
565,
2625,
22090,
2703,
11,
4194,
5963,
11,
4194,
1131,
2608,
55968,
459,
4384,
18682,
82389,
3866,
6221,
477,
21577,
459,
6484,
832,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
2625,
3447,
11,
4194,
5428,
11,
4194,
4644,
5823,
2608,
6571,
279,
15086,
304,
279,
10550,
627,
4644,
19536,
746,
6571,
279,
4526,
627,
9009,
11607,
3795,
2703,
5698,
340,
19085,
3783,
10550,
555,
1853,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-3 | Return VectorStore initialized from documents and embeddings.
from_texts(texts[, embedding, metadatas, ...])
Create a Deep Lake dataset from a raw documents.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k])
Run similarity search with Deep Lake with distance returned.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str] | [
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
38372,
4194,
95711,
11,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
4110,
264,
18682,
11940,
10550,
505,
264,
7257,
9477,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
2608,
6869,
38723,
2778,
449,
18682,
11940,
449,
6138,
6052,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
60
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-4 | Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Examples
>>> ids = deeplake_vectorstore.add_texts(
... texts = <list_of_texts>,
... metadatas = <list_of_metadata_jsons>,
... ids = <list_of_ids>,
... )
Parameters
texts (Iterable[str]) – Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
ids (Optional[List[str]], optional) – Optional list of IDs.
**kwargs – other optional keyword arguments.
Returns
List of IDs of the added texts.
Return type
List[str]
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance. | [
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
41481,
198,
20761,
14483,
284,
45833,
501,
731,
12526,
4412,
1388,
80746,
1021,
1131,
257,
22755,
284,
366,
1638,
3659,
80746,
12803,
1131,
257,
2322,
329,
19907,
284,
366,
1638,
3659,
23012,
9643,
82,
12803,
1131,
257,
14483,
284,
366,
1638,
3659,
8237,
12803,
1131,
1763,
9905,
198,
87042,
320,
51735,
17752,
2526,
1389,
2991,
82,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
21128,
10309,
8,
1389,
12536,
1160,
315,
2322,
329,
19907,
627,
3447,
320,
15669,
53094,
17752,
21128,
10309,
8,
1389,
12536,
1160,
315,
29460,
627,
334,
9872,
1389,
1023,
10309,
16570,
6105,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-5 | Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
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 None.
filter (Optional[Dict[str, str]], optional) – The filter to delete by.
Defaults to None.
delete_all (Optional[bool], optional) – Whether to drop the dataset.
Defaults to None.
Returns
Whether the delete operation was successful.
Return type
bool
delete_dataset() → None[source]¶
Delete the collection. | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
5884,
53094,
17752,
1145,
2290,
60,
284,
2290,
11,
4141,
25,
5884,
58,
13755,
17752,
11,
610,
1145,
2290,
60,
284,
2290,
11,
3783,
5823,
25,
5884,
58,
2707,
11,
2290,
60,
284,
2290,
8,
11651,
1845,
76747,
60,
55609,
198,
6571,
279,
15086,
304,
279,
10550,
627,
9905,
198,
3447,
320,
15669,
53094,
17752,
21128,
10309,
8,
1389,
578,
2246,
8237,
311,
3783,
627,
16672,
311,
2290,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
21128,
10309,
8,
1389,
578,
4141,
311,
3783,
555,
627,
16672,
311,
2290,
627,
4644,
5823,
320,
15669,
58,
2707,
1145,
10309,
8,
1389,
13440,
311,
6068,
279,
10550,
627,
16672,
311,
2290,
627,
16851,
198,
25729,
279,
3783,
5784,
574,
6992,
627,
5715,
955,
198,
2707,
198,
4644,
19536,
368,
11651,
2290,
76747,
60,
55609,
198,
6571,
279,
4526,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-6 | Return type
bool
delete_dataset() → None[source]¶
Delete the collection.
classmethod force_delete_by_path(path: str) → None[source]¶
Force delete dataset by path.
Parameters
path (str) – path of the dataset to delete.
Raises
ValueError – if deeplake is not installed.
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, dataset_path: str = './deeplake/', **kwargs: Any) → DeepLake[source]¶
Create a Deep Lake dataset from a raw documents.
If a dataset_path is specified, the dataset will be persisted in that location,
otherwise by default at ./deeplake
Examples:
>>> # Search using an embedding
>>> vector_store = DeepLake.from_texts(
… texts = <the_texts_that_you_want_to_embed>,
… embedding_function = <embedding_function_for_query>,
… k = <number_of_items_to_return>,
… exec_option = <preferred_exec_option>,
… )
Parameters
dataset_path (str) –
The full path to the dataset. Can be:
Deep Lake cloud path of the form hub://username/dataset_name.To write to Deep Lake cloud datasets,
ensure that you are logged in to Deep Lake
(use ‘activeloop login’ from command line)
AWS S3 path of the form s3://bucketname/path/to/dataset.Credentials are required in either the environment
Google Cloud Storage path of the formgcs://bucketname/path/to/dataset Credentials are required
in either the environment | [
5715,
955,
198,
2707,
198,
4644,
19536,
368,
11651,
2290,
76747,
60,
55609,
198,
6571,
279,
4526,
627,
27853,
5457,
11607,
3795,
2703,
5698,
25,
610,
8,
11651,
2290,
76747,
60,
55609,
198,
19085,
3783,
10550,
555,
1853,
627,
9905,
198,
2398,
320,
496,
8,
1389,
1853,
315,
279,
10550,
311,
3783,
627,
36120,
198,
1150,
1480,
1389,
422,
45833,
501,
731,
374,
539,
10487,
627,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
10550,
2703,
25,
610,
284,
2825,
58994,
501,
731,
14688,
3146,
9872,
25,
5884,
8,
11651,
18682,
82389,
76747,
60,
55609,
198,
4110,
264,
18682,
11940,
10550,
505,
264,
7257,
9477,
627,
2746,
264,
10550,
2703,
374,
5300,
11,
279,
10550,
690,
387,
54095,
304,
430,
3813,
345,
61036,
555,
1670,
520,
13288,
58994,
501,
731,
198,
41481,
512,
20761,
674,
7694,
1701,
459,
40188,
198,
20761,
4724,
15153,
284,
18682,
82389,
6521,
80746,
1021,
1981,
286,
22755,
284,
366,
1820,
80746,
71297,
71556,
1704,
519,
2401,
24967,
12803,
1981,
286,
40188,
9353,
284,
366,
95711,
9353,
5595,
5857,
12803,
1981,
286,
597,
284,
366,
4174,
3659,
12408,
2401,
12794,
12803,
1981,
286,
3969,
9869,
284,
366,
74586,
18937,
9869,
12803,
1981,
1763,
9905,
198,
22090,
2703,
320,
496,
8,
1389,
720,
791,
2539,
1853,
311,
279,
10550,
13,
3053,
387,
512,
34564,
11940,
9624,
1853,
315,
279,
1376,
19240,
1129,
5223,
3529,
8534,
1292,
3354,
3350,
311,
18682,
11940,
9624,
30525,
345,
28389,
430,
499,
527,
14042,
304,
311,
18682,
11940,
198,
48462,
3451,
9035,
20782,
454,
5982,
529,
505,
3290,
1584,
340,
37236,
328,
18,
1853,
315,
279,
1376,
274,
18,
1129,
31510,
609,
52076,
33529,
3529,
8534,
732,
16112,
527,
2631,
304,
3060,
279,
4676,
198,
14783,
15161,
15035,
1853,
315,
279,
1376,
70,
4942,
1129,
31510,
609,
52076,
33529,
3529,
8534,
62360,
527,
2631,
198,
258,
3060,
279,
4676
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-7 | 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.
texts (List[Document]) – List of documents to add.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
Note, in other places, it is called embedding_function.
metadatas (Optional[List[dict]]) – List of metadatas. Defaults to None.
ids (Optional[List[str]]) – List of document IDs. Defaults to None.
**kwargs – Additional keyword arguments.
Returns
Deep Lake dataset.
Return type
DeepLake
Raises
ValueError – If ‘embedding’ is provided in kwargs. This is deprecated,
please use embedding_function instead.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, exec_option: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Examples:
>>> # Search using an embedding
>>> data = vector_store.max_marginal_relevance_search(
… query = <query_to_search>,
… embedding_function = <embedding_function_for_query>,
… k = <number_of_items_to_return>,
… exec_option = <preferred_exec_option>,
… )
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents for MMR algorithm. | [
258,
3060,
279,
4676,
198,
7469,
1052,
1887,
1853,
315,
279,
1376,
13288,
2398,
33529,
3529,
8534,
477,
23549,
2398,
33529,
3529,
8534,
477,
1853,
33529,
3529,
8534,
627,
644,
65196,
1853,
315,
279,
1376,
1871,
1129,
2398,
33529,
3529,
8534,
902,
3250,
1431,
6766,
279,
10550,
11,
719,
13912,
433,
304,
5044,
4619,
627,
15346,
387,
1511,
1193,
369,
7649,
439,
433,
1587,
539,
23135,
627,
87042,
320,
861,
58,
7676,
2526,
1389,
1796,
315,
9477,
311,
923,
627,
95711,
320,
15669,
58,
26566,
25624,
2526,
1389,
38168,
7113,
734,
13,
37090,
311,
2290,
627,
9290,
11,
304,
1023,
7634,
11,
433,
374,
2663,
40188,
9353,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
30716,
1389,
1796,
315,
2322,
329,
19907,
13,
37090,
311,
2290,
627,
3447,
320,
15669,
53094,
17752,
30716,
1389,
1796,
315,
2246,
29460,
13,
37090,
311,
2290,
627,
334,
9872,
1389,
24086,
16570,
6105,
627,
16851,
198,
34564,
11940,
10550,
627,
5715,
955,
198,
34564,
82389,
198,
36120,
198,
1150,
1480,
1389,
1442,
3451,
95711,
529,
374,
3984,
304,
16901,
13,
1115,
374,
32690,
345,
262,
4587,
1005,
40188,
9353,
4619,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3969,
9869,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
41481,
512,
20761,
674,
7694,
1701,
459,
40188,
198,
20761,
828,
284,
4724,
15153,
6817,
722,
867,
992,
1311,
33194,
10947,
1021,
1981,
286,
3319,
284,
366,
1663,
2401,
10947,
12803,
1981,
286,
40188,
9353,
284,
366,
95711,
9353,
5595,
5857,
12803,
1981,
286,
597,
284,
366,
4174,
3659,
12408,
2401,
12794,
12803,
1981,
286,
3969,
9869,
284,
366,
74586,
18937,
9869,
12803,
1981,
1763,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
369,
386,
18953,
12384,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-8 | fetch_k – Number of Documents for MMR algorithm.
lambda_mult – Value between 0 and 1. 0 corresponds
to maximum diversity and 1 to minimum.
Defaults to 0.5.
exec_option (str) – Supports 3 ways to perform searching.
- “python” - Pure-python implementation running on the client.
Can be used for data stored anywhere. WARNING: using this
option with big datasets is discouraged due to potential
memory issues.
”compute_engine” - Performant C++ implementation of the DeepLake Compute Engine. Runs on the client and can be used for
any data stored in or connected to Deep Lake. It cannot be
used with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available
for data stored in the Deep Lake Managed Database. To store
datasets in this database, specify
runtime = {“db_engine”: True} during dataset creation.
**kwargs – Additional keyword arguments
Returns
List of Documents selected by maximal marginal relevance.
Raises
ValueError – when MRR search is on but embedding function is
not specified.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, exec_option: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance. Maximal marginal
relevance optimizes for similarity to query AND diversity among selected docs.
Examples:
>>> data = vector_store.max_marginal_relevance_search_by_vector(
… embedding=<your_embedding>,
… fetch_k=<elements_to_fetch_before_mmr_search>,
… k=<number_of_items_to_return>, | [
9838,
4803,
1389,
5742,
315,
45890,
369,
386,
18953,
12384,
627,
13231,
27386,
1389,
5273,
1990,
220,
15,
323,
220,
16,
13,
220,
15,
34310,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
627,
16672,
311,
220,
15,
13,
20,
627,
12010,
9869,
320,
496,
8,
1389,
67546,
220,
18,
5627,
311,
2804,
15389,
627,
12,
1054,
12958,
863,
482,
30688,
73029,
8292,
4401,
389,
279,
3016,
627,
6854,
387,
1511,
369,
828,
9967,
12660,
13,
27577,
25,
1701,
420,
198,
2091,
449,
2466,
30525,
374,
64770,
4245,
311,
4754,
198,
17717,
4819,
627,
863,
28806,
25860,
863,
482,
26050,
519,
356,
1044,
8292,
315,
279,
18682,
82389,
23426,
8364,
13,
51090,
389,
279,
3016,
323,
649,
387,
1511,
369,
198,
3852,
828,
9967,
304,
477,
8599,
311,
18682,
11940,
13,
1102,
4250,
387,
198,
2656,
449,
304,
65196,
477,
2254,
30525,
627,
863,
47211,
8856,
863,
482,
26050,
519,
11,
7373,
39689,
291,
61844,
27127,
10199,
8542,
43419,
369,
5942,
323,
3319,
11572,
13,
8442,
2561,
198,
2000,
828,
9967,
304,
279,
18682,
11940,
61844,
10199,
13,
2057,
3637,
198,
66646,
304,
420,
4729,
11,
14158,
198,
23051,
284,
314,
2118,
2042,
25860,
57633,
3082,
92,
2391,
10550,
9886,
627,
334,
9872,
1389,
24086,
16570,
6105,
198,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
36120,
198,
1150,
1480,
1389,
994,
386,
8268,
2778,
374,
389,
719,
40188,
734,
374,
198,
262,
539,
5300,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3969,
9869,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
13,
7639,
2931,
32873,
198,
265,
33194,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
4315,
4183,
27437,
627,
41481,
512,
20761,
828,
284,
4724,
15153,
6817,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
1021,
1981,
286,
40188,
39798,
22479,
52602,
12803,
1981,
286,
7963,
4803,
39798,
22138,
2401,
12066,
24638,
722,
21620,
10947,
12803,
1981,
286,
597,
39798,
4174,
3659,
12408,
2401,
12794,
8226
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-9 | … k=<number_of_items_to_return>,
… exec_option=<preferred_exec_option>,
… )
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch for MMR algorithm.
lambda_mult – Number between 0 and 1 determining the degree of diversity.
0 corresponds to max diversity and 1 to min diversity. Defaults to 0.5.
exec_option (str) – DeepLakeVectorStore supports 3 ways for searching.
Could be “python”, “compute_engine” or “tensor_db”. Defaults to
“python”.
- “python” - Pure-python implementation running on the client.
Can be used for data stored anywhere. WARNING: using this
option with big datasets is discouraged due to potential
memory issues.
”compute_engine” - Performant C++ implementation of the DeepLake Compute Engine. Runs on the client and can be used for
any data stored in or connected to Deep Lake. It cannot be used
with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available for
data stored in the Deep Lake Managed Database. To store datasets
in this database, specify runtime = {“db_engine”: True}
during dataset creation.
**kwargs – Additional keyword arguments.
Returns
List[Documents] - A list of documents.
search(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
Examples
>>> # Search using an embedding | [
1981,
286,
597,
39798,
4174,
3659,
12408,
2401,
12794,
12803,
1981,
286,
3969,
9869,
39798,
74586,
18937,
9869,
12803,
1981,
1763,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
369,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
26679,
279,
8547,
315,
20057,
627,
15,
34310,
311,
1973,
20057,
323,
220,
16,
311,
1332,
20057,
13,
37090,
311,
220,
15,
13,
20,
627,
12010,
9869,
320,
496,
8,
1389,
18682,
82389,
3866,
6221,
11815,
220,
18,
5627,
369,
15389,
627,
13191,
387,
1054,
12958,
9520,
1054,
28806,
25860,
863,
477,
1054,
47211,
8856,
11453,
37090,
311,
198,
2118,
12958,
863,
627,
12,
1054,
12958,
863,
482,
30688,
73029,
8292,
4401,
389,
279,
3016,
627,
6854,
387,
1511,
369,
828,
9967,
12660,
13,
27577,
25,
1701,
420,
198,
2091,
449,
2466,
30525,
374,
64770,
4245,
311,
4754,
198,
17717,
4819,
627,
863,
28806,
25860,
863,
482,
26050,
519,
356,
1044,
8292,
315,
279,
18682,
82389,
23426,
8364,
13,
51090,
389,
279,
3016,
323,
649,
387,
1511,
369,
198,
3852,
828,
9967,
304,
477,
8599,
311,
18682,
11940,
13,
1102,
4250,
387,
1511,
198,
4291,
304,
65196,
477,
2254,
30525,
627,
863,
47211,
8856,
863,
482,
26050,
519,
11,
7373,
39689,
291,
61844,
27127,
10199,
8542,
43419,
369,
5942,
323,
3319,
11572,
13,
8442,
2561,
369,
198,
695,
9967,
304,
279,
18682,
11940,
61844,
10199,
13,
2057,
3637,
30525,
198,
258,
420,
4729,
11,
14158,
15964,
284,
314,
2118,
2042,
25860,
57633,
3082,
534,
82977,
10550,
9886,
627,
334,
9872,
1389,
24086,
16570,
6105,
627,
16851,
198,
861,
58,
28242,
60,
482,
362,
1160,
315,
9477,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
41481,
198,
20761,
674,
7694,
1701,
459,
40188
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-10 | Return docs most similar to query.
Examples
>>> # Search using an embedding
>>> data = vector_store.similarity_search(
... query=<your_query>,
... k=<num_items>,
... exec_option=<preferred_exec_option>,
... )
>>> # Run tql search:
>>> data = vector_store.tql_search(
... tql_query="SELECT * WHERE id == <id>",
... exec_option="compute_engine",
... )
Parameters
k (int) – Number of Documents to return. Defaults to 4.
query (str) – Text to look up similar documents.
**kwargs – Additional keyword arguments include:
embedding (Callable): Embedding function to use. Defaults to None.
distance_metric (str): ‘L2’ for Euclidean, ‘L1’ for Nuclear, ‘max’
for L-infinity, ‘cos’ for cosine, ‘dot’ for dot product.
Defaults to ‘L2’.
filter (Union[Dict, Callable], optional): Additional filterbefore embedding search.
- Dict: Key-value search on tensors of htype json,
(sample must satisfy all key-value filters)
Dict = {“tensor_1”: {“key”: value}, “tensor_2”: {“key”: value}}
Function: Compatible with deeplake.filter.
Defaults to None.
exec_option (str): Supports 3 ways to perform searching.’python’, ‘compute_engine’, or ‘tensor_db’. Defaults to ‘python’.
- ‘python’: Pure-python implementation for the client.
WARNING: not recommended for big datasets.
’compute_engine’: C++ implementation of the Compute Engine forthe client. Not for in-memory or local datasets.
’tensor_db’: Managed Tensor Database for storage and query.Only for data in Deep Lake Managed Database.
Use runtime = {“db_engine”: True} during dataset creation. | [
5715,
27437,
1455,
4528,
311,
3319,
627,
41481,
198,
20761,
674,
7694,
1701,
459,
40188,
198,
20761,
828,
284,
4724,
15153,
29716,
49325,
10947,
1021,
1131,
257,
3319,
39798,
22479,
5857,
12803,
1131,
257,
597,
39798,
2470,
12408,
12803,
1131,
257,
3969,
9869,
39798,
74586,
18937,
9869,
12803,
1131,
1763,
20761,
674,
6588,
259,
1498,
2778,
512,
20761,
828,
284,
4724,
15153,
739,
1498,
10947,
1021,
1131,
257,
259,
1498,
5857,
429,
4963,
353,
5401,
887,
624,
366,
307,
36552,
1131,
257,
3969,
9869,
429,
28806,
25860,
761,
1131,
1763,
9905,
198,
74,
320,
396,
8,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
1663,
320,
496,
8,
1389,
2991,
311,
1427,
709,
4528,
9477,
627,
334,
9872,
1389,
24086,
16570,
6105,
2997,
512,
95711,
320,
41510,
1680,
38168,
7113,
734,
311,
1005,
13,
37090,
311,
2290,
627,
19909,
42394,
320,
496,
1680,
3451,
43,
17,
529,
369,
22730,
51178,
11,
3451,
43,
16,
529,
369,
38544,
11,
3451,
2880,
529,
198,
2000,
445,
3502,
20482,
11,
3451,
9594,
529,
369,
76359,
11,
3451,
16510,
529,
369,
13046,
2027,
627,
16672,
311,
3451,
43,
17,
529,
627,
5428,
320,
33758,
58,
13755,
11,
54223,
1145,
10309,
1680,
24086,
4141,
15145,
40188,
2778,
627,
12,
30226,
25,
5422,
19625,
2778,
389,
78187,
315,
305,
1337,
3024,
345,
34068,
2011,
27651,
682,
1401,
19625,
13711,
340,
13755,
284,
314,
2118,
47211,
62,
16,
57633,
314,
2118,
798,
57633,
907,
2186,
1054,
47211,
62,
17,
57633,
314,
2118,
798,
57633,
907,
11498,
5263,
25,
67365,
449,
45833,
501,
731,
7081,
627,
16672,
311,
2290,
627,
12010,
9869,
320,
496,
1680,
67546,
220,
18,
5627,
311,
2804,
15389,
14639,
12958,
20182,
3451,
28806,
25860,
20182,
477,
3451,
47211,
8856,
24535,
37090,
311,
3451,
12958,
529,
627,
12,
3451,
12958,
89213,
30688,
73029,
8292,
369,
279,
3016,
627,
33804,
25,
539,
11349,
369,
2466,
30525,
627,
529,
28806,
25860,
89213,
356,
1044,
8292,
315,
279,
23426,
8364,
369,
1820,
3016,
13,
2876,
369,
304,
65196,
477,
2254,
30525,
627,
1431,
3890,
8856,
89213,
61844,
27127,
10199,
369,
5942,
323,
3319,
13,
7456,
369,
828,
304,
18682,
11940,
61844,
10199,
627,
10464,
15964,
284,
314,
2118,
2042,
25860,
57633,
3082,
92,
2391,
10550,
9886,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-11 | Use runtime = {“db_engine”: True} during dataset creation.
Returns
List of Documents most similar to the query vector.
Return type
List[Document]
similarity_search_by_vector(embedding: Union[List[float], ndarray], k: int = 4, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Examples
>>> # Search using an embedding
>>> data = vector_store.similarity_search_by_vector(
... embedding=<your_embedding>,
... k=<num_items_to_return>,
... exec_option=<preferred_exec_option>,
... )
Parameters
embedding (Union[List[float], np.ndarray]) – Embedding to find similar docs.
k (int) – Number of Documents to return. Defaults to 4.
**kwargs – Additional keyword arguments including:
filter (Union[Dict, Callable], optional):
Additional filter before embedding search.
- Dict - Key-value search on tensors of htype json. True
if all key-value filters are satisfied.
Dict = {“tensor_name_1”: {“key”: value},
”tensor_name_2”: {“key”: value}}
Function - Any function compatible withdeeplake.filter.
Defaults to None.
exec_option (str): Options for search execution include”python”, “compute_engine”, or “tensor_db”. Defaults to
“python”.
- “python” - Pure-python implementation running on the client.
Can be used for data stored anywhere. WARNING: using this
option with big datasets is discouraged due to potential
memory issues.
”compute_engine” - Performant C++ implementation of the DeepLake Compute Engine. Runs on the client and can be used for
any data stored in or connected to Deep Lake. It cannot be
used with in-memory or local datasets. | [
10464,
15964,
284,
314,
2118,
2042,
25860,
57633,
3082,
92,
2391,
10550,
9886,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
5715,
955,
198,
861,
58,
7676,
933,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
9323,
53094,
96481,
1145,
67983,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
41481,
198,
20761,
674,
7694,
1701,
459,
40188,
198,
20761,
828,
284,
4724,
15153,
29716,
49325,
10947,
3795,
12526,
1021,
1131,
262,
40188,
39798,
22479,
52602,
12803,
1131,
262,
597,
39798,
2470,
12408,
2401,
12794,
12803,
1131,
262,
3969,
9869,
39798,
74586,
18937,
9869,
12803,
1131,
1763,
9905,
198,
95711,
320,
33758,
53094,
96481,
1145,
2660,
36649,
2526,
1389,
38168,
7113,
311,
1505,
4528,
27437,
627,
74,
320,
396,
8,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
24086,
16570,
6105,
2737,
512,
5428,
320,
33758,
58,
13755,
11,
54223,
1145,
10309,
997,
30119,
4141,
1603,
40188,
2778,
627,
12,
30226,
482,
5422,
19625,
2778,
389,
78187,
315,
305,
1337,
3024,
13,
3082,
198,
333,
682,
1401,
19625,
13711,
527,
20097,
627,
13755,
284,
314,
2118,
47211,
1292,
62,
16,
57633,
314,
2118,
798,
57633,
907,
1613,
863,
47211,
1292,
62,
17,
57633,
314,
2118,
798,
57633,
907,
11498,
5263,
482,
5884,
734,
18641,
449,
58994,
501,
731,
7081,
627,
16672,
311,
2290,
627,
12010,
9869,
320,
496,
1680,
14908,
369,
2778,
11572,
2997,
863,
12958,
9520,
1054,
28806,
25860,
9520,
477,
1054,
47211,
8856,
11453,
37090,
311,
198,
2118,
12958,
863,
627,
12,
1054,
12958,
863,
482,
30688,
73029,
8292,
4401,
389,
279,
3016,
627,
6854,
387,
1511,
369,
828,
9967,
12660,
13,
27577,
25,
1701,
420,
198,
2091,
449,
2466,
30525,
374,
64770,
4245,
311,
4754,
198,
17717,
4819,
627,
863,
28806,
25860,
863,
482,
26050,
519,
356,
1044,
8292,
315,
279,
18682,
82389,
23426,
8364,
13,
51090,
389,
279,
3016,
323,
649,
387,
1511,
369,
198,
3852,
828,
9967,
304,
477,
8599,
311,
18682,
11940,
13,
1102,
4250,
387,
198,
2656,
449,
304,
65196,
477,
2254,
30525,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-12 | used with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available
for data stored in the Deep Lake Managed Database.
To store datasets in this database, specify
runtime = {“db_engine”: True} during dataset creation.
distance_metric (str): L2 for Euclidean, L1 for Nuclear,max for L-infinity distance, cos for cosine similarity,
‘dot’ for dot product. Defaults to L2.
Returns
List of Documents most similar to the query vector.
Return type
List[Document]
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Run similarity search with Deep Lake with distance returned.
Examples:
>>> data = vector_store.similarity_search_with_score(
… query=<your_query>,
… embedding=<your_embedding_function>
… k=<number_of_items_to_return>,
… exec_option=<preferred_exec_option>,
… )
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults to 4. | [
2656,
449,
304,
65196,
477,
2254,
30525,
627,
863,
47211,
8856,
863,
482,
26050,
519,
11,
7373,
39689,
291,
61844,
27127,
10199,
8542,
43419,
369,
5942,
323,
3319,
11572,
13,
8442,
2561,
198,
2000,
828,
9967,
304,
279,
18682,
11940,
61844,
10199,
627,
1271,
3637,
30525,
304,
420,
4729,
11,
14158,
198,
23051,
284,
314,
2118,
2042,
25860,
57633,
3082,
92,
2391,
10550,
9886,
627,
19909,
42394,
320,
496,
1680,
445,
17,
369,
22730,
51178,
11,
445,
16,
369,
38544,
35951,
369,
445,
3502,
20482,
6138,
11,
8119,
369,
76359,
38723,
345,
14336,
16510,
529,
369,
13046,
2027,
13,
37090,
311,
445,
17,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
5715,
955,
198,
861,
58,
7676,
933,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
6869,
38723,
2778,
449,
18682,
11940,
449,
6138,
6052,
627,
41481,
512,
20761,
828,
284,
4724,
15153,
29716,
49325,
10947,
6753,
10622,
1021,
1981,
257,
3319,
39798,
22479,
5857,
12803,
1981,
257,
40188,
39798,
22479,
52602,
9353,
397,
1981,
257,
597,
39798,
4174,
3659,
12408,
2401,
12794,
12803,
1981,
257,
3969,
9869,
39798,
74586,
18937,
9869,
12803,
1981,
1763,
9905,
198,
1663,
320,
496,
8,
1389,
11615,
1495,
311,
2778,
369,
627,
74,
320,
396,
8,
1389,
5742,
315,
3135,
311,
471,
13,
37090,
311,
220,
19,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
68598a981156-13 | k (int) – Number of results to return. Defaults to 4.
**kwargs – Additional keyword arguments. Some of these arguments are:
distance_metric: L2 for Euclidean, L1 for Nuclear, max L-infinity
distance, cos for cosine similarity, ‘dot’ for dot product.
Defaults to L2.
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.embedding_function (Callable): Embedding function to use. Defaults
to None.
exec_option (str): DeepLakeVectorStore supports 3 ways to performsearching. It could be either “python”, “compute_engine” or
“tensor_db”. Defaults to “python”.
- “python” - Pure-python implementation running on the client.
Can be used for data stored anywhere. WARNING: using this
option with big datasets is discouraged due to potential
memory issues.
”compute_engine” - Performant C++ implementation of the DeepLake Compute Engine. Runs on the client and can be used for
any data stored in or connected to Deep Lake. It cannot be used
with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available for
data stored in the Deep Lake Managed Database. To store datasets
in this database, specify runtime = {“db_engine”: True}
during dataset creation.
Returns
List of documents most similar to the querytext with distance in float.
Return type
List[Tuple[Document, float]] | [
74,
320,
396,
8,
1389,
5742,
315,
3135,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
24086,
16570,
6105,
13,
4427,
315,
1521,
6105,
527,
512,
19909,
42394,
25,
445,
17,
369,
22730,
51178,
11,
445,
16,
369,
38544,
11,
1973,
445,
3502,
20482,
198,
19909,
11,
8119,
369,
76359,
38723,
11,
3451,
16510,
529,
369,
13046,
2027,
627,
16672,
311,
445,
17,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
5163,
1680,
12619,
555,
11408,
13,
37090,
311,
2290,
68714,
9353,
320,
41510,
1680,
38168,
7113,
734,
311,
1005,
13,
37090,
198,
998,
2290,
627,
12010,
9869,
320,
496,
1680,
18682,
82389,
3866,
6221,
11815,
220,
18,
5627,
311,
2804,
1874,
287,
13,
1102,
1436,
387,
3060,
1054,
12958,
9520,
1054,
28806,
25860,
863,
477,
198,
2118,
47211,
8856,
11453,
37090,
311,
1054,
12958,
863,
627,
12,
1054,
12958,
863,
482,
30688,
73029,
8292,
4401,
389,
279,
3016,
627,
6854,
387,
1511,
369,
828,
9967,
12660,
13,
27577,
25,
1701,
420,
198,
2091,
449,
2466,
30525,
374,
64770,
4245,
311,
4754,
198,
17717,
4819,
627,
863,
28806,
25860,
863,
482,
26050,
519,
356,
1044,
8292,
315,
279,
18682,
82389,
23426,
8364,
13,
51090,
389,
279,
3016,
323,
649,
387,
1511,
369,
198,
3852,
828,
9967,
304,
477,
8599,
311,
18682,
11940,
13,
1102,
4250,
387,
1511,
198,
4291,
304,
65196,
477,
2254,
30525,
627,
863,
47211,
8856,
863,
482,
26050,
519,
11,
7373,
39689,
291,
61844,
27127,
10199,
8542,
43419,
369,
5942,
323,
3319,
11572,
13,
8442,
2561,
369,
198,
695,
9967,
304,
279,
18682,
11940,
61844,
10199,
13,
2057,
3637,
30525,
198,
258,
420,
4729,
11,
14158,
15964,
284,
314,
2118,
2042,
25860,
57633,
3082,
534,
82977,
10550,
9886,
627,
16851,
198,
861,
315,
9477,
1455,
4528,
311,
279,
3319,
1342,
449,
6138,
304,
2273,
627,
5715,
955,
198,
861,
20961,
6189,
58,
7676,
11,
2273,
5163
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
8381a8230946-0 | langchain.vectorstores.redis.Redis¶
class langchain.vectorstores.redis.Redis(redis_url: str, index_name: str, embedding_function: ~typing.Callable, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', relevance_score_fn: ~typing.Optional[~typing.Callable[[float], float]] = <function _default_relevance_score>, **kwargs: ~typing.Any)[source]¶
Bases: VectorStore
Wrapper around Redis vector database.
To use, you should have the redis python package installed.
Example
from langchain.vectorstores import Redis
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Redis(
redis_url="redis://username:password@localhost:6379"
index_name="my-index",
embedding_function=embeddings.embed_query,
)
Initialize with necessary components.
Methods
__init__(redis_url, index_name, ...[, ...])
Initialize with necessary components.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, embeddings, ...])
Add more texts to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...]) | [
5317,
8995,
48203,
44569,
50979,
83498,
55609,
198,
1058,
8859,
8995,
48203,
44569,
50979,
83498,
98776,
2975,
25,
610,
11,
1963,
1292,
25,
610,
11,
40188,
9353,
25,
4056,
90902,
28115,
481,
11,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
4724,
3173,
25,
610,
284,
364,
1834,
12526,
518,
41961,
10622,
15604,
25,
4056,
90902,
37464,
58,
93,
90902,
28115,
481,
15873,
3733,
1145,
2273,
5163,
284,
366,
1723,
721,
2309,
1311,
33194,
10622,
8226,
3146,
9872,
25,
4056,
90902,
13614,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
35258,
4724,
4729,
627,
1271,
1005,
11,
499,
1288,
617,
279,
21540,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
35258,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
3295,
4412,
284,
35258,
1021,
262,
21540,
2975,
429,
22496,
1129,
5223,
25,
3918,
31,
8465,
25,
21788,
24,
702,
262,
1963,
1292,
429,
2465,
22214,
761,
262,
40188,
9353,
28,
12529,
25624,
41541,
5857,
345,
340,
10130,
449,
5995,
6956,
627,
18337,
198,
565,
2381,
3889,
22496,
2975,
11,
4194,
1275,
1292,
11,
4194,
1131,
38372,
4194,
1131,
2608,
10130,
449,
5995,
6956,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
12529,
25624,
11,
4194,
1131,
2608,
2261,
810,
22755,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-1 | amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids, **kwargs)
Delete a Redis entry.
drop_index(index_name, delete_documents, ...)
Drop a Redis search index.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_existing_index(embedding, index_name[, ...])
Connect to an existing Redis index.
from_texts(texts, embedding[, metadatas, ...])
Create a Redis vectorstore from raw documents. This is a user-friendly interface that: 1. Embeds documents. 2. Creates a new index for the embeddings in Redis. 3. Adds the documents to the newly created Redis index. This is intended to be a quick way to get started. .. rubric:: Example.
from_texts_return_keys(texts, embedding[, ...])
Create a Redis vectorstore from raw documents. This is a user-friendly interface that: 1. Embeds documents. 2. Creates a new index for the embeddings in Redis. 3. Adds the documents to the newly created Redis index. 4. Returns the keys of the newly created documents. This is intended to be a quick way to get started. .. rubric:: Example. | [
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
11,
4194,
334,
9872,
340,
6571,
264,
35258,
4441,
627,
6861,
3644,
7343,
1292,
11,
4194,
4644,
77027,
11,
4194,
32318,
20463,
264,
35258,
2778,
1963,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
63730,
3644,
50825,
7113,
11,
4194,
1275,
1292,
38372,
4194,
1131,
2608,
14953,
311,
459,
6484,
35258,
1963,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
4110,
264,
35258,
4724,
4412,
505,
7257,
9477,
13,
1115,
374,
264,
1217,
22658,
3834,
430,
25,
257,
220,
16,
13,
38168,
82,
9477,
13,
220,
17,
13,
15026,
264,
502,
1963,
369,
279,
71647,
304,
35258,
13,
220,
18,
13,
25483,
279,
9477,
311,
279,
13945,
3549,
35258,
1963,
13,
1115,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
13,
5354,
10485,
2265,
487,
13688,
627,
1527,
80746,
12794,
12919,
7383,
82,
11,
4194,
95711,
38372,
4194,
1131,
2608,
4110,
264,
35258,
4724,
4412,
505,
7257,
9477,
13,
1115,
374,
264,
1217,
22658,
3834,
430,
25,
257,
220,
16,
13,
38168,
82,
9477,
13,
220,
17,
13,
15026,
264,
502,
1963,
369,
279,
71647,
304,
35258,
13,
220,
18,
13,
25483,
279,
9477,
311,
279,
13945,
3549,
35258,
1963,
13,
220,
19,
13,
5295,
279,
7039,
315,
279,
13945,
3549,
9477,
13,
1115,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
13,
5354,
10485,
2265,
487,
13688,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-2 | max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Returns the most similar indexed documents to the query text.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_limit_score(query[, k, ...])
Returns the most similar indexed documents to the query text within the score_threshold range.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k])
Return docs most similar to query.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str] | [
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
16851,
279,
1455,
4528,
31681,
9477,
311,
279,
3319,
1495,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
15106,
10622,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
16851,
279,
1455,
4528,
31681,
9477,
311,
279,
3319,
1495,
2949,
279,
5573,
22616,
2134,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
60
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-3 | Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, embeddings: Optional[List[List[float]]] = None, batch_size: int = 1000, **kwargs: Any) → List[str][source]¶
Add more texts to the vectorstore.
Parameters
texts (Iterable[str]) – Iterable of strings/text to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
Defaults to None.
embeddings (Optional[List[List[float]]], optional) – Optional pre-generated
embeddings. Defaults to None.
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.
Returns
List of ids added to the vectorstore
Return type
List[str]
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance. | [
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
71647,
25,
12536,
53094,
53094,
96481,
5163,
60,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
1041,
15,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
2261,
810,
22755,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
320,
51735,
17752,
2526,
1389,
39116,
315,
9246,
37371,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
21128,
10309,
8,
1389,
12536,
1160,
315,
2322,
329,
19907,
627,
16672,
311,
2290,
627,
12529,
25624,
320,
15669,
53094,
53094,
96481,
5163,
1145,
10309,
8,
1389,
12536,
864,
16581,
198,
12529,
25624,
13,
37090,
311,
2290,
627,
10786,
320,
861,
17752,
2526,
477,
14483,
320,
861,
17752,
2526,
1389,
23322,
12099,
315,
10925,
627,
16672,
311,
2290,
627,
14377,
2424,
320,
396,
11,
10309,
8,
1389,
35004,
1404,
311,
1005,
369,
14238,
13,
37090,
311,
220,
1041,
15,
627,
16851,
198,
861,
315,
14483,
3779,
311,
279,
4724,
4412,
198,
5715,
955,
198,
861,
17752,
933,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-4 | Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → RedisVectorStoreRetriever[source]¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
static delete(ids: List[str], **kwargs: Any) → bool[source]¶
Delete a Redis entry.
Parameters
ids – List of ids (keys) to delete.
Returns
Whether or not the deletions were successful.
Return type
bool
static drop_index(index_name: str, delete_documents: bool, **kwargs: Any) → bool[source]¶
Drop a Redis search index.
Parameters
index_name (str) – Name of the index to drop.
delete_documents (bool) – Whether to drop the associated documents.
Returns
Whether or not the drop was successful.
Return type
bool | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
35258,
3866,
6221,
12289,
462,
2099,
76747,
60,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
2020,
3783,
44548,
25,
1796,
17752,
1145,
3146,
9872,
25,
5884,
8,
11651,
1845,
76747,
60,
55609,
198,
6571,
264,
35258,
4441,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
320,
10786,
8,
311,
3783,
627,
16851,
198,
25729,
477,
539,
279,
19825,
919,
1051,
6992,
627,
5715,
955,
198,
2707,
198,
2020,
6068,
3644,
7343,
1292,
25,
610,
11,
3783,
77027,
25,
1845,
11,
3146,
9872,
25,
5884,
8,
11651,
1845,
76747,
60,
55609,
198,
20463,
264,
35258,
2778,
1963,
627,
9905,
198,
1275,
1292,
320,
496,
8,
1389,
4076,
315,
279,
1963,
311,
6068,
627,
4644,
77027,
320,
2707,
8,
1389,
13440,
311,
6068,
279,
5938,
9477,
627,
16851,
198,
25729,
477,
539,
279,
6068,
574,
6992,
627,
5715,
955,
198,
2707
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-5 | Returns
Whether or not the drop was successful.
Return type
bool
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_existing_index(embedding: Embeddings, index_name: str, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', **kwargs: Any) → Redis[source]¶
Connect to an existing Redis index.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: Optional[str] = None, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', **kwargs: Any) → Redis[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 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: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: Optional[str] = None, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', distance_metric: Literal['COSINE', 'IP', 'L2'] = 'COSINE', **kwargs: Any) → Tuple[Redis, List[str]][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 Redis.
Adds the documents to the newly created Redis index. | [
16851,
198,
25729,
477,
539,
279,
6068,
574,
6992,
627,
5715,
955,
198,
2707,
198,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
63730,
3644,
50825,
7113,
25,
38168,
25624,
11,
1963,
1292,
25,
610,
11,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
4724,
3173,
25,
610,
284,
364,
1834,
12526,
518,
3146,
9872,
25,
5884,
8,
11651,
35258,
76747,
60,
55609,
198,
14953,
311,
459,
6484,
35258,
1963,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
1963,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
4724,
3173,
25,
610,
284,
364,
1834,
12526,
518,
3146,
9872,
25,
5884,
8,
11651,
35258,
76747,
60,
55609,
198,
4110,
264,
35258,
4724,
4412,
505,
7257,
9477,
627,
2028,
374,
264,
1217,
22658,
3834,
430,
512,
26566,
82,
9477,
627,
55968,
264,
502,
1963,
369,
279,
71647,
304,
35258,
627,
73211,
279,
9477,
311,
279,
13945,
3549,
35258,
1963,
627,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
497,
10485,
2265,
487,
13688,
198,
27853,
505,
80746,
12794,
12919,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
1963,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
4724,
3173,
25,
610,
284,
364,
1834,
12526,
518,
6138,
42394,
25,
50774,
681,
34,
3204,
4069,
518,
364,
3378,
518,
364,
43,
17,
663,
284,
364,
34,
3204,
4069,
518,
3146,
9872,
25,
5884,
8,
11651,
25645,
58,
49237,
11,
1796,
17752,
28819,
2484,
60,
55609,
198,
4110,
264,
35258,
4724,
4412,
505,
7257,
9477,
627,
2028,
374,
264,
1217,
22658,
3834,
430,
512,
26566,
82,
9477,
627,
55968,
264,
502,
1963,
369,
279,
71647,
304,
35258,
627,
73211,
279,
9477,
311,
279,
13945,
3549,
35258,
1963,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-6 | 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:: Example
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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. | [
73211,
279,
9477,
311,
279,
13945,
3549,
35258,
1963,
627,
16851,
279,
7039,
315,
279,
13945,
3549,
9477,
627,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
497,
10485,
2265,
487,
13688,
198,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-7 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
search(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
Returns the most similar indexed documents to the query text.
Parameters
query (str) – The query text for which to find similar documents.
k (int) – The number of documents to return. Default is 4.
Returns
A list of documents that are most similar to the query text.
Return type
List[Document]
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_limit_score(query: str, k: int = 4, score_threshold: float = 0.2, **kwargs: Any) → List[Document][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 return. Default is 4.
score_threshold (float) – The minimum matching score required for a document
0.2. (to be considered a match. Defaults to) –
similarity (Because the similarity calculation algorithm is based on cosine) –
:param :
:param the smaller the angle:
:param the higher the similarity.:
Returns | [
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
16851,
279,
1455,
4528,
31681,
9477,
311,
279,
3319,
1495,
627,
9905,
198,
1663,
320,
496,
8,
1389,
578,
3319,
1495,
369,
902,
311,
1505,
4528,
9477,
627,
74,
320,
396,
8,
1389,
578,
1396,
315,
9477,
311,
471,
13,
8058,
374,
220,
19,
627,
16851,
198,
32,
1160,
315,
9477,
430,
527,
1455,
4528,
311,
279,
3319,
1495,
627,
5715,
955,
198,
861,
58,
7676,
933,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
15106,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
5573,
22616,
25,
2273,
284,
220,
15,
13,
17,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
16851,
279,
1455,
4528,
31681,
9477,
311,
279,
3319,
1495,
2949,
279,
198,
12618,
22616,
2134,
627,
9905,
198,
1663,
320,
496,
8,
1389,
578,
3319,
1495,
369,
902,
311,
1505,
4528,
9477,
627,
74,
320,
396,
8,
1389,
578,
1396,
315,
9477,
311,
471,
13,
8058,
374,
220,
19,
627,
12618,
22616,
320,
3733,
8,
1389,
578,
8187,
12864,
5573,
2631,
369,
264,
2246,
198,
15,
13,
17,
13,
320,
998,
387,
6646,
264,
2489,
13,
37090,
311,
8,
1389,
720,
15124,
49325,
320,
18433,
279,
38723,
22702,
12384,
374,
3196,
389,
76359,
8,
1389,
720,
68416,
6394,
68416,
279,
9333,
279,
9392,
512,
68416,
279,
5190,
279,
38723,
13,
512,
16851
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
8381a8230946-8 | :param :
:param the smaller the angle:
:param the higher the similarity.:
Returns
A list of documents that are most similar to the query text,
including the match score for each document.
Return type
List[Document]
Note
If there are no documents that satisfy the score_threshold value,
an empty list is returned.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query and score for each | [
68416,
6394,
68416,
279,
9333,
279,
9392,
512,
68416,
279,
5190,
279,
38723,
13,
512,
16851,
198,
32,
1160,
315,
9477,
430,
527,
1455,
4528,
311,
279,
3319,
1495,
345,
16564,
279,
2489,
5573,
369,
1855,
2246,
627,
5715,
955,
198,
861,
58,
7676,
933,
9290,
198,
2746,
1070,
527,
912,
9477,
430,
27651,
279,
5573,
22616,
907,
345,
276,
4384,
1160,
374,
6052,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.redis.Redis.html |
b8bb6ef73da7-0 | langchain.vectorstores.singlestoredb.SingleStoreDBRetriever¶
class langchain.vectorstores.singlestoredb.SingleStoreDBRetriever(*, vectorstore: SingleStoreDB, search_type: str = 'similarity', search_kwargs: dict = None, k: int = 4)[source]¶
Bases: VectorStoreRetriever
Retriever for SingleStoreDB vector stores.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param k: int = 4¶
param search_kwargs: dict [Optional]¶
param search_type: str = 'similarity'¶
param vectorstore: langchain.vectorstores.singlestoredb.SingleStoreDB [Required]¶
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Add documents to vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Add documents to vectorstore.
async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, **kwargs: Any) → List[Document]¶
Asynchronously get documents relevant to a query.
:param query: string to find relevant documents for
:param callbacks: Callback manager or list of callbacks
Returns
List of relevant documents
get_relevant_documents(query: str, *, callbacks: Callbacks = None, **kwargs: Any) → List[Document]¶
Retrieve documents relevant to a query.
:param query: string to find relevant documents for
:param callbacks: Callback manager or list of callbacks
Returns
List of relevant documents
validator validate_search_type » all fields¶
Validate search type.
allowed_search_types: ClassVar[Collection[str]] = ('similarity',)¶
model Config¶
Bases: object | [
5317,
8995,
48203,
44569,
33401,
4412,
2042,
23993,
6221,
3590,
12289,
462,
2099,
55609,
198,
1058,
8859,
8995,
48203,
44569,
33401,
4412,
2042,
23993,
6221,
3590,
12289,
462,
2099,
4163,
11,
4724,
4412,
25,
11579,
6221,
3590,
11,
2778,
1857,
25,
610,
284,
364,
15124,
49325,
518,
2778,
37335,
25,
6587,
284,
2290,
11,
597,
25,
528,
284,
220,
19,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
12289,
462,
2099,
198,
12289,
462,
2099,
369,
11579,
6221,
3590,
4724,
10756,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
597,
25,
528,
284,
220,
19,
55609,
198,
913,
2778,
37335,
25,
6587,
510,
15669,
60,
55609,
198,
913,
2778,
1857,
25,
610,
284,
364,
15124,
49325,
6,
55609,
198,
913,
4724,
4412,
25,
8859,
8995,
48203,
44569,
33401,
4412,
2042,
23993,
6221,
3590,
510,
8327,
60,
55609,
198,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
2261,
9477,
311,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
2261,
9477,
311,
4724,
4412,
627,
7847,
264,
456,
1311,
8532,
77027,
10974,
25,
610,
11,
12039,
27777,
25,
23499,
82,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
2170,
55294,
636,
9477,
9959,
311,
264,
3319,
627,
68416,
3319,
25,
925,
311,
1505,
9959,
9477,
369,
198,
68416,
27777,
25,
23499,
6783,
477,
1160,
315,
27777,
198,
16851,
198,
861,
315,
9959,
9477,
198,
456,
1311,
8532,
77027,
10974,
25,
610,
11,
12039,
27777,
25,
23499,
82,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
88765,
9477,
9959,
311,
264,
3319,
627,
68416,
3319,
25,
925,
311,
1505,
9959,
9477,
369,
198,
68416,
27777,
25,
23499,
6783,
477,
1160,
315,
27777,
198,
16851,
198,
861,
315,
9959,
9477,
198,
16503,
9788,
10947,
1857,
4194,
8345,
4194,
682,
5151,
55609,
198,
18409,
2778,
955,
627,
21642,
10947,
9962,
25,
3308,
4050,
58,
6618,
17752,
5163,
284,
4417,
15124,
49325,
518,
8,
55609,
198,
2590,
5649,
55609,
198,
33,
2315,
25,
1665
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDBRetriever.html |
b8bb6ef73da7-1 | model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDBRetriever.html |
dcad6a77d565-0 | langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch¶
class langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch(embedding: Embeddings, config: AlibabaCloudOpenSearchSettings, **kwargs: Any)[source]¶
Bases: VectorStore
Alibaba Cloud OpenSearch Vector Store
Methods
__init__(embedding, config, **kwargs)
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
create_results(json_result)
create_results_with_score(json_result)
delete(ids)
Delete by vector ID. | [
5317,
8995,
48203,
44569,
49762,
12641,
10499,
1137,
1132,
885,
2808,
12273,
16440,
5109,
6014,
55609,
198,
1058,
8859,
8995,
48203,
44569,
49762,
12641,
10499,
1137,
1132,
885,
2808,
12273,
16440,
5109,
6014,
50825,
7113,
25,
38168,
25624,
11,
2242,
25,
55464,
16440,
5109,
6014,
6214,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
2149,
29360,
15161,
5377,
6014,
4290,
9307,
198,
18337,
198,
565,
2381,
3889,
95711,
11,
4194,
1710,
11,
4194,
334,
9872,
340,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
3261,
13888,
9488,
5400,
340,
3261,
13888,
6753,
10622,
9488,
5400,
340,
4644,
44548,
340,
6571,
555,
4724,
3110,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
dcad6a77d565-1 | create_results_with_score(json_result)
delete(ids)
Delete by vector ID.
from_documents(documents, embedding[, ids, ...])
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, config])
Return VectorStore initialized from texts and embeddings.
inner_embedding_query(embedding[, ...])
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, search_filter])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k, ...])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns | [
3261,
13888,
6753,
10622,
9488,
5400,
340,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
38372,
4194,
3447,
11,
4194,
1131,
2608,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1710,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
4481,
52602,
5857,
50825,
7113,
38372,
4194,
1131,
2608,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
1874,
8901,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
dcad6a77d565-2 | (List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
kwargs – vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type. | [
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
9872,
1389,
4724,
4412,
3230,
5137,
198,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
dcad6a77d565-3 | Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
create_results(json_result: Dict[str, Any]) → List[Document][source]¶
create_results_with_score(json_result: Dict[str, Any]) → List[Tuple[Document, float]][source]¶
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, ids: Optional[List[str]] = None, config: Optional[AlibabaCloudOpenSearchSettings] = None, **kwargs: Any) → AlibabaCloudOpenSearch[source]¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, config: Optional[AlibabaCloudOpenSearchSettings] = None, **kwargs: Any) → AlibabaCloudOpenSearch[source]¶
Return VectorStore initialized from texts and embeddings.
inner_embedding_query(embedding: List[float], search_filter: Optional[Dict[str, Any]] = None, k: int = 4) → Dict[str, Any][source]¶ | [
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
3261,
13888,
9488,
5400,
25,
30226,
17752,
11,
5884,
2526,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
3261,
13888,
6753,
10622,
9488,
5400,
25,
30226,
17752,
11,
5884,
2526,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2242,
25,
12536,
58,
2149,
29360,
16440,
5109,
6014,
6214,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
55464,
16440,
5109,
6014,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
2242,
25,
12536,
58,
2149,
29360,
16440,
5109,
6014,
6214,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
55464,
16440,
5109,
6014,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
4481,
52602,
5857,
50825,
7113,
25,
1796,
96481,
1145,
2778,
8901,
25,
12536,
58,
13755,
17752,
11,
5884,
5163,
284,
2290,
11,
597,
25,
528,
284,
220,
19,
8,
11651,
30226,
17752,
11,
5884,
1483,
2484,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
dcad6a77d565-4 | max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type. | [
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
dcad6a77d565-5 | Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, search_filter: Optional[Dict[str, Any]] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
similarity_search_by_vector(embedding: List[float], k: int = 4, search_filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, search_filter: Optional[dict] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score) | [
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
2778,
8901,
25,
12536,
58,
13755,
17752,
11,
5884,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
2778,
8901,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
2778,
8901,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch.html |
f56c341e9333-0 | langchain.vectorstores.base.VectorStoreRetriever¶
class langchain.vectorstores.base.VectorStoreRetriever(*, vectorstore: VectorStore, search_type: str = 'similarity', search_kwargs: dict = None)[source]¶
Bases: BaseRetriever, BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param search_kwargs: dict [Optional]¶
param search_type: str = 'similarity'¶
param vectorstore: langchain.vectorstores.base.VectorStore [Required]¶
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str][source]¶
Add documents to vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str][source]¶
Add documents to vectorstore.
async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, **kwargs: Any) → List[Document]¶
Asynchronously get documents relevant to a query.
:param query: string to find relevant documents for
:param callbacks: Callback manager or list of callbacks
Returns
List of relevant documents
get_relevant_documents(query: str, *, callbacks: Callbacks = None, **kwargs: Any) → List[Document]¶
Retrieve documents relevant to a query.
:param query: string to find relevant documents for
:param callbacks: Callback manager or list of callbacks
Returns
List of relevant documents
validator validate_search_type » all fields[source]¶
Validate search type.
allowed_search_types: ClassVar[Collection[str]] = ('similarity', 'similarity_score_threshold', 'mmr')¶
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
5317,
8995,
48203,
44569,
9105,
14621,
6221,
12289,
462,
2099,
55609,
198,
1058,
8859,
8995,
48203,
44569,
9105,
14621,
6221,
12289,
462,
2099,
4163,
11,
4724,
4412,
25,
4290,
6221,
11,
2778,
1857,
25,
610,
284,
364,
15124,
49325,
518,
2778,
37335,
25,
6587,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
12289,
462,
2099,
11,
65705,
198,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
2778,
37335,
25,
6587,
510,
15669,
60,
55609,
198,
913,
2778,
1857,
25,
610,
284,
364,
15124,
49325,
6,
55609,
198,
913,
4724,
4412,
25,
8859,
8995,
48203,
44569,
9105,
14621,
6221,
510,
8327,
60,
55609,
198,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
2261,
9477,
311,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
2261,
9477,
311,
4724,
4412,
627,
7847,
264,
456,
1311,
8532,
77027,
10974,
25,
610,
11,
12039,
27777,
25,
23499,
82,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
2170,
55294,
636,
9477,
9959,
311,
264,
3319,
627,
68416,
3319,
25,
925,
311,
1505,
9959,
9477,
369,
198,
68416,
27777,
25,
23499,
6783,
477,
1160,
315,
27777,
198,
16851,
198,
861,
315,
9959,
9477,
198,
456,
1311,
8532,
77027,
10974,
25,
610,
11,
12039,
27777,
25,
23499,
82,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
88765,
9477,
9959,
311,
264,
3319,
627,
68416,
3319,
25,
925,
311,
1505,
9959,
9477,
369,
198,
68416,
27777,
25,
23499,
6783,
477,
1160,
315,
27777,
198,
16851,
198,
861,
315,
9959,
9477,
198,
16503,
9788,
10947,
1857,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
18409,
2778,
955,
627,
21642,
10947,
9962,
25,
3308,
4050,
58,
6618,
17752,
5163,
284,
4417,
15124,
49325,
518,
364,
15124,
49325,
10622,
22616,
518,
364,
3906,
81,
873,
55609,
198,
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.base.VectorStoreRetriever.html |
96791fb04925-0 | langchain.vectorstores.lancedb.LanceDB¶
class langchain.vectorstores.lancedb.LanceDB(connection: Any, embedding: Embeddings, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text')[source]¶
Bases: VectorStore
Wrapper around LanceDB vector database.
To use, you should have lancedb python package installed.
Example
db = lancedb.connect('./lancedb')
table = db.open_table('my_table')
vectorstore = LanceDB(table, embedding_function)
vectorstore.add_texts(['text1', 'text2'])
result = vectorstore.similarity_search('text1')
Initialize with Lance DB connection
Methods
__init__(connection, embedding[, ...])
Initialize with Lance DB connection
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids])
Turn texts into embedding and add it to the database
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs) | [
5317,
8995,
48203,
44569,
929,
4979,
65,
1236,
685,
3590,
55609,
198,
1058,
8859,
8995,
48203,
44569,
929,
4979,
65,
1236,
685,
3590,
25119,
25,
5884,
11,
40188,
25,
38168,
25624,
11,
4724,
3173,
25,
12536,
17752,
60,
284,
364,
3295,
518,
887,
3173,
25,
12536,
17752,
60,
284,
364,
307,
518,
1495,
3173,
25,
12536,
17752,
60,
284,
364,
1342,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
50031,
3590,
4724,
4729,
627,
1271,
1005,
11,
499,
1288,
617,
326,
4979,
65,
10344,
6462,
10487,
627,
13617,
198,
2042,
284,
326,
4979,
65,
11034,
8447,
75,
4979,
65,
1329,
2048,
284,
3000,
5949,
5350,
493,
2465,
5350,
1329,
3295,
4412,
284,
50031,
3590,
16138,
11,
40188,
9353,
340,
3295,
4412,
1388,
80746,
6561,
1342,
16,
518,
364,
1342,
17,
7519,
1407,
284,
4724,
4412,
29716,
49325,
10947,
493,
1342,
16,
1329,
10130,
449,
50031,
6078,
3717,
198,
18337,
198,
565,
2381,
3889,
7898,
11,
4194,
95711,
38372,
4194,
1131,
2608,
10130,
449,
50031,
6078,
3717,
198,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
2608,
19952,
22755,
1139,
40188,
323,
923,
433,
311,
279,
4729,
198,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
96791fb04925-1 | asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids)
Delete by vector ID.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Return VectorStore initialized from texts and embeddings.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k])
Return documents most similar to the query
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore. | [
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
9477,
1455,
4528,
311,
279,
3319,
198,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
96791fb04925-2 | Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶
Turn texts into embedding and add it to the database
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts.
Returns
List of ids of the added texts.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶ | [
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
19952,
22755,
1139,
40188,
323,
923,
433,
311,
279,
4729,
198,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
16851,
198,
861,
315,
14483,
315,
279,
3779,
22755,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
96791fb04925-3 | Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str]) → Optional[bool]¶
Delete by vector ID.
Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, connection: Any = None, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text', **kwargs: Any) → LanceDB[source]¶
Return VectorStore initialized from texts and embeddings. | [
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
2526,
11651,
12536,
58,
2707,
60,
55609,
198,
6571,
555,
4724,
3110,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
16851,
198,
2575,
422,
37166,
374,
6992,
345,
4139,
6062,
11,
2290,
422,
539,
11798,
627,
5715,
955,
198,
15669,
58,
2707,
933,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3717,
25,
5884,
284,
2290,
11,
4724,
3173,
25,
12536,
17752,
60,
284,
364,
3295,
518,
887,
3173,
25,
12536,
17752,
60,
284,
364,
307,
518,
1495,
3173,
25,
12536,
17752,
60,
284,
364,
1342,
518,
3146,
9872,
25,
5884,
8,
11651,
50031,
3590,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
96791fb04925-4 | Return VectorStore initialized from texts and embeddings.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type. | [
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
96791fb04925-5 | Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document][source]¶
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.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score) | [
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
9477,
1455,
4528,
311,
279,
3319,
198,
9905,
198,
1663,
1389,
935,
311,
3319,
279,
4724,
4412,
449,
627,
74,
1389,
5742,
315,
9477,
311,
471,
627,
16851,
198,
861,
315,
9477,
1455,
4528,
311,
279,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html |
0599d060c1dd-0 | langchain.vectorstores.pinecone.Pinecone¶
class langchain.vectorstores.pinecone.Pinecone(index: Any, embedding_function: Callable, text_key: str, namespace: Optional[str] = None)[source]¶
Bases: VectorStore
Wrapper around Pinecone vector database.
To use, you should have the pinecone-client python package installed.
Example
from langchain.vectorstores import Pinecone
from langchain.embeddings.openai 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="...")
index = pinecone.Index("langchain-demo")
embeddings = OpenAIEmbeddings()
vectorstore = Pinecone(index, embeddings.embed_query, "text")
Initialize with Pinecone client.
Methods
__init__(index, embedding_function, text_key)
Initialize with Pinecone client.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids, ...])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...) | [
5317,
8995,
48203,
44569,
558,
483,
59182,
1087,
483,
59182,
55609,
198,
1058,
8859,
8995,
48203,
44569,
558,
483,
59182,
1087,
483,
59182,
7343,
25,
5884,
11,
40188,
9353,
25,
54223,
11,
1495,
3173,
25,
610,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
42609,
59182,
4724,
4729,
627,
1271,
1005,
11,
499,
1288,
617,
279,
34697,
59182,
31111,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
42609,
59182,
198,
1527,
8859,
8995,
41541,
25624,
5949,
2192,
1179,
5377,
15836,
26566,
25624,
198,
475,
34697,
59182,
198,
2,
578,
4676,
1288,
387,
279,
832,
5300,
1828,
311,
279,
5446,
1401,
198,
2,
304,
701,
42609,
59182,
2393,
198,
39138,
59182,
8435,
25865,
3173,
429,
12488,
498,
4676,
429,
34193,
1275,
284,
34697,
59182,
18844,
446,
5317,
8995,
59993,
1158,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
3295,
4412,
284,
42609,
59182,
7343,
11,
71647,
41541,
5857,
11,
330,
1342,
1158,
10130,
449,
42609,
59182,
3016,
627,
18337,
198,
565,
2381,
3889,
1275,
11,
4194,
95711,
9353,
11,
4194,
1342,
3173,
340,
10130,
449,
42609,
59182,
3016,
627,
64,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
80746,
7383,
82,
38372,
4194,
4150,
329,
19907,
11,
4194,
3447,
11,
4194,
1131,
2608,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
64,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
64,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
48627
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-1 | amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)
asearch(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
asimilarity_search(query[, k])
Return docs most similar to query.
asimilarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete(ids[, namespace])
Delete by vector IDs.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_existing_index(index_name, embedding[, ...])
Load pinecone vectorstore from index name.
from_texts(texts, embedding[, metadatas, ...])
Construct Pinecone wrapper from raw documents.
max_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter, namespace])
Return pinecone documents most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, ...])
Return pinecone documents most similar to query, along with scores.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶ | [
90727,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
340,
521,
1132,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
300,
318,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
300,
318,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
300,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
38372,
4194,
2280,
2608,
6571,
555,
4724,
29460,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
11,
4194,
334,
9872,
340,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
63730,
3644,
7343,
1292,
11,
4194,
95711,
38372,
4194,
1131,
2608,
6003,
34697,
59182,
4724,
4412,
505,
1963,
836,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
29568,
42609,
59182,
13564,
505,
7257,
9477,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
73893,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
1874,
10974,
11,
4194,
1874,
1857,
11,
4194,
334,
9872,
340,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
11,
4194,
2280,
2608,
5715,
34697,
59182,
9477,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
11,
4194,
1131,
2608,
5715,
34697,
59182,
9477,
1455,
4528,
311,
3319,
11,
3235,
449,
12483,
627,
7847,
264,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-2 | Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
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]¶
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, namespace: Optional[str] = None, batch_size: int = 32, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts.
namespace – Optional pinecone namespace to add the texts to.
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶
Return VectorStore initialized from texts and embeddings. | [
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
7847,
264,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
723,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
60,
55609,
198,
6869,
810,
9477,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
10490,
58,
7676,
60,
320,
51878,
8,
1389,
45890,
311,
923,
311,
279,
4724,
4412,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
627,
5715,
955,
198,
861,
17752,
933,
723,
80746,
7383,
82,
25,
39116,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
843,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
6869,
810,
22755,
1555,
279,
71647,
323,
923,
311,
279,
4724,
4412,
627,
9905,
198,
87042,
1389,
39116,
315,
9246,
311,
923,
311,
279,
4724,
4412,
627,
4150,
329,
19907,
1389,
12536,
1160,
315,
2322,
329,
19907,
5938,
449,
279,
22755,
627,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
2280,
1389,
12536,
34697,
59182,
4573,
311,
923,
279,
22755,
311,
627,
16851,
198,
861,
315,
14483,
505,
7999,
279,
22755,
1139,
279,
4724,
4412,
627,
7847,
538,
4492,
264,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
7847,
538,
4492,
264,
1527,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-3 | 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[Document]¶
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) → VectorStoreRetriever¶
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most similar to query.
delete(ids: List[str], namespace: Optional[str] = None) → None[source]¶
Delete by vector IDs.
:param ids: List of ids to delete.
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings. | [
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
7847,
1097,
710,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
300,
1311,
9104,
424,
22551,
9872,
25,
5884,
8,
11651,
4290,
6221,
12289,
462,
2099,
55609,
198,
7847,
264,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
7847,
439,
318,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
7847,
439,
318,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
7847,
439,
318,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
627,
4644,
44548,
25,
1796,
17752,
1145,
4573,
25,
12536,
17752,
60,
284,
2290,
8,
11651,
2290,
76747,
60,
55609,
198,
6571,
555,
4724,
29460,
627,
68416,
14483,
25,
1796,
315,
14483,
311,
3783,
627,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
3146,
9872,
25,
5884,
8,
11651,
650,
790,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-4 | Return VectorStore initialized from documents and embeddings.
classmethod from_existing_index(index_name: str, embedding: Embeddings, text_key: str = 'text', namespace: Optional[str] = None) → Pinecone[source]¶
Load pinecone vectorstore from index name.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_size: int = 32, text_key: str = 'text', index_name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) → Pinecone[source]¶
Construct Pinecone wrapper from raw documents.
This is a user friendly interface that:
Embeds documents.
Adds the documents to a provided Pinecone index
This is intended to be a quick way to get started.
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,
embeddings,
index_name="langchain-demo"
)
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[dict] = None, namespace: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4. | [
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
63730,
3644,
7343,
1292,
25,
610,
11,
40188,
25,
38168,
25624,
11,
1495,
3173,
25,
610,
284,
364,
1342,
518,
4573,
25,
12536,
17752,
60,
284,
2290,
8,
11651,
42609,
59182,
76747,
60,
55609,
198,
6003,
34697,
59182,
4724,
4412,
505,
1963,
836,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
843,
11,
1495,
3173,
25,
610,
284,
364,
1342,
518,
1963,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
42609,
59182,
76747,
60,
55609,
198,
29568,
42609,
59182,
13564,
505,
7257,
9477,
627,
2028,
374,
264,
1217,
11919,
3834,
430,
512,
26566,
82,
9477,
627,
73211,
279,
9477,
311,
264,
3984,
42609,
59182,
1963,
198,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
13617,
198,
1527,
8859,
8995,
1179,
42609,
59182,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
475,
34697,
59182,
198,
2,
578,
4676,
1288,
387,
279,
832,
5300,
1828,
311,
279,
5446,
1401,
198,
2,
304,
701,
42609,
59182,
2393,
198,
39138,
59182,
8435,
25865,
3173,
429,
12488,
498,
4676,
429,
34193,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
39138,
59182,
284,
42609,
59182,
6521,
80746,
1021,
262,
22755,
345,
262,
71647,
345,
262,
1963,
1292,
429,
5317,
8995,
59993,
702,
340,
2880,
722,
867,
992,
1311,
33194,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-5 | k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[dict] = None, namespace: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 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[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return pinecone documents most similar to query.
Parameters
query – Text to look up documents similar to. | [
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
2880,
722,
867,
992,
1311,
33194,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
7963,
4803,
25,
528,
284,
220,
508,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
4183,
1701,
279,
54229,
32873,
41961,
627,
6102,
2931,
32873,
41961,
7706,
4861,
369,
38723,
311,
3319,
3651,
20057,
198,
77405,
4183,
9477,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
13231,
27386,
1389,
5742,
1990,
220,
15,
323,
220,
16,
430,
27667,
279,
8547,
198,
1073,
20057,
4315,
279,
3135,
449,
220,
15,
12435,
198,
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
1701,
5300,
2778,
955,
627,
15124,
49325,
10947,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
34697,
59182,
9477,
1455,
4528,
311,
3319,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
0599d060c1dd-6 | Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – Dictionary of argument(s) to filter on metadata
namespace – Namespace to search in. Default will search in ‘’ namespace.
Returns
List of Documents most similar to the query and score for each
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – 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
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None) → List[Tuple[Document, float]][source]¶
Return pinecone 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 4.
filter – Dictionary of argument(s) to filter on metadata | [
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
10685,
315,
5811,
1161,
8,
311,
4141,
389,
11408,
198,
2280,
1389,
43062,
311,
2778,
304,
13,
8058,
690,
2778,
304,
3451,
529,
4573,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
40188,
4724,
627,
9905,
198,
95711,
1389,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
627,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
5163,
55609,
198,
5715,
27437,
323,
41961,
12483,
304,
279,
2134,
510,
15,
11,
220,
16,
27218,
15,
374,
14091,
79962,
11,
220,
16,
374,
1455,
4528,
627,
9905,
198,
1663,
1389,
1988,
1495,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
334,
9872,
1389,
16901,
311,
387,
5946,
311,
38723,
2778,
13,
12540,
2997,
512,
12618,
22616,
25,
12536,
11,
264,
19596,
1486,
907,
1990,
220,
15,
311,
220,
16,
311,
198,
5428,
279,
13239,
743,
315,
31503,
27437,
198,
16851,
198,
861,
315,
350,
29423,
315,
320,
5349,
11,
38723,
10622,
340,
15124,
49325,
10947,
6753,
10622,
10974,
25,
610,
11,
597,
25,
528,
284,
220,
19,
11,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
11,
4573,
25,
12536,
17752,
60,
284,
2290,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
34697,
59182,
9477,
1455,
4528,
311,
3319,
11,
3235,
449,
12483,
627,
9905,
198,
1663,
1389,
2991,
311,
1427,
709,
9477,
4528,
311,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
5428,
1389,
10685,
315,
5811,
1161,
8,
311,
4141,
389,
11408
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.