id
stringlengths 14
15
| text
stringlengths 35
2.07k
| embedding
sequence | source
stringlengths 61
154
|
---|---|---|---|
0599d060c1dd-7 | 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 | [
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html |
f4c96c87161a-0 | langchain.vectorstores.utils.maximal_marginal_relevance¶
langchain.vectorstores.utils.maximal_marginal_relevance(query_embedding: ndarray, embedding_list: list, lambda_mult: float = 0.5, k: int = 4) → List[int][source]¶
Calculate maximal marginal relevance. | [
5317,
8995,
48203,
44569,
8576,
6817,
2931,
722,
867,
992,
1311,
33194,
55609,
198,
5317,
8995,
48203,
44569,
8576,
6817,
2931,
722,
867,
992,
1311,
33194,
10974,
52602,
25,
67983,
11,
40188,
2062,
25,
1160,
11,
12741,
27386,
25,
2273,
284,
220,
15,
13,
20,
11,
597,
25,
528,
284,
220,
19,
8,
11651,
1796,
19155,
1483,
2484,
60,
55609,
198,
48966,
54229,
32873,
41961,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.utils.maximal_marginal_relevance.html |
7242d2d1de15-0 | langchain.vectorstores.singlestoredb.DistanceStrategy¶
class langchain.vectorstores.singlestoredb.DistanceStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases: str, Enum
Enumerator of the Distance strategies for SingleStoreDB.
Methods
__init__(*args, **kwds)
capitalize()
Return a capitalized version of the string.
casefold()
Return a version of the string suitable for caseless comparisons.
center(width[, fillchar])
Return a centered string of length width.
count(sub[, start[, end]])
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
encode([encoding, errors])
Encode the string using the codec registered for encoding.
endswith(suffix[, start[, end]])
Return True if S ends with the specified suffix, False otherwise.
expandtabs([tabsize])
Return a copy where all tab characters are expanded using spaces.
find(sub[, start[, end]])
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
format(*args, **kwargs)
Return a formatted version of S, using substitutions from args and kwargs.
format_map(mapping)
Return a formatted version of S, using substitutions from mapping.
index(sub[, start[, end]])
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
isalnum()
Return True if the string is an alpha-numeric string, False otherwise.
isalpha()
Return True if the string is an alphabetic string, False otherwise.
isascii()
Return True if all characters in the string are ASCII, False otherwise.
isdecimal() | [
5317,
8995,
48203,
44569,
33401,
4412,
2042,
53308,
20403,
55609,
198,
1058,
8859,
8995,
48203,
44569,
33401,
4412,
2042,
53308,
20403,
3764,
11,
5144,
5980,
11,
12039,
4793,
5980,
11,
5965,
609,
5980,
11,
955,
5980,
11,
1212,
28,
16,
11,
19254,
5980,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
610,
11,
14416,
198,
10679,
315,
279,
32235,
15174,
369,
11579,
6221,
3590,
627,
18337,
198,
565,
2381,
69106,
2164,
11,
4194,
334,
29700,
5469,
340,
82441,
746,
5715,
264,
98421,
2373,
315,
279,
925,
627,
5756,
20557,
746,
5715,
264,
2373,
315,
279,
925,
14791,
369,
1162,
1752,
36595,
627,
3133,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
31288,
925,
315,
3160,
2430,
627,
1868,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
1396,
315,
2536,
29352,
91719,
57115,
315,
39549,
1207,
304,
925,
328,
29563,
26874,
27218,
6311,
2625,
17600,
11,
4194,
7805,
2608,
33635,
279,
925,
1701,
279,
35747,
9879,
369,
11418,
627,
1438,
4291,
97566,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
3082,
422,
328,
10548,
449,
279,
5300,
21166,
11,
3641,
6062,
627,
33417,
32093,
2625,
6323,
2190,
2608,
5715,
264,
3048,
1405,
682,
5769,
5885,
527,
17626,
1701,
12908,
627,
3990,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
2293,
4163,
2164,
11,
4194,
334,
9872,
340,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
2897,
323,
16901,
627,
2293,
5489,
82157,
340,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
13021,
627,
1275,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
285,
94462,
746,
5715,
3082,
422,
279,
925,
374,
459,
8451,
12,
20173,
925,
11,
3641,
6062,
627,
285,
7288,
746,
5715,
3082,
422,
279,
925,
374,
459,
65695,
45938,
925,
11,
3641,
6062,
627,
285,
24207,
746,
5715,
3082,
422,
682,
5885,
304,
279,
925,
527,
40416,
11,
3641,
6062,
627,
285,
24170,
368
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-1 | Return True if all characters in the string are ASCII, False otherwise.
isdecimal()
Return True if the string is a decimal string, False otherwise.
isdigit()
Return True if the string is a digit string, False otherwise.
isidentifier()
Return True if the string is a valid Python identifier, False otherwise.
islower()
Return True if the string is a lowercase string, False otherwise.
isnumeric()
Return True if the string is a numeric string, False otherwise.
isprintable()
Return True if the string is printable, False otherwise.
isspace()
Return True if the string is a whitespace string, False otherwise.
istitle()
Return True if the string is a title-cased string, False otherwise.
isupper()
Return True if the string is an uppercase string, False otherwise.
join(iterable, /)
Concatenate any number of strings.
ljust(width[, fillchar])
Return a left-justified string of length width.
lower()
Return a copy of the string converted to lowercase.
lstrip([chars])
Return a copy of the string with leading whitespace removed.
maketrans
Return a translation table usable for str.translate().
partition(sep, /)
Partition the string into three parts using the given separator.
removeprefix(prefix, /)
Return a str with the given prefix string removed if present.
removesuffix(suffix, /)
Return a str with the given suffix string removed if present.
replace(old, new[, count])
Return a copy with all occurrences of substring old replaced by new.
rfind(sub[, start[, end]])
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindex(sub[, start[, end]]) | [
5715,
3082,
422,
682,
5885,
304,
279,
925,
527,
40416,
11,
3641,
6062,
627,
285,
24170,
746,
5715,
3082,
422,
279,
925,
374,
264,
12395,
925,
11,
3641,
6062,
627,
70929,
746,
5715,
3082,
422,
279,
925,
374,
264,
16099,
925,
11,
3641,
6062,
627,
285,
16288,
746,
5715,
3082,
422,
279,
925,
374,
264,
2764,
13325,
13110,
11,
3641,
6062,
627,
285,
15115,
746,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
627,
285,
20173,
746,
5715,
3082,
422,
279,
925,
374,
264,
25031,
925,
11,
3641,
6062,
627,
285,
1374,
481,
746,
5715,
3082,
422,
279,
925,
374,
43095,
11,
3641,
6062,
627,
82870,
746,
5715,
3082,
422,
279,
925,
374,
264,
37472,
925,
11,
3641,
6062,
627,
380,
1017,
746,
5715,
3082,
422,
279,
925,
374,
264,
2316,
1824,
1503,
925,
11,
3641,
6062,
627,
285,
13886,
746,
5715,
3082,
422,
279,
925,
374,
459,
40582,
925,
11,
3641,
6062,
627,
6115,
28169,
481,
11,
4194,
54660,
79540,
32223,
904,
1396,
315,
9246,
627,
75,
4345,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
2163,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
15115,
746,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
627,
75,
13406,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
6522,
37472,
7108,
627,
49662,
17820,
598,
198,
5715,
264,
14807,
2007,
41030,
369,
610,
26998,
26914,
42098,
10698,
79,
11,
4194,
54660,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
5514,
12113,
30018,
11,
4194,
54660,
5715,
264,
610,
449,
279,
2728,
9436,
925,
7108,
422,
3118,
627,
1864,
10296,
13866,
97566,
11,
4194,
54660,
5715,
264,
610,
449,
279,
2728,
21166,
925,
7108,
422,
3118,
627,
8319,
22739,
11,
4194,
943,
38372,
4194,
1868,
2608,
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
627,
81,
3990,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
81,
1275,
10849,
38372,
4194,
2527,
38372,
4194,
408,
30716
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-2 | rindex(sub[, start[, end]])
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rjust(width[, fillchar])
Return a right-justified string of length width.
rpartition(sep, /)
Partition the string into three parts using the given separator.
rsplit([sep, maxsplit])
Return a list of the substrings in the string, using sep as the separator string.
rstrip([chars])
Return a copy of the string with trailing whitespace removed.
split([sep, maxsplit])
Return a list of the substrings in the string, using sep as the separator string.
splitlines([keepends])
Return a list of the lines in the string, breaking at line boundaries.
startswith(prefix[, start[, end]])
Return True if S starts with the specified prefix, False otherwise.
strip([chars])
Return a copy of the string with leading and trailing whitespace removed.
swapcase()
Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()
Return a version of the string where each word is titlecased.
translate(table, /)
Replace each character in the string using the given translation table.
upper()
Return a copy of the string converted to uppercase.
zfill(width, /)
Pad a numeric string with zeros on the left, to fill a field of the given width.
Attributes
EUCLIDEAN_DISTANCE
DOT_PRODUCT
capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower
case.
casefold()¶
Return a version of the string suitable for caseless comparisons.
center(width, fillchar=' ', /)¶
Return a centered string of length width. | [
81,
1275,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
81,
4345,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
1314,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
81,
42098,
10698,
79,
11,
4194,
54660,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
5544,
2344,
2625,
29136,
11,
4194,
2880,
7105,
2608,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
71498,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
28848,
37472,
7108,
627,
7105,
2625,
29136,
11,
4194,
2880,
7105,
2608,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
7105,
8128,
2625,
13397,
1438,
2608,
5715,
264,
1160,
315,
279,
5238,
304,
279,
925,
11,
15061,
520,
1584,
23546,
627,
70425,
30018,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
3082,
422,
328,
8638,
449,
279,
5300,
9436,
11,
3641,
6062,
627,
13406,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
6522,
323,
28848,
37472,
7108,
627,
26825,
5756,
746,
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
746,
5715,
264,
2373,
315,
279,
925,
1405,
1855,
3492,
374,
2316,
92226,
627,
14372,
16138,
11,
4194,
54660,
23979,
1855,
3752,
304,
279,
925,
1701,
279,
2728,
14807,
2007,
627,
13886,
746,
5715,
264,
3048,
315,
279,
925,
16489,
311,
40582,
627,
89,
7712,
16830,
11,
4194,
54660,
14047,
264,
25031,
925,
449,
17975,
389,
279,
2163,
11,
311,
5266,
264,
2115,
315,
279,
2728,
2430,
627,
10738,
198,
39907,
3218,
12420,
1111,
64317,
198,
33653,
32950,
198,
82441,
368,
55609,
198,
5715,
264,
98421,
2373,
315,
279,
925,
627,
7816,
11951,
11,
1304,
279,
1176,
3752,
617,
8582,
1162,
323,
279,
2800,
4827,
198,
5756,
627,
5756,
20557,
368,
55609,
198,
5715,
264,
2373,
315,
279,
925,
14791,
369,
1162,
1752,
36595,
627,
3133,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
31288,
925,
315,
3160,
2430,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-3 | center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
count(sub[, start[, end]]) → int¶
Return the number of non-overlapping occurrences of substring sub in
string S[start:end]. Optional arguments start and end are
interpreted as in slice notation.
encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
encodingThe encoding in which to encode the string.
errorsThe error handling scheme to use for encoding errors.
The default is ‘strict’ meaning that encoding errors raise a
UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle UnicodeEncodeErrors.
endswith(suffix[, start[, end]]) → bool¶
Return True if S ends with the specified suffix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
suffix can also be a tuple of strings to try.
expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
find(sub[, start[, end]]) → int¶
Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
format(*args, **kwargs) → str¶
Return a formatted version of S, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).
format_map(mapping) → str¶ | [
3133,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
31288,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
1868,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
1396,
315,
2536,
29352,
91719,
57115,
315,
39549,
1207,
304,
198,
928,
328,
29563,
26874,
948,
220,
12536,
6105,
1212,
323,
842,
527,
198,
94561,
439,
304,
16363,
45297,
627,
6311,
86963,
1151,
4867,
12,
23,
518,
6103,
1151,
6765,
873,
55609,
198,
33635,
279,
925,
1701,
279,
35747,
9879,
369,
11418,
627,
17600,
791,
11418,
304,
902,
311,
16559,
279,
925,
627,
7805,
791,
1493,
11850,
13155,
311,
1005,
369,
11418,
6103,
627,
791,
1670,
374,
3451,
6765,
529,
7438,
430,
11418,
6103,
4933,
264,
198,
35020,
33635,
1480,
13,
220,
7089,
3284,
2819,
527,
3451,
13431,
20182,
3451,
8319,
529,
323,
198,
14336,
6591,
1799,
1116,
8319,
529,
439,
1664,
439,
904,
1023,
836,
9879,
449,
198,
1889,
4942,
10131,
4188,
430,
649,
3790,
36997,
33635,
14199,
627,
1438,
4291,
97566,
38372,
1212,
38372,
842,
30716,
11651,
1845,
55609,
198,
5715,
3082,
422,
328,
10548,
449,
279,
5300,
21166,
11,
3641,
6062,
627,
2409,
10309,
1212,
11,
1296,
328,
7314,
520,
430,
2361,
627,
2409,
10309,
842,
11,
3009,
27393,
328,
520,
430,
2361,
627,
27884,
649,
1101,
387,
264,
14743,
315,
9246,
311,
1456,
627,
33417,
32093,
28945,
2190,
28,
23,
8,
55609,
198,
5715,
264,
3048,
1405,
682,
5769,
5885,
527,
17626,
1701,
12908,
627,
2746,
5769,
2190,
374,
539,
2728,
11,
264,
5769,
1404,
315,
220,
23,
5885,
374,
19655,
627,
3990,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
5715,
482,
16,
389,
8060,
627,
2293,
4163,
2164,
11,
3146,
9872,
8,
11651,
610,
55609,
198,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
2897,
323,
16901,
627,
791,
94750,
527,
11054,
555,
60291,
320,
14336,
90,
529,
323,
3451,
92,
529,
4390,
2293,
5489,
82157,
8,
11651,
610,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-4 | format_map(mapping) → str¶
Return a formatted version of S, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).
index(sub[, start[, end]]) → int¶
Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and
there is at least one character in the string.
isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there
is at least one character in the string.
isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.
isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and
there is at least one character in the string.
isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there
is at least one character in the string.
isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
such as “def” or “class”.
islower()¶
Return True if the string is a lowercase string, False otherwise. | [
2293,
5489,
82157,
8,
11651,
610,
55609,
198,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
13021,
627,
791,
94750,
527,
11054,
555,
60291,
320,
14336,
90,
529,
323,
3451,
92,
529,
4390,
1275,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
36120,
15764,
994,
279,
39549,
374,
539,
1766,
627,
285,
94462,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
8451,
12,
20173,
925,
11,
3641,
6062,
627,
32,
925,
374,
8451,
12,
20173,
422,
682,
5885,
304,
279,
925,
527,
8451,
12,
20173,
323,
198,
19041,
374,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
7288,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
65695,
45938,
925,
11,
3641,
6062,
627,
32,
925,
374,
65695,
45938,
422,
682,
5885,
304,
279,
925,
527,
65695,
45938,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
24207,
368,
55609,
198,
5715,
3082,
422,
682,
5885,
304,
279,
925,
527,
40416,
11,
3641,
6062,
627,
57550,
5885,
617,
2082,
3585,
304,
279,
2134,
549,
10,
931,
15,
35681,
10,
11194,
37,
627,
3606,
925,
374,
40416,
2288,
627,
285,
24170,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
12395,
925,
11,
3641,
6062,
627,
32,
925,
374,
264,
12395,
925,
422,
682,
5885,
304,
279,
925,
527,
12395,
323,
198,
19041,
374,
520,
3325,
832,
3752,
304,
279,
925,
627,
70929,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
16099,
925,
11,
3641,
6062,
627,
32,
925,
374,
264,
16099,
925,
422,
682,
5885,
304,
279,
925,
527,
19016,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
16288,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
2764,
13325,
13110,
11,
3641,
6062,
627,
7368,
16570,
2124,
20454,
1161,
8,
311,
1296,
3508,
925,
274,
374,
264,
4694,
13110,
345,
21470,
439,
1054,
755,
863,
477,
1054,
1058,
863,
627,
285,
15115,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-5 | islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.
isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at
least one character in the string.
isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in
repr() or if it is empty.
isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there
is at least one character in the string.
istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.
isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.
join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string.
The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
lower()¶
Return a copy of the string converted to lowercase. | [
285,
15115,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
627,
32,
925,
374,
43147,
422,
682,
272,
1503,
5885,
304,
279,
925,
527,
43147,
323,
198,
19041,
374,
520,
3325,
832,
272,
1503,
3752,
304,
279,
925,
627,
285,
20173,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
25031,
925,
11,
3641,
6062,
627,
32,
925,
374,
25031,
422,
682,
5885,
304,
279,
925,
527,
25031,
323,
1070,
374,
520,
198,
56371,
832,
3752,
304,
279,
925,
627,
285,
1374,
481,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
43095,
11,
3641,
6062,
627,
32,
925,
374,
43095,
422,
682,
315,
1202,
5885,
527,
6646,
43095,
304,
198,
31937,
368,
477,
422,
433,
374,
4384,
627,
82870,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
37472,
925,
11,
3641,
6062,
627,
32,
925,
374,
37472,
422,
682,
5885,
304,
279,
925,
527,
37472,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
380,
1017,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
2316,
1824,
1503,
925,
11,
3641,
6062,
627,
644,
264,
2316,
1824,
1503,
925,
11,
8582,
12,
323,
2316,
39585,
5885,
1253,
1193,
198,
19070,
21482,
1503,
5885,
323,
43147,
5885,
1193,
272,
1503,
6305,
627,
285,
13886,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
40582,
925,
11,
3641,
6062,
627,
32,
925,
374,
40582,
422,
682,
272,
1503,
5885,
304,
279,
925,
527,
40582,
323,
198,
19041,
374,
520,
3325,
832,
272,
1503,
3752,
304,
279,
925,
627,
6115,
28169,
481,
11,
611,
8,
55609,
198,
79540,
32223,
904,
1396,
315,
9246,
627,
791,
925,
6832,
1749,
374,
2663,
374,
22306,
304,
1990,
1855,
2728,
925,
627,
791,
1121,
374,
6052,
439,
264,
502,
925,
627,
13617,
25,
3451,
14639,
13,
6115,
2625,
14336,
370,
20182,
3451,
65116,
20182,
3451,
5544,
529,
2526,
1492,
3451,
370,
558,
80,
26721,
529,
198,
75,
4345,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
2163,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
15115,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-6 | lower()¶
Return a copy of the string converted to lowercase.
lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters to Unicode ordinals, strings or None.
Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.
partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string
and two empty strings.
removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):].
Otherwise, return a copy of the original string.
removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string.
replace(old, new, count=- 1, /)¶
Return a copy with all occurrences of substring old replaced by new. | [
15115,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
627,
75,
13406,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
6522,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
2020,
52016,
17820,
598,
368,
55609,
198,
5715,
264,
14807,
2007,
41030,
369,
610,
26998,
26914,
2746,
1070,
374,
1193,
832,
5811,
11,
433,
2011,
387,
264,
11240,
13021,
36997,
198,
541,
24624,
320,
396,
68692,
8,
477,
5885,
311,
36997,
6141,
24624,
11,
9246,
477,
2290,
627,
12686,
7039,
690,
387,
1243,
16489,
311,
6141,
24624,
627,
2746,
1070,
527,
1403,
6105,
11,
814,
2011,
387,
9246,
315,
6273,
3160,
11,
323,
198,
258,
279,
13239,
11240,
11,
1855,
3752,
304,
865,
690,
387,
24784,
311,
279,
198,
19740,
520,
279,
1890,
2361,
304,
379,
13,
1442,
1070,
374,
264,
4948,
5811,
11,
433,
198,
25849,
387,
264,
925,
11,
6832,
5885,
690,
387,
24784,
311,
2290,
304,
279,
1121,
627,
42098,
10698,
79,
11,
611,
8,
55609,
198,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
2028,
690,
2778,
369,
279,
25829,
304,
279,
925,
13,
220,
1442,
279,
25829,
374,
1766,
345,
4310,
264,
220,
18,
2442,
6189,
8649,
279,
961,
1603,
279,
25829,
11,
279,
25829,
198,
275,
726,
11,
323,
279,
961,
1306,
433,
627,
2746,
279,
25829,
374,
539,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
279,
4113,
925,
198,
438,
1403,
4384,
9246,
627,
5514,
12113,
30018,
11,
611,
8,
55609,
198,
5715,
264,
610,
449,
279,
2728,
9436,
925,
7108,
422,
3118,
627,
2746,
279,
925,
8638,
449,
279,
9436,
925,
11,
471,
925,
25721,
30018,
1680,
27218,
81556,
11,
471,
264,
3048,
315,
279,
4113,
925,
627,
1864,
10296,
13866,
97566,
11,
611,
8,
55609,
198,
5715,
264,
610,
449,
279,
2728,
21166,
925,
7108,
422,
3118,
627,
2746,
279,
925,
10548,
449,
279,
21166,
925,
323,
430,
21166,
374,
539,
4384,
345,
693,
925,
27141,
2963,
97566,
27261,
18715,
11,
471,
264,
3048,
315,
279,
4113,
198,
928,
627,
8319,
22739,
11,
502,
11,
1797,
11065,
220,
16,
11,
611,
8,
55609,
198,
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-7 | Return a copy with all occurrences of substring old replaced by new.
countMaximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are
replaced.
rfind(sub[, start[, end]]) → int¶
Return the highest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
rindex(sub[, start[, end]]) → int¶
Return the highest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If
the separator is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings
and the original string.
rsplit(sep=None, maxsplit=- 1)¶
Return a list of the substrings in the string, using sep as the separator string.
sepThe separator used to split the string.
When set to None (the default value), will split on any whitespace
character (including \n \r \t \f and spaces) and will discard
empty strings from the result.
maxsplitMaximum number of splits (starting from the left). | [
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
627,
1868,
28409,
1396,
315,
57115,
311,
8454,
627,
12,
16,
320,
1820,
1670,
907,
8,
3445,
8454,
682,
57115,
627,
2746,
279,
10309,
5811,
1797,
374,
2728,
11,
1193,
279,
1176,
1797,
57115,
527,
198,
265,
37469,
627,
81,
3990,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
5715,
482,
16,
389,
8060,
627,
81,
1275,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
36120,
15764,
994,
279,
39549,
374,
539,
1766,
627,
81,
4345,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
1314,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
81,
42098,
10698,
79,
11,
611,
8,
55609,
198,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
2028,
690,
2778,
369,
279,
25829,
304,
279,
925,
11,
6041,
520,
279,
842,
13,
1442,
198,
1820,
25829,
374,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
279,
961,
1603,
279,
198,
41220,
11,
279,
25829,
5196,
11,
323,
279,
961,
1306,
433,
627,
2746,
279,
25829,
374,
539,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
1403,
4384,
9246,
198,
438,
279,
4113,
925,
627,
5544,
2344,
10698,
79,
5980,
11,
1973,
7105,
11065,
220,
16,
8,
55609,
198,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
29136,
791,
25829,
1511,
311,
6859,
279,
925,
627,
4599,
743,
311,
2290,
320,
1820,
1670,
907,
705,
690,
6859,
389,
904,
37472,
198,
19740,
320,
16564,
1144,
77,
1144,
81,
1144,
83,
1144,
69,
323,
12908,
8,
323,
690,
38967,
198,
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
570
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-8 | empty strings from the result.
maxsplitMaximum number of splits (starting from the left).
-1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
split(sep=None, maxsplit=- 1)¶
Return a list of the substrings in the string, using sep as the separator string.
sepThe separator used to split the string.
When set to None (the default value), will split on any whitespace
character (including \n \r \t \f and spaces) and will discard
empty strings from the result.
maxsplitMaximum number of splits (starting from the left).
-1 (the default value) means no limit.
Note, str.split() is mainly useful for data that has been intentionally
delimited. With natural text that includes punctuation, consider using
the regular expression module.
splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and
true.
startswith(prefix[, start[, end]]) → bool¶
Return True if S starts with the specified prefix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
prefix can also be a tuple of strings to try.
strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()¶ | [
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
4390,
12,
16,
320,
1820,
1670,
907,
8,
3445,
912,
4017,
627,
20805,
1303,
8638,
520,
279,
842,
315,
279,
925,
323,
4375,
311,
279,
4156,
627,
71498,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
28848,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
7105,
10698,
79,
5980,
11,
1973,
7105,
11065,
220,
16,
8,
55609,
198,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
29136,
791,
25829,
1511,
311,
6859,
279,
925,
627,
4599,
743,
311,
2290,
320,
1820,
1670,
907,
705,
690,
6859,
389,
904,
37472,
198,
19740,
320,
16564,
1144,
77,
1144,
81,
1144,
83,
1144,
69,
323,
12908,
8,
323,
690,
38967,
198,
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
4390,
12,
16,
320,
1820,
1670,
907,
8,
3445,
912,
4017,
627,
9290,
11,
610,
5402,
368,
374,
14918,
5505,
369,
828,
430,
706,
1027,
37304,
198,
9783,
32611,
13,
220,
3161,
5933,
1495,
430,
5764,
62603,
11,
2980,
1701,
198,
1820,
5912,
7645,
4793,
627,
7105,
8128,
7,
13397,
1438,
5725,
8,
55609,
198,
5715,
264,
1160,
315,
279,
5238,
304,
279,
925,
11,
15061,
520,
1584,
23546,
627,
2519,
18808,
527,
539,
5343,
304,
279,
13239,
1160,
7389,
2567,
1438,
374,
2728,
323,
198,
1904,
627,
70425,
30018,
38372,
1212,
38372,
842,
30716,
11651,
1845,
55609,
198,
5715,
3082,
422,
328,
8638,
449,
279,
5300,
9436,
11,
3641,
6062,
627,
2409,
10309,
1212,
11,
1296,
328,
7314,
520,
430,
2361,
627,
2409,
10309,
842,
11,
3009,
27393,
328,
520,
430,
2361,
627,
12113,
649,
1101,
387,
264,
14743,
315,
9246,
311,
1456,
627,
13406,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
6522,
323,
28848,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
26825,
5756,
368,
55609,
198,
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
368,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
7242d2d1de15-9 | Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining
cased characters have lower case.
translate(table, /)¶
Replace each character in the string using the given translation table.
tableTranslation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a
dictionary or list. If this operation raises LookupError, the character is
left untouched. Characters mapped to None are deleted.
upper()¶
Return a copy of the string converted to uppercase.
zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
DOT_PRODUCT = 'DOT_PRODUCT'¶
EUCLIDEAN_DISTANCE = 'EUCLIDEAN_DISTANCE'¶ | [
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
368,
55609,
198,
5715,
264,
2373,
315,
279,
925,
1405,
1855,
3492,
374,
2316,
92226,
627,
7816,
11951,
11,
4339,
1212,
449,
8582,
92226,
5885,
323,
682,
9861,
198,
92226,
5885,
617,
4827,
1162,
627,
14372,
16138,
11,
611,
8,
55609,
198,
23979,
1855,
3752,
304,
279,
925,
1701,
279,
2728,
14807,
2007,
627,
2048,
25416,
2007,
11,
902,
2011,
387,
264,
13021,
315,
36997,
6141,
24624,
311,
198,
35020,
6141,
24624,
11,
9246,
11,
477,
2290,
627,
791,
2007,
2011,
4305,
19128,
9199,
287,
4669,
1328,
61012,
10662,
369,
2937,
264,
198,
36771,
477,
1160,
13,
220,
1442,
420,
5784,
25930,
51411,
1480,
11,
279,
3752,
374,
198,
2414,
68622,
13,
220,
45616,
24784,
311,
2290,
527,
11309,
627,
13886,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
40582,
627,
89,
7712,
16830,
11,
611,
8,
55609,
198,
14047,
264,
25031,
925,
449,
17975,
389,
279,
2163,
11,
311,
5266,
264,
2115,
315,
279,
2728,
2430,
627,
791,
925,
374,
2646,
60856,
627,
33653,
32950,
284,
364,
33653,
32950,
6,
55609,
198,
39907,
3218,
12420,
1111,
64317,
284,
364,
39907,
3218,
12420,
1111,
64317,
6,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.DistanceStrategy.html |
87391fda43af-0 | langchain.vectorstores.myscale.has_mul_sub_str¶
langchain.vectorstores.myscale.has_mul_sub_str(s: str, *args: Any) → bool[source]¶
Check if a string contains multiple substrings.
:param s: string to check.
:param *args: substrings to check.
Returns
True if all substrings are in the string, False otherwise. | [
5317,
8995,
48203,
44569,
749,
84009,
7001,
25989,
5341,
2966,
55609,
198,
5317,
8995,
48203,
44569,
749,
84009,
7001,
25989,
5341,
2966,
1161,
25,
610,
11,
353,
2164,
25,
5884,
8,
11651,
1845,
76747,
60,
55609,
198,
4061,
422,
264,
925,
5727,
5361,
16146,
826,
627,
68416,
274,
25,
925,
311,
1817,
627,
68416,
353,
2164,
25,
16146,
826,
311,
1817,
627,
16851,
198,
2575,
422,
682,
16146,
826,
527,
304,
279,
925,
11,
3641,
6062,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.has_mul_sub_str.html |
af2451de2e2e-0 | langchain.vectorstores.myscale.MyScale¶
class langchain.vectorstores.myscale.MyScale(embedding: Embeddings, config: Optional[MyScaleSettings] = None, **kwargs: Any)[source]¶
Bases: VectorStore
Wrapper around MyScale vector database
You need a clickhouse-connect python package, and a valid account
to connect to MyScale.
MyScale can not only search with simple vector indexes,
it also supports complex query with multiple conditions,
constraints and even sub-queries.
For more information, please visit[myscale official site](https://docs.myscale.com/en/overview/)
MyScale Wrapper to LangChain
embedding_function (Embeddings):
config (MyScaleSettings): Configuration to MyScale Client
Other keyword arguments will pass into
[clickhouse-connect](https://docs.myscale.com/)
Methods
__init__(embedding[, config])
MyScale Wrapper to LangChain
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, batch_size, 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,
749,
84009,
28152,
7092,
55609,
198,
1058,
8859,
8995,
48203,
44569,
749,
84009,
28152,
7092,
50825,
7113,
25,
38168,
25624,
11,
2242,
25,
12536,
58,
5159,
7092,
6214,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
3092,
7092,
4724,
4729,
198,
2675,
1205,
264,
4299,
7830,
86570,
10344,
6462,
11,
323,
264,
2764,
2759,
198,
998,
4667,
311,
3092,
7092,
627,
5159,
7092,
649,
539,
1193,
2778,
449,
4382,
4724,
25998,
345,
275,
1101,
11815,
6485,
3319,
449,
5361,
4787,
345,
66412,
323,
1524,
1207,
12,
43935,
627,
2520,
810,
2038,
11,
4587,
4034,
58,
8373,
2296,
4033,
2816,
9725,
2485,
1129,
14452,
749,
84009,
916,
13920,
14,
50378,
54660,
5159,
7092,
36588,
311,
23272,
19368,
198,
95711,
9353,
320,
26566,
25624,
997,
1710,
320,
5159,
7092,
6214,
1680,
12499,
311,
3092,
7092,
8589,
198,
11663,
16570,
6105,
690,
1522,
1139,
198,
58,
3763,
7830,
86570,
9725,
2485,
1129,
14452,
749,
84009,
916,
54660,
18337,
198,
565,
2381,
3889,
95711,
38372,
4194,
1710,
2608,
5159,
7092,
36588,
311,
23272,
19368,
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,
14377,
2424,
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,
48627
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
af2451de2e2e-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)
Delete by vector ID.
drop()
Helper function: Drop data
escape_str(value)
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Create Myscale wrapper with existing 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, where_str])
Perform a similarity search with MyScale
similarity_search_by_vector(embedding[, k, ...])
Perform a similarity search with MyScale by vectors
similarity_search_with_relevance_scores(query)
Perform a similarity search with MyScale
Attributes
metadata_column
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] | [
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,
6861,
746,
5628,
734,
25,
16110,
828,
198,
13295,
2966,
3764,
340,
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,
4110,
386,
84009,
13564,
449,
6484,
22755,
198,
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,
2940,
2966,
2608,
48051,
264,
38723,
2778,
449,
3092,
7092,
198,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
38372,
4194,
74,
11,
4194,
1131,
2608,
48051,
264,
38723,
2778,
449,
3092,
7092,
555,
23728,
198,
15124,
49325,
10947,
6753,
1311,
33194,
28297,
10974,
340,
48051,
264,
38723,
2778,
449,
3092,
7092,
198,
10738,
198,
18103,
8918,
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,
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.myscale.MyScale.html |
af2451de2e2e-2 | 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, batch_size: int = 32, ids: Optional[Iterable[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.
ids – Optional list of ids to associate with the texts.
batch_size – Batch size of insertion
metadata – Optional column data to be inserted
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]¶ | [
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,
7309,
2424,
25,
528,
284,
220,
843,
11,
14483,
25,
12536,
58,
51735,
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,
3447,
1389,
12536,
1160,
315,
14483,
311,
22712,
449,
279,
22755,
627,
14377,
2424,
1389,
35004,
1404,
315,
37027,
198,
18103,
1389,
12536,
3330,
828,
311,
387,
22306,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
af2451de2e2e-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]
drop() → None[source]¶
Helper function: Drop data
escape_str(value: str) → str[source]¶
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings. | [
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,
6861,
368,
11651,
2290,
76747,
60,
55609,
198,
5628,
734,
25,
16110,
828,
198,
13295,
2966,
3764,
25,
610,
8,
11651,
610,
76747,
60,
55609,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
af2451de2e2e-4 | Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, config: Optional[MyScaleSettings] = None, text_ids: Optional[Iterable[str]] = None, batch_size: int = 32, **kwargs: Any) → MyScale[source]¶
Create Myscale wrapper with existing texts
Parameters
embedding_function (Embeddings) – Function to extract text embedding
texts (Iterable[str]) – List or tuple of strings to be added
config (MyScaleSettings, Optional) – Myscale configuration
text_ids (Optional[Iterable], optional) – IDs for the texts.
Defaults to None.
batch_size (int, optional) – Batchsize when transmitting data to MyScale.
Defaults to 32.
metadata (List[dict], optional) – metadata to texts. Defaults to None.
into (Other keyword arguments will pass) – [clickhouse-connect](https://clickhouse.com/docs/en/integrations/python#clickhouse-connect-driver-api)
Returns
MyScale Index
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 | [
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,
13755,
71401,
11,
5884,
5163,
60,
284,
2290,
11,
2242,
25,
12536,
58,
5159,
7092,
6214,
60,
284,
2290,
11,
1495,
8237,
25,
12536,
58,
51735,
17752,
5163,
284,
2290,
11,
7309,
2424,
25,
528,
284,
220,
843,
11,
3146,
9872,
25,
5884,
8,
11651,
3092,
7092,
76747,
60,
55609,
198,
4110,
386,
84009,
13564,
449,
6484,
22755,
198,
9905,
198,
95711,
9353,
320,
26566,
25624,
8,
1389,
5830,
311,
8819,
1495,
40188,
198,
87042,
320,
51735,
17752,
2526,
1389,
1796,
477,
14743,
315,
9246,
311,
387,
3779,
198,
1710,
320,
5159,
7092,
6214,
11,
12536,
8,
1389,
386,
84009,
6683,
198,
1342,
8237,
320,
15669,
58,
51735,
1145,
10309,
8,
1389,
29460,
369,
279,
22755,
627,
16672,
311,
2290,
627,
14377,
2424,
320,
396,
11,
10309,
8,
1389,
35004,
2190,
994,
78768,
828,
311,
3092,
7092,
627,
16672,
311,
220,
843,
627,
18103,
320,
861,
58,
8644,
1145,
10309,
8,
1389,
11408,
311,
22755,
13,
37090,
311,
2290,
627,
18614,
320,
11663,
16570,
6105,
690,
1522,
8,
1389,
510,
3763,
7830,
86570,
9725,
2485,
1129,
3763,
7830,
916,
27057,
13920,
32214,
14750,
811,
24147,
2,
3763,
7830,
86570,
77590,
24851,
340,
16851,
198,
5159,
7092,
8167,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
af2451de2e2e-5 | 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, where_str: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Perform a similarity search with MyScale
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. Defaults to 4.
where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
Returns
List of Documents
Return type
List[Document] | [
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,
1405,
2966,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
48051,
264,
38723,
2778,
449,
3092,
7092,
198,
9905,
198,
1663,
320,
496,
8,
1389,
3319,
925,
198,
74,
320,
396,
11,
10309,
8,
1389,
7054,
735,
19228,
311,
17622,
13,
37090,
311,
220,
19,
627,
2940,
2966,
320,
15669,
17752,
1145,
10309,
8,
1389,
1405,
3044,
925,
627,
16672,
311,
2290,
627,
28892,
1389,
5321,
656,
539,
1095,
842,
8865,
311,
5266,
420,
323,
2744,
387,
8010,
198,
1073,
8029,
26127,
13,
3277,
14892,
449,
2322,
329,
19907,
11,
6227,
311,
198,
817,
314,
726,
28644,
8918,
7966,
9294,
4619,
315,
7180,
198,
32676,
13,
578,
1670,
836,
369,
433,
374,
11408,
627,
16851,
198,
861,
315,
45890,
198,
5715,
955,
198,
861,
58,
7676,
60
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
af2451de2e2e-6 | Returns
List of Documents
Return type
List[Document]
similarity_search_by_vector(embedding: List[float], k: int = 4, where_str: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Perform a similarity search with MyScale by vectors
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. Defaults to 4.
where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
Returns
List of (Document, similarity)
Return type
List[Document]
similarity_search_with_relevance_scores(query: str, k: int = 4, where_str: Optional[str] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Perform a similarity search with MyScale
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. Defaults to 4.
where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
Returns
List of documents most similar to the query text
and cosine distance in float for each.
Lower score represents more similarity.
Return type
List[Document]
property metadata_column: str¶ | [
16851,
198,
861,
315,
45890,
198,
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,
1405,
2966,
25,
12536,
17752,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
48051,
264,
38723,
2778,
449,
3092,
7092,
555,
23728,
198,
9905,
198,
1663,
320,
496,
8,
1389,
3319,
925,
198,
74,
320,
396,
11,
10309,
8,
1389,
7054,
735,
19228,
311,
17622,
13,
37090,
311,
220,
19,
627,
2940,
2966,
320,
15669,
17752,
1145,
10309,
8,
1389,
1405,
3044,
925,
627,
16672,
311,
2290,
627,
28892,
1389,
5321,
656,
539,
1095,
842,
8865,
311,
5266,
420,
323,
2744,
387,
8010,
198,
1073,
8029,
26127,
13,
3277,
14892,
449,
2322,
329,
19907,
11,
6227,
311,
198,
817,
314,
726,
28644,
8918,
7966,
9294,
4619,
315,
7180,
198,
32676,
13,
578,
1670,
836,
369,
433,
374,
11408,
627,
16851,
198,
861,
315,
320,
7676,
11,
38723,
340,
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,
1405,
2966,
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,
48051,
264,
38723,
2778,
449,
3092,
7092,
198,
9905,
198,
1663,
320,
496,
8,
1389,
3319,
925,
198,
74,
320,
396,
11,
10309,
8,
1389,
7054,
735,
19228,
311,
17622,
13,
37090,
311,
220,
19,
627,
2940,
2966,
320,
15669,
17752,
1145,
10309,
8,
1389,
1405,
3044,
925,
627,
16672,
311,
2290,
627,
28892,
1389,
5321,
656,
539,
1095,
842,
8865,
311,
5266,
420,
323,
2744,
387,
8010,
198,
1073,
8029,
26127,
13,
3277,
14892,
449,
2322,
329,
19907,
11,
6227,
311,
198,
817,
314,
726,
28644,
8918,
7966,
9294,
4619,
315,
7180,
198,
32676,
13,
578,
1670,
836,
369,
433,
374,
11408,
627,
16851,
198,
861,
315,
9477,
1455,
4528,
311,
279,
3319,
1495,
198,
438,
76359,
6138,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
5715,
955,
198,
861,
58,
7676,
933,
3784,
11408,
8918,
25,
610,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.myscale.MyScale.html |
0620584b6222-0 | langchain.vectorstores.annoy.Annoy¶
class langchain.vectorstores.annoy.Annoy(embedding_function: Callable, index: Any, metric: str, docstore: Docstore, index_to_docstore_id: Dict[int, str])[source]¶
Bases: VectorStore
Wrapper around Annoy vector database.
To use, you should have the annoy python package installed.
Example
from langchain import Annoy
db = Annoy(embedding_function, index, docstore, index_to_docstore_id)
Initialize with necessary components.
Methods
__init__(embedding_function, index, metric, ...)
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])
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. | [
5317,
8995,
48203,
44569,
13,
1036,
2303,
8794,
2201,
88,
55609,
198,
1058,
8859,
8995,
48203,
44569,
13,
1036,
2303,
8794,
2201,
88,
50825,
7113,
9353,
25,
54223,
11,
1963,
25,
5884,
11,
18767,
25,
610,
11,
4733,
4412,
25,
22452,
4412,
11,
1963,
2401,
19401,
4412,
851,
25,
30226,
19155,
11,
610,
41105,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
1556,
2201,
88,
4724,
4729,
627,
1271,
1005,
11,
499,
1288,
617,
279,
38292,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
1179,
1556,
2201,
88,
198,
2042,
284,
1556,
2201,
88,
50825,
7113,
9353,
11,
1963,
11,
4733,
4412,
11,
1963,
2401,
19401,
4412,
851,
340,
10130,
449,
5995,
6956,
627,
18337,
198,
565,
2381,
3889,
95711,
9353,
11,
4194,
1275,
11,
4194,
16282,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-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_embeddings(text_embeddings, embedding)
Construct Annoy wrapper from embeddings.
from_texts(texts, embedding[, metadatas, ...])
Construct Annoy wrapper from raw documents.
load_local(folder_path, embeddings)
Load Annoy index, docstore, and index_to_docstore_id to disk.
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.
process_index_results(idxs, dists)
Turns annoy results into a list of documents and scores.
save_local(folder_path[, prefault])
Save Annoy index, docstore, and index_to_docstore_id to disk.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, search_k])
Return docs most similar to query.
similarity_search_by_index(docstore_index[, ...])
Return docs most similar to docstore_index.
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, ...]) | [
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,
64872,
7383,
64872,
11,
4194,
95711,
340,
29568,
1556,
2201,
88,
13564,
505,
71647,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
29568,
1556,
2201,
88,
13564,
505,
7257,
9477,
627,
1096,
13876,
35029,
2703,
11,
4194,
12529,
25624,
340,
6003,
1556,
2201,
88,
1963,
11,
4733,
4412,
11,
323,
1963,
2401,
19401,
4412,
851,
311,
13668,
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,
4734,
3644,
13888,
3809,
19072,
11,
4194,
67,
1705,
340,
19952,
82,
38292,
3135,
1139,
264,
1160,
315,
9477,
323,
12483,
627,
6766,
13876,
35029,
2703,
38372,
4194,
31652,
957,
2608,
8960,
1556,
2201,
88,
1963,
11,
4733,
4412,
11,
323,
1963,
2401,
19401,
4412,
851,
311,
13668,
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,
4803,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
3644,
19702,
4412,
3644,
38372,
4194,
1131,
2608,
5715,
27437,
1455,
4528,
311,
4733,
4412,
3644,
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,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-2 | similarity_search_with_score(query[, k, ...])
Return docs most similar to query.
similarity_search_with_score_by_index(...[, ...])
Return docs most similar to query.
similarity_search_with_score_by_vector(embedding)
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]
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. | [
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,
3644,
19381,
38372,
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,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-3 | 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.
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, | [
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,
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,
11
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-4 | 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_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: Embeddings, metadatas: Optional[List[dict]] = None, metric: str = 'angular', trees: int = 100, n_jobs: int = - 1, **kwargs: Any) → Annoy[source]¶
Construct Annoy wrapper from embeddings.
Parameters
text_embeddings – List of tuples of (text, embedding)
embedding – Embedding function to use.
metadatas – List of metadata dictionaries to associate with documents.
metric – Metric to use for indexing. Defaults to “angular”.
trees – Number of trees to use for indexing. Defaults to 100.
n_jobs – Number of jobs to use for indexing. Defaults to -1
This is a user friendly interface that:
Creates an in memory docstore with provided embeddings
Initializes the Annoy database
This is intended to be a quick way to get started.
Example
from langchain import Annoy
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
text_embeddings = embeddings.embed_documents(texts)
text_embedding_pairs = list(zip(texts, text_embeddings))
db = Annoy.from_embeddings(text_embedding_pairs, embeddings) | [
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,
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,
18767,
25,
610,
284,
364,
4328,
518,
12690,
25,
528,
284,
220,
1041,
11,
308,
38347,
25,
528,
284,
482,
220,
16,
11,
3146,
9872,
25,
5884,
8,
11651,
1556,
2201,
88,
76747,
60,
55609,
198,
29568,
1556,
2201,
88,
13564,
505,
71647,
627,
9905,
198,
1342,
64872,
1389,
1796,
315,
46325,
315,
320,
1342,
11,
40188,
340,
95711,
1389,
38168,
7113,
734,
311,
1005,
627,
4150,
329,
19907,
1389,
1796,
315,
11408,
58614,
311,
22712,
449,
9477,
627,
16282,
1389,
53558,
311,
1005,
369,
53080,
13,
37090,
311,
1054,
4328,
863,
627,
91512,
1389,
5742,
315,
12690,
311,
1005,
369,
53080,
13,
37090,
311,
220,
1041,
627,
77,
38347,
1389,
5742,
315,
7032,
311,
1005,
369,
53080,
13,
37090,
311,
482,
16,
198,
2028,
374,
264,
1217,
11919,
3834,
430,
512,
55968,
459,
304,
5044,
4733,
4412,
449,
3984,
71647,
198,
6475,
4861,
279,
1556,
2201,
88,
4729,
198,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
13617,
198,
1527,
8859,
8995,
1179,
1556,
2201,
88,
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,
2042,
284,
1556,
2201,
88,
6521,
64872,
7383,
52602,
37530,
11,
71647,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-5 | db = Annoy.from_embeddings(text_embedding_pairs, embeddings)
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, metric: str = 'angular', trees: int = 100, n_jobs: int = - 1, **kwargs: Any) → Annoy[source]¶
Construct Annoy wrapper from raw documents.
Parameters
texts – List of documents to index.
embedding – Embedding function to use.
metadatas – List of metadata dictionaries to associate with documents.
metric – Metric to use for indexing. Defaults to “angular”.
trees – Number of trees to use for indexing. Defaults to 100.
n_jobs – Number of jobs to use for indexing. Defaults to -1.
This is a user friendly interface that:
Embeds documents.
Creates an in memory docstore
Initializes the Annoy database
This is intended to be a quick way to get started.
Example
from langchain import Annoy
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
index = Annoy.from_texts(texts, embeddings)
classmethod load_local(folder_path: str, embeddings: Embeddings) → Annoy[source]¶
Load Annoy index, docstore, and index_to_docstore_id to disk.
Parameters
folder_path – folder path to load index, docstore,
and index_to_docstore_id from.
embeddings – Embeddings to use when generating queries.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance. | [
2042,
284,
1556,
2201,
88,
6521,
64872,
7383,
52602,
37530,
11,
71647,
340,
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,
18767,
25,
610,
284,
364,
4328,
518,
12690,
25,
528,
284,
220,
1041,
11,
308,
38347,
25,
528,
284,
482,
220,
16,
11,
3146,
9872,
25,
5884,
8,
11651,
1556,
2201,
88,
76747,
60,
55609,
198,
29568,
1556,
2201,
88,
13564,
505,
7257,
9477,
627,
9905,
198,
87042,
1389,
1796,
315,
9477,
311,
1963,
627,
95711,
1389,
38168,
7113,
734,
311,
1005,
627,
4150,
329,
19907,
1389,
1796,
315,
11408,
58614,
311,
22712,
449,
9477,
627,
16282,
1389,
53558,
311,
1005,
369,
53080,
13,
37090,
311,
1054,
4328,
863,
627,
91512,
1389,
5742,
315,
12690,
311,
1005,
369,
53080,
13,
37090,
311,
220,
1041,
627,
77,
38347,
1389,
5742,
315,
7032,
311,
1005,
369,
53080,
13,
37090,
311,
482,
16,
627,
2028,
374,
264,
1217,
11919,
3834,
430,
512,
26566,
82,
9477,
627,
55968,
459,
304,
5044,
4733,
4412,
198,
6475,
4861,
279,
1556,
2201,
88,
4729,
198,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
13617,
198,
1527,
8859,
8995,
1179,
1556,
2201,
88,
198,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
12529,
25624,
284,
5377,
15836,
26566,
25624,
746,
1275,
284,
1556,
2201,
88,
6521,
80746,
7383,
82,
11,
71647,
340,
27853,
2865,
13876,
35029,
2703,
25,
610,
11,
71647,
25,
38168,
25624,
8,
11651,
1556,
2201,
88,
76747,
60,
55609,
198,
6003,
1556,
2201,
88,
1963,
11,
4733,
4412,
11,
323,
1963,
2401,
19401,
4412,
851,
311,
13668,
627,
9905,
198,
18135,
2703,
1389,
8695,
1853,
311,
2865,
1963,
11,
4733,
4412,
345,
438,
1963,
2401,
19401,
4412,
851,
505,
627,
12529,
25624,
1389,
38168,
25624,
311,
1005,
994,
24038,
20126,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-6 | 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][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.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
k – Number of Documents to return. Defaults to 4.
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.
process_index_results(idxs: List[int], dists: List[float]) → List[Tuple[Document, float]][source]¶
Turns annoy results into a list of documents and scores.
Parameters
idxs – List of indices of the documents in the index.
dists – List of distances of the documents in the index.
Returns
List of Documents and scores. | [
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,
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,
9838,
4803,
1389,
5742,
315,
45890,
311,
7963,
311,
1522,
311,
386,
18953,
12384,
627,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
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,
4734,
3644,
13888,
3809,
19072,
25,
1796,
19155,
1145,
1612,
82,
25,
1796,
96481,
2526,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
19952,
82,
38292,
3135,
1139,
264,
1160,
315,
9477,
323,
12483,
627,
9905,
198,
6495,
82,
1389,
1796,
315,
15285,
315,
279,
9477,
304,
279,
1963,
627,
67,
1705,
1389,
1796,
315,
27650,
315,
279,
9477,
304,
279,
1963,
627,
16851,
198,
861,
315,
45890,
323,
12483,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-7 | Returns
List of Documents and scores.
save_local(folder_path: str, prefault: bool = False) → None[source]¶
Save Annoy index, docstore, and index_to_docstore_id to disk.
Parameters
folder_path – folder path to save index, docstore,
and index_to_docstore_id to.
prefault – Whether to pre-load the index into memory.
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, search_k: int = - 1, **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.
search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the query.
similarity_search_by_index(docstore_index: int, k: int = 4, search_k: int = - 1, **kwargs: Any) → List[Document][source]¶
Return docs most similar to docstore_index.
Parameters
docstore_index – Index of document in docstore
k – Number of Documents to return. Defaults to 4.
search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the embedding.
similarity_search_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to. | [
16851,
198,
861,
315,
45890,
323,
12483,
627,
6766,
13876,
35029,
2703,
25,
610,
11,
19257,
957,
25,
1845,
284,
3641,
8,
11651,
2290,
76747,
60,
55609,
198,
8960,
1556,
2201,
88,
1963,
11,
4733,
4412,
11,
323,
1963,
2401,
19401,
4412,
851,
311,
13668,
627,
9905,
198,
18135,
2703,
1389,
8695,
1853,
311,
3665,
1963,
11,
4733,
4412,
345,
438,
1963,
2401,
19401,
4412,
851,
311,
627,
31652,
957,
1389,
13440,
311,
864,
50108,
279,
1963,
1139,
5044,
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,
2778,
4803,
25,
528,
284,
482,
220,
16,
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,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
627,
15124,
49325,
10947,
3795,
3644,
19702,
4412,
3644,
25,
528,
11,
597,
25,
528,
284,
220,
19,
11,
2778,
4803,
25,
528,
284,
482,
220,
16,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
4733,
4412,
3644,
627,
9905,
198,
5349,
4412,
3644,
1389,
8167,
315,
2246,
304,
4733,
4412,
198,
74,
1389,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
40188,
627,
15124,
49325,
10947,
3795,
12526,
50825,
7113,
25,
1796,
96481,
1145,
597,
25,
528,
284,
220,
19,
11,
2778,
4803,
25,
528,
284,
482,
220,
16,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-8 | Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the embedding.
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, search_k: int = - 1) → 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.
search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the query and score for each
similarity_search_with_score_by_index(docstore_index: int, k: int = 4, search_k: int = - 1) → 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.
search_k – inspect up to search_k nodes which defaults | [
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,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
40188,
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,
2778,
4803,
25,
528,
284,
482,
220,
16,
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,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
15124,
49325,
10947,
6753,
10622,
3795,
3644,
19702,
4412,
3644,
25,
528,
11,
597,
25,
528,
284,
220,
19,
11,
2778,
4803,
25,
528,
284,
482,
220,
16,
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,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
0620584b6222-9 | search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the query and score for each
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1) → List[Tuple[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.
search_k – inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the query and score for each | [
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
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,
2778,
4803,
25,
528,
284,
482,
220,
16,
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,
1874,
4803,
1389,
25052,
709,
311,
2778,
4803,
7954,
902,
17088,
198,
998,
308,
76891,
353,
308,
422,
539,
3984,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.annoy.Annoy.html |
f7dee6b6b38f-0 | langchain.vectorstores.tair.Tair¶
class langchain.vectorstores.tair.Tair(embedding_function: Embeddings, url: str, index_name: str, content_key: str = 'content', metadata_key: str = 'metadata', search_params: Optional[dict] = None, **kwargs: Any)[source]¶
Bases: VectorStore
Wrapper around Tair Vector store.
Methods
__init__(embedding_function, url, index_name)
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])
Add texts data to an existing index.
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_index_if_not_exist(dim, ...)
delete(ids) | [
5317,
8995,
48203,
44569,
739,
1334,
844,
1334,
55609,
198,
1058,
8859,
8995,
48203,
44569,
739,
1334,
844,
1334,
50825,
7113,
9353,
25,
38168,
25624,
11,
2576,
25,
610,
11,
1963,
1292,
25,
610,
11,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
2778,
6887,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
350,
1334,
4290,
3637,
627,
18337,
198,
565,
2381,
3889,
95711,
9353,
11,
4194,
1103,
11,
4194,
1275,
1292,
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,
2261,
22755,
828,
311,
459,
6484,
1963,
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,
3644,
11366,
8072,
37006,
38002,
11,
4194,
32318,
4644,
44548,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.tair.Tair.html |
f7dee6b6b38f-1 | create_index_if_not_exist(dim, ...)
delete(ids)
Delete by vector ID.
drop_index([index_name])
Drop an existing index.
from_documents(documents, embedding[, ...])
Return VectorStore initialized from documents and embeddings.
from_existing_index(embedding[, index_name, ...])
Connect to an existing Tair index.
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])
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_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 | [
3261,
3644,
11366,
8072,
37006,
38002,
11,
4194,
32318,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
6861,
3644,
2625,
1275,
1292,
2608,
20463,
459,
6484,
1963,
627,
1527,
77027,
19702,
2901,
11,
4194,
95711,
38372,
4194,
1131,
2608,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
1527,
63730,
3644,
50825,
7113,
38372,
4194,
1275,
1292,
11,
4194,
1131,
2608,
14953,
311,
459,
6484,
350,
1334,
1963,
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,
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,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.tair.Tair.html |
f7dee6b6b38f-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]
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]¶
Add texts data to an existing index.
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. | [
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,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
2261,
22755,
828,
311,
459,
6484,
1963,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.tair.Tair.html |
f7dee6b6b38f-3 | 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_index_if_not_exist(dim: int, distance_type: str, index_type: str, data_type: str, **kwargs: Any) → bool[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]
static drop_index(index_name: str = 'langchain', **kwargs: Any) → bool[source]¶
Drop an existing index.
Parameters
index_name (str) – Name of the index to drop.
Returns
True if the index is dropped successfully.
Return type
bool
classmethod from_documents(documents: List[Document], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: str = 'langchain', content_key: str = 'content', metadata_key: str = 'metadata', **kwargs: Any) → Tair[source]¶
Return VectorStore initialized from documents and embeddings.
classmethod from_existing_index(embedding: Embeddings, index_name: str = 'langchain', content_key: str = 'content', metadata_key: str = 'metadata', **kwargs: Any) → Tair[source]¶
Connect to an existing Tair index. | [
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,
3644,
11366,
8072,
37006,
38002,
25,
528,
11,
6138,
1857,
25,
610,
11,
1963,
1857,
25,
610,
11,
828,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1845,
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,
2020,
6068,
3644,
7343,
1292,
25,
610,
284,
364,
5317,
8995,
518,
3146,
9872,
25,
5884,
8,
11651,
1845,
76747,
60,
55609,
198,
20463,
459,
6484,
1963,
627,
9905,
198,
1275,
1292,
320,
496,
8,
1389,
4076,
315,
279,
1963,
311,
6068,
627,
16851,
198,
2575,
422,
279,
1963,
374,
12504,
7946,
627,
5715,
955,
198,
2707,
198,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
1963,
1292,
25,
610,
284,
364,
5317,
8995,
518,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
3146,
9872,
25,
5884,
8,
11651,
350,
1334,
76747,
60,
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,
284,
364,
5317,
8995,
518,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
3146,
9872,
25,
5884,
8,
11651,
350,
1334,
76747,
60,
55609,
198,
14953,
311,
459,
6484,
350,
1334,
1963,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.tair.Tair.html |
f7dee6b6b38f-4 | Connect to an existing Tair index.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: str = 'langchain', content_key: str = 'content', metadata_key: str = 'metadata', **kwargs: Any) → Tair[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]¶
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 | [
14953,
311,
459,
6484,
350,
1334,
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,
610,
284,
364,
5317,
8995,
518,
2262,
3173,
25,
610,
284,
364,
1834,
518,
11408,
3173,
25,
610,
284,
364,
18103,
518,
3146,
9872,
25,
5884,
8,
11651,
350,
1334,
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,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.tair.Tair.html |
f7dee6b6b38f-5 | 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]¶
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_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 | [
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,
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,
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.tair.Tair.html |
f7dee6b6b38f-6 | filter the resulting set of retrieved docs
Returns
List of Tuples of (doc, similarity_score) | [
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.tair.Tair.html |
730098070f89-0 | langchain.vectorstores.faiss.dependable_faiss_import¶
langchain.vectorstores.faiss.dependable_faiss_import(no_avx2: Optional[bool] = None) → Any[source]¶
Import faiss if available, otherwise raise error.
If FAISS_NO_AVX2 environment variable is set, it will be considered
to load FAISS with no AVX2 optimization.
Parameters
no_avx2 – Load FAISS strictly with no AVX2 optimization
so that the vectorstore is portable and compatible with other devices. | [
5317,
8995,
48203,
44569,
64214,
1056,
60334,
481,
96964,
1056,
18941,
55609,
198,
5317,
8995,
48203,
44569,
64214,
1056,
60334,
481,
96964,
1056,
18941,
40305,
27265,
87,
17,
25,
12536,
58,
2707,
60,
284,
2290,
8,
11651,
5884,
76747,
60,
55609,
198,
11772,
2267,
1056,
422,
2561,
11,
6062,
4933,
1493,
627,
2746,
15358,
31949,
9278,
30486,
55,
17,
4676,
3977,
374,
743,
11,
433,
690,
387,
6646,
198,
998,
2865,
15358,
31949,
449,
912,
12431,
55,
17,
26329,
627,
9905,
198,
2201,
27265,
87,
17,
1389,
9069,
15358,
31949,
26549,
449,
912,
12431,
55,
17,
26329,
198,
708,
430,
279,
4724,
4412,
374,
23665,
323,
18641,
449,
1023,
7766,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.faiss.dependable_faiss_import.html |
43c014563895-0 | langchain.vectorstores.atlas.AtlasDB¶
class langchain.vectorstores.atlas.AtlasDB(name: str, embedding_function: Optional[Embeddings] = None, api_key: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False)[source]¶
Bases: VectorStore
Wrapper around Atlas: Nomic’s neural database and rhizomatic instrument.
To use, you should have the nomic python package installed.
Example
from langchain.vectorstores import AtlasDB
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = AtlasDB("my_project", embeddings.embed_query)
Initialize the Atlas Client
Parameters
name (str) – The name of your project. If the project already exists,
it will be loaded.
embedding_function (Optional[Callable]) – An optional function used for
embedding your data. If None, data will be embedded with
Nomic’s embed model.
api_key (str) – Your nomic API key
description (str) – A description for your project.
is_public (bool) – Whether your project is publicly accessible.
True by default.
reset_project_if_exists (bool) – Whether to reset this project if it
already exists. Default False.
Generally userful during development and testing.
Methods
__init__(name[, embedding_function, ...])
Initialize the Atlas 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,
6990,
14833,
885,
11805,
300,
3590,
55609,
198,
1058,
8859,
8995,
48203,
44569,
6990,
14833,
885,
11805,
300,
3590,
3232,
25,
610,
11,
40188,
9353,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
6464,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
4096,
25,
610,
284,
364,
32,
4096,
369,
701,
2447,
518,
374,
28173,
25,
1845,
284,
3082,
11,
7738,
16756,
11366,
9965,
25,
1845,
284,
3641,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
43443,
25,
452,
3151,
753,
30828,
4729,
323,
22408,
450,
13795,
14473,
627,
1271,
1005,
11,
499,
1288,
617,
279,
308,
3151,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
43443,
3590,
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,
43443,
3590,
446,
2465,
16756,
498,
71647,
41541,
5857,
340,
10130,
279,
43443,
8589,
198,
9905,
198,
609,
320,
496,
8,
1389,
578,
836,
315,
701,
2447,
13,
1442,
279,
2447,
2736,
6866,
345,
275,
690,
387,
6799,
627,
95711,
9353,
320,
15669,
58,
41510,
2526,
1389,
1556,
10309,
734,
1511,
369,
198,
95711,
701,
828,
13,
1442,
2290,
11,
828,
690,
387,
23711,
449,
198,
45,
3151,
753,
11840,
1646,
627,
2113,
3173,
320,
496,
8,
1389,
4718,
308,
3151,
5446,
1401,
198,
4789,
320,
496,
8,
1389,
362,
4096,
369,
701,
2447,
627,
285,
28173,
320,
2707,
8,
1389,
13440,
701,
2447,
374,
17880,
15987,
627,
2575,
555,
1670,
627,
9915,
16756,
11366,
9965,
320,
2707,
8,
1389,
13440,
311,
7738,
420,
2447,
422,
433,
198,
46584,
6866,
13,
8058,
3641,
627,
77641,
1217,
1285,
2391,
4500,
323,
7649,
627,
18337,
198,
565,
2381,
3889,
609,
38372,
4194,
95711,
9353,
11,
4194,
1131,
2608,
10130,
279,
43443,
8589,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-1 | Run more documents through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids, refresh])
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_index(**kwargs)
Creates an index in your project.
delete(ids)
Delete by vector ID.
from_documents(documents[, embedding, ids, ...])
Create an AtlasDB vectorstore from a list of documents.
from_texts(texts[, embedding, metadatas, ...])
Create an AtlasDB vectorstore from a 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]) | [
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,
17611,
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,
3644,
22551,
9872,
340,
55968,
459,
1963,
304,
701,
2447,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
38372,
4194,
95711,
11,
4194,
3447,
11,
4194,
1131,
2608,
4110,
459,
43443,
3590,
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,
459,
43443,
3590,
4724,
4412,
505,
264,
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,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-2 | similarity_search(query[, k])
Run similarity search with AtlasDB
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
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, refresh: bool = True, **kwargs: Any) → List[str][source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
ids (Optional[List[str]]) – An optional list of ids.
refresh (bool) – Whether or not to refresh indices with the updated data.
Default True.
Returns
List of IDs of the added texts. | [
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
6869,
38723,
2778,
449,
43443,
3590,
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,
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,
10625,
25,
1845,
284,
3082,
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,
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,
30716,
1389,
1556,
10309,
1160,
315,
14483,
627,
17611,
320,
2707,
8,
1389,
13440,
477,
539,
311,
10625,
15285,
449,
279,
6177,
828,
627,
3760,
3082,
627,
16851,
198,
861,
315,
29460,
315,
279,
3779,
22755,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-3 | Default True.
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.
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]]¶ | [
3760,
3082,
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,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-4 | Return docs most similar to query.
create_index(**kwargs: Any) → Any[source]¶
Creates an index in your project.
See
https://docs.nomic.ai/atlas_api.html#nomic.project.AtlasProject.create_index
for full detail.
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, ids: Optional[List[str]] = None, name: Optional[str] = None, api_key: Optional[str] = None, persist_directory: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False, index_kwargs: Optional[dict] = None, **kwargs: Any) → AtlasDB[source]¶
Create an AtlasDB vectorstore from a list of documents.
Parameters
name (str) – Name of the collection to create.
api_key (str) – Your nomic API key,
documents (List[Document]) – List of documents to add to the vectorstore.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
ids (Optional[List[str]]) – Optional list of document IDs. If None,
ids will be auto created
description (str) – A description for your project.
is_public (bool) – Whether your project is publicly accessible.
True by default.
reset_project_if_exists (bool) – Whether to reset this project if
it already exists. Default False.
Generally userful during development and testing.
index_kwargs (Optional[dict]) – Dict of kwargs for index creation. | [
5715,
27437,
1455,
4528,
311,
3319,
627,
3261,
3644,
22551,
9872,
25,
5884,
8,
11651,
5884,
76747,
60,
55609,
198,
55968,
459,
1963,
304,
701,
2447,
627,
10031,
198,
2485,
1129,
14452,
1276,
3151,
41483,
81830,
14833,
11959,
2628,
2,
77,
3151,
14844,
885,
11805,
300,
8006,
2581,
3644,
198,
2000,
2539,
7872,
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,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
836,
25,
12536,
17752,
60,
284,
2290,
11,
6464,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
23135,
15191,
25,
12536,
17752,
60,
284,
2290,
11,
4096,
25,
610,
284,
364,
32,
4096,
369,
701,
2447,
518,
374,
28173,
25,
1845,
284,
3082,
11,
7738,
16756,
11366,
9965,
25,
1845,
284,
3641,
11,
1963,
37335,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
43443,
3590,
76747,
60,
55609,
198,
4110,
459,
43443,
3590,
4724,
4412,
505,
264,
1160,
315,
9477,
627,
9905,
198,
609,
320,
496,
8,
1389,
4076,
315,
279,
4526,
311,
1893,
627,
2113,
3173,
320,
496,
8,
1389,
4718,
308,
3151,
5446,
1401,
345,
51878,
320,
861,
58,
7676,
2526,
1389,
1796,
315,
9477,
311,
923,
311,
279,
4724,
4412,
627,
95711,
320,
15669,
58,
26566,
25624,
2526,
1389,
38168,
7113,
734,
13,
37090,
311,
2290,
627,
3447,
320,
15669,
53094,
17752,
30716,
1389,
12536,
1160,
315,
2246,
29460,
13,
1442,
2290,
345,
3447,
690,
387,
3313,
3549,
198,
4789,
320,
496,
8,
1389,
362,
4096,
369,
701,
2447,
627,
285,
28173,
320,
2707,
8,
1389,
13440,
701,
2447,
374,
17880,
15987,
627,
2575,
555,
1670,
627,
9915,
16756,
11366,
9965,
320,
2707,
8,
1389,
13440,
311,
7738,
420,
2447,
422,
198,
275,
2736,
6866,
13,
8058,
3641,
627,
77641,
1217,
1285,
2391,
4500,
323,
7649,
627,
1275,
37335,
320,
15669,
58,
8644,
2526,
1389,
30226,
315,
16901,
369,
1963,
9886,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-5 | index_kwargs (Optional[dict]) – Dict of kwargs for index creation.
See https://docs.nomic.ai/atlas_api.html
Returns
Nomic’s neural database and finest rhizomatic instrument
Return type
AtlasDB
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, name: Optional[str] = None, api_key: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False, index_kwargs: Optional[dict] = None, **kwargs: Any) → AtlasDB[source]¶
Create an AtlasDB vectorstore from a raw documents.
Parameters
texts (List[str]) – The list of texts to ingest.
name (str) – Name of the project to create.
api_key (str) – Your nomic API key,
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) – List of metadatas. Defaults to None.
ids (Optional[List[str]]) – Optional list of document IDs. If None,
ids will be auto created
description (str) – A description for your project.
is_public (bool) – Whether your project is publicly accessible.
True by default.
reset_project_if_exists (bool) – Whether to reset this project if it
already exists. Default False.
Generally userful during development and testing.
index_kwargs (Optional[dict]) – Dict of kwargs for index creation.
See https://docs.nomic.ai/atlas_api.html
Returns
Nomic’s neural database and finest rhizomatic instrument
Return type
AtlasDB | [
1275,
37335,
320,
15669,
58,
8644,
2526,
1389,
30226,
315,
16901,
369,
1963,
9886,
627,
10031,
3788,
1129,
14452,
1276,
3151,
41483,
81830,
14833,
11959,
2628,
198,
16851,
198,
45,
3151,
753,
30828,
4729,
323,
28807,
22408,
450,
13795,
14473,
198,
5715,
955,
198,
62216,
3590,
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,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
836,
25,
12536,
17752,
60,
284,
2290,
11,
6464,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
4096,
25,
610,
284,
364,
32,
4096,
369,
701,
2447,
518,
374,
28173,
25,
1845,
284,
3082,
11,
7738,
16756,
11366,
9965,
25,
1845,
284,
3641,
11,
1963,
37335,
25,
12536,
58,
8644,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
43443,
3590,
76747,
60,
55609,
198,
4110,
459,
43443,
3590,
4724,
4412,
505,
264,
7257,
9477,
627,
9905,
198,
87042,
320,
861,
17752,
2526,
1389,
578,
1160,
315,
22755,
311,
89372,
627,
609,
320,
496,
8,
1389,
4076,
315,
279,
2447,
311,
1893,
627,
2113,
3173,
320,
496,
8,
1389,
4718,
308,
3151,
5446,
1401,
345,
95711,
320,
15669,
58,
26566,
25624,
2526,
1389,
38168,
7113,
734,
13,
37090,
311,
2290,
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,
12536,
1160,
315,
2246,
29460,
13,
1442,
2290,
345,
3447,
690,
387,
3313,
3549,
198,
4789,
320,
496,
8,
1389,
362,
4096,
369,
701,
2447,
627,
285,
28173,
320,
2707,
8,
1389,
13440,
701,
2447,
374,
17880,
15987,
627,
2575,
555,
1670,
627,
9915,
16756,
11366,
9965,
320,
2707,
8,
1389,
13440,
311,
7738,
420,
2447,
422,
433,
198,
46584,
6866,
13,
8058,
3641,
627,
77641,
1217,
1285,
2391,
4500,
323,
7649,
627,
1275,
37335,
320,
15669,
58,
8644,
2526,
1389,
30226,
315,
16901,
369,
1963,
9886,
627,
10031,
3788,
1129,
14452,
1276,
3151,
41483,
81830,
14833,
11959,
2628,
198,
16851,
198,
45,
3151,
753,
30828,
4729,
323,
28807,
22408,
450,
13795,
14473,
198,
5715,
955,
198,
62216,
3590
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-6 | Returns
Nomic’s neural database and finest rhizomatic instrument
Return type
AtlasDB
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]¶ | [
16851,
198,
45,
3151,
753,
30828,
4729,
323,
28807,
22408,
450,
13795,
14473,
198,
5715,
955,
198,
62216,
3590,
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,
627,
1874,
10974,
25,
610,
11,
2778,
1857,
25,
610,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.atlas.AtlasDB.html |
43c014563895-7 | 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 with AtlasDB
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults to 4.
Returns
List of documents 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_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,
6869,
38723,
2778,
449,
43443,
3590,
198,
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,
16851,
198,
861,
315,
9477,
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,
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.atlas.AtlasDB.html |
af806f3a4c7e-0 | langchain.vectorstores.vectara.Vectara¶
class langchain.vectorstores.vectara.Vectara(vectara_customer_id: Optional[str] = None, vectara_corpus_id: Optional[str] = None, vectara_api_key: Optional[str] = None)[source]¶
Bases: VectorStore
Implementation of Vector Store using Vectara (https://vectara.com).
.. rubric:: Example
from langchain.vectorstores import Vectara
vectorstore = Vectara(
vectara_customer_id=vectara_customer_id,
vectara_corpus_id=vectara_corpus_id,
vectara_api_key=vectara_api_key
)
Initialize with Vectara API.
Methods
__init__([vectara_customer_id, ...])
Initialize with Vectara API.
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) | [
5317,
8995,
48203,
44569,
3211,
440,
5169,
5168,
440,
5169,
55609,
198,
1058,
8859,
8995,
48203,
44569,
3211,
440,
5169,
5168,
440,
5169,
3832,
440,
5169,
29940,
851,
25,
12536,
17752,
60,
284,
2290,
11,
56735,
5169,
95326,
851,
25,
12536,
17752,
60,
284,
2290,
11,
56735,
5169,
11959,
3173,
25,
12536,
17752,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
37950,
315,
4290,
9307,
1701,
91256,
5169,
320,
2485,
1129,
76108,
5169,
916,
4390,
497,
10485,
2265,
487,
13688,
198,
1527,
8859,
8995,
48203,
44569,
1179,
91256,
5169,
198,
3295,
4412,
284,
91256,
5169,
1021,
262,
56735,
5169,
29940,
851,
40354,
440,
5169,
29940,
851,
345,
262,
56735,
5169,
95326,
851,
40354,
440,
5169,
95326,
851,
345,
262,
56735,
5169,
11959,
3173,
40354,
440,
5169,
11959,
3173,
198,
340,
10130,
449,
91256,
5169,
5446,
627,
18337,
198,
565,
2381,
565,
2625,
76108,
5169,
29940,
851,
11,
4194,
1131,
2608,
10130,
449,
91256,
5169,
5446,
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,
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,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-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])
Construct Vectara 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, lambda_val, ...])
Return Vectara documents most similar to query, along with scores.
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 Vectara 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] | [
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,
38372,
4194,
95711,
11,
4194,
4150,
329,
19907,
2608,
29568,
91256,
5169,
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,
13231,
6320,
11,
4194,
1131,
2608,
5715,
91256,
5169,
9477,
1455,
4528,
311,
3319,
11,
3235,
449,
12483,
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,
91256,
5169,
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,
60
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-2 | 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, **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.
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. | [
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,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-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) → VectaraRetriever[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.
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: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, **kwargs: Any) → Vectara[source]¶
Construct Vectara wrapper from raw documents. | [
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,
91256,
5169,
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,
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,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
91256,
5169,
76747,
60,
55609,
198,
29568,
91256,
5169,
13564,
505,
7257,
9477,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-4 | Construct Vectara wrapper from raw documents.
This is intended to be a quick way to get started.
.. rubric:: Example
from langchain import Vectara
vectara = Vectara.from_texts(
texts,
vectara_customer_id=customer_id,
vectara_corpus_id=corpus_id,
vectara_api_key=api_key,
)
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 | [
29568,
91256,
5169,
13564,
505,
7257,
9477,
627,
2028,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
627,
497,
10485,
2265,
487,
13688,
198,
1527,
8859,
8995,
1179,
91256,
5169,
198,
76108,
5169,
284,
91256,
5169,
6521,
80746,
1021,
262,
22755,
345,
262,
56735,
5169,
29940,
851,
28,
11296,
851,
345,
262,
56735,
5169,
95326,
851,
28,
6133,
18299,
851,
345,
262,
56735,
5169,
11959,
3173,
28,
2113,
3173,
345,
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,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-5 | 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 = 5, lambda_val: float = 0.025, filter: Optional[str] = None, n_sentence_context: int = 0, **kwargs: Any) → List[Document][source]¶
Return Vectara documents most similar to query, along with scores.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 5.
filter – Dictionary of argument(s) to filter on metadata. For example a
filter can be “doc.rating > 3.0 and part.lang = ‘deu’”} see
https://docs.vectara.com/docs/search-apis/sql/filter-overview for more
details.
n_sentence_context – number of sentences before/after the matching segment
to add
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]]¶ | [
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,
20,
11,
12741,
6320,
25,
2273,
284,
220,
15,
13,
18070,
11,
4141,
25,
12536,
17752,
60,
284,
2290,
11,
308,
49432,
8634,
25,
528,
284,
220,
15,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
5715,
91256,
5169,
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,
20,
627,
5428,
1389,
10685,
315,
5811,
1161,
8,
311,
4141,
389,
11408,
13,
1789,
3187,
264,
198,
5428,
649,
387,
1054,
5349,
49759,
871,
220,
18,
13,
15,
323,
961,
8178,
284,
3451,
451,
84,
529,
863,
92,
1518,
198,
2485,
1129,
14452,
3211,
440,
5169,
916,
27057,
24042,
12,
14041,
60782,
64624,
29352,
1068,
369,
810,
198,
15216,
627,
77,
49432,
8634,
1389,
1396,
315,
23719,
1603,
14,
10924,
279,
12864,
10449,
198,
998,
923,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
af806f3a4c7e-6 | 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 = 5, lambda_val: float = 0.025, filter: Optional[str] = None, n_sentence_context: int = 0, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return Vectara documents most similar to query, along with scores.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 5.
lambda_val – lexical match parameter for hybrid search.
filter – Dictionary of argument(s) to filter on metadata. For example a
filter can be “doc.rating > 3.0 and part.lang = ‘deu’”} see
https://docs.vectara.com/docs/search-apis/sql/filter-overview
for more details.
n_sentence_context – number of sentences before/after the matching segment
to add
Returns
List of Documents most similar to the query and score for each. | [
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,
20,
11,
12741,
6320,
25,
2273,
284,
220,
15,
13,
18070,
11,
4141,
25,
12536,
17752,
60,
284,
2290,
11,
308,
49432,
8634,
25,
528,
284,
220,
15,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
91256,
5169,
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,
20,
627,
13231,
6320,
1389,
78686,
2489,
5852,
369,
26038,
2778,
627,
5428,
1389,
10685,
315,
5811,
1161,
8,
311,
4141,
389,
11408,
13,
1789,
3187,
264,
198,
5428,
649,
387,
1054,
5349,
49759,
871,
220,
18,
13,
15,
323,
961,
8178,
284,
3451,
451,
84,
529,
863,
92,
1518,
198,
2485,
1129,
14452,
3211,
440,
5169,
916,
27057,
24042,
12,
14041,
60782,
64624,
29352,
1068,
198,
2000,
810,
3649,
627,
77,
49432,
8634,
1389,
1396,
315,
23719,
1603,
14,
10924,
279,
12864,
10449,
198,
998,
923,
198,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.vectara.Vectara.html |
f8504f061ad1-0 | langchain.vectorstores.sklearn.ParquetSerializer¶
class langchain.vectorstores.sklearn.ParquetSerializer(persist_path: str)[source]¶
Bases: BaseSerializer
Serializes data in Apache Parquet format using the pyarrow package.
Methods
__init__(persist_path)
extension()
The file extension suggested by this serializer (without dot).
load()
Loads the data from the persist_path
save(data)
Saves the data to the persist_path
classmethod extension() → str[source]¶
The file extension suggested by this serializer (without dot).
load() → Any[source]¶
Loads the data from the persist_path
save(data: Any) → None[source]¶
Saves the data to the persist_path | [
5317,
8995,
48203,
44569,
40554,
12964,
42388,
24181,
14233,
55609,
198,
1058,
8859,
8995,
48203,
44569,
40554,
12964,
42388,
24181,
14233,
1319,
5082,
2703,
25,
610,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
14233,
198,
6040,
4861,
828,
304,
9091,
4366,
24181,
3645,
1701,
279,
4611,
6172,
6462,
627,
18337,
198,
565,
2381,
3889,
40926,
2703,
340,
12709,
746,
791,
1052,
9070,
12090,
555,
420,
22508,
320,
30096,
13046,
4390,
1096,
746,
79617,
279,
828,
505,
279,
23135,
2703,
198,
6766,
2657,
340,
50,
4798,
279,
828,
311,
279,
23135,
2703,
198,
27853,
9070,
368,
11651,
610,
76747,
60,
55609,
198,
791,
1052,
9070,
12090,
555,
420,
22508,
320,
30096,
13046,
4390,
1096,
368,
11651,
5884,
76747,
60,
55609,
198,
79617,
279,
828,
505,
279,
23135,
2703,
198,
6766,
2657,
25,
5884,
8,
11651,
2290,
76747,
60,
55609,
198,
50,
4798,
279,
828,
311,
279,
23135,
2703
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.sklearn.ParquetSerializer.html |
d3ab2791d54f-0 | langchain.vectorstores.singlestoredb.SingleStoreDB¶
class langchain.vectorstores.singlestoredb.SingleStoreDB(embedding: Embeddings, *, distance_strategy: DistanceStrategy = DistanceStrategy.DOT_PRODUCT, table_name: str = 'embeddings', content_field: str = 'content', metadata_field: str = 'metadata', vector_field: str = 'vector', pool_size: int = 5, max_overflow: int = 10, timeout: float = 30, **kwargs: Any)[source]¶
Bases: VectorStore
This class serves as a Pythonic interface to the SingleStore DB database.
The prerequisite for using this class is the installation of the singlestoredb
Python package.
The SingleStoreDB vectorstore can be created by providing an embedding function and
the relevant parameters for the database connection, connection pool, and
optionally, the names of the table and the fields to use.
Initialize with necessary components.
Parameters
embedding (Embeddings) – A text embedding model.
distance_strategy (DistanceStrategy, optional) – Determines the strategy employed for calculating
the distance between vectors in the embedding space.
Defaults to DOT_PRODUCT.
Available options are:
- DOT_PRODUCT: Computes the scalar product of two vectors.
This is the default behavior
EUCLIDEAN_DISTANCE: Computes the Euclidean distance betweentwo vectors. This metric considers the geometric distance in
the vector space, and might be more suitable for embeddings
that rely on spatial relationships.
table_name (str, optional) – Specifies the name of the table in use.
Defaults to “embeddings”.
content_field (str, optional) – Specifies the field to store the content.
Defaults to “content”.
metadata_field (str, optional) – Specifies the field to store metadata.
Defaults to “metadata”. | [
5317,
8995,
48203,
44569,
33401,
4412,
2042,
23993,
6221,
3590,
55609,
198,
1058,
8859,
8995,
48203,
44569,
33401,
4412,
2042,
23993,
6221,
3590,
50825,
7113,
25,
38168,
25624,
11,
12039,
6138,
50408,
25,
32235,
20403,
284,
32235,
20403,
920,
1831,
32950,
11,
2007,
1292,
25,
610,
284,
364,
12529,
25624,
518,
2262,
5121,
25,
610,
284,
364,
1834,
518,
11408,
5121,
25,
610,
284,
364,
18103,
518,
4724,
5121,
25,
610,
284,
364,
3295,
518,
7463,
2424,
25,
528,
284,
220,
20,
11,
1973,
80173,
25,
528,
284,
220,
605,
11,
9829,
25,
2273,
284,
220,
966,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
2028,
538,
17482,
439,
264,
13325,
292,
3834,
311,
279,
11579,
6221,
6078,
4729,
627,
791,
80884,
369,
1701,
420,
538,
374,
279,
14028,
315,
279,
3254,
4412,
2042,
198,
31380,
6462,
627,
791,
11579,
6221,
3590,
4724,
4412,
649,
387,
3549,
555,
8405,
459,
40188,
734,
323,
198,
1820,
9959,
5137,
369,
279,
4729,
3717,
11,
3717,
7463,
11,
323,
198,
2091,
750,
11,
279,
5144,
315,
279,
2007,
323,
279,
5151,
311,
1005,
627,
10130,
449,
5995,
6956,
627,
9905,
198,
95711,
320,
26566,
25624,
8,
1389,
362,
1495,
40188,
1646,
627,
19909,
50408,
320,
15121,
20403,
11,
10309,
8,
1389,
53812,
279,
8446,
20011,
369,
38714,
198,
1820,
6138,
1990,
23728,
304,
279,
40188,
3634,
627,
16672,
311,
49426,
32950,
627,
16892,
2671,
527,
512,
12,
49426,
32950,
25,
66075,
279,
17722,
2027,
315,
1403,
23728,
627,
2028,
374,
279,
1670,
7865,
198,
39907,
3218,
12420,
1111,
64317,
25,
66075,
279,
22730,
51178,
6138,
1297,
906,
306,
1146,
23728,
13,
1115,
18767,
32238,
279,
53584,
6138,
304,
198,
1820,
4724,
3634,
11,
323,
2643,
387,
810,
14791,
369,
71647,
198,
9210,
17631,
389,
29079,
12135,
627,
2048,
1292,
320,
496,
11,
10309,
8,
1389,
46080,
279,
836,
315,
279,
2007,
304,
1005,
627,
16672,
311,
1054,
12529,
25624,
863,
627,
1834,
5121,
320,
496,
11,
10309,
8,
1389,
46080,
279,
2115,
311,
3637,
279,
2262,
627,
16672,
311,
1054,
1834,
863,
627,
18103,
5121,
320,
496,
11,
10309,
8,
1389,
46080,
279,
2115,
311,
3637,
11408,
627,
16672,
311,
1054,
18103,
11453
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-1 | Defaults to “metadata”.
vector_field (str, optional) – Specifies the field to store the vector.
Defaults to “vector”.
pool (Following arguments pertain to the connection) –
pool_size (int, optional) – Determines the number of active connections in
the pool. Defaults to 5.
max_overflow (int, optional) – Determines the maximum number of connections
allowed beyond the pool_size. Defaults to 10.
timeout (float, optional) – Specifies the maximum wait time in seconds for
establishing a connection. Defaults to 30.
connection (database) –
host (str, optional) – Specifies the hostname, IP address, or URL for the
database connection. The default scheme is “mysql”.
user (str, optional) – Database username.
password (str, optional) – Database password.
port (int, optional) – Database port. Defaults to 3306 for non-HTTP
connections, 80 for HTTP connections, and 443 for HTTPS connections.
database (str, optional) – Database name.
the (Additional optional arguments provide further customization over) –
connection –
pure_python (bool, optional) – Toggles the connector mode. If True,
operates in pure Python mode.
local_infile (bool, optional) – Allows local file uploads.
charset (str, optional) – Specifies the character set for string values.
ssl_key (str, optional) – Specifies the path of the file containing the SSL
key.
ssl_cert (str, optional) – Specifies the path of the file containing the SSL
certificate.
ssl_ca (str, optional) – Specifies the path of the file containing the SSL
certificate authority.
ssl_cipher (str, optional) – Sets the SSL cipher list.
ssl_disabled (bool, optional) – Disables SSL usage. | [
16672,
311,
1054,
18103,
863,
627,
3295,
5121,
320,
496,
11,
10309,
8,
1389,
46080,
279,
2115,
311,
3637,
279,
4724,
627,
16672,
311,
1054,
3295,
863,
627,
10497,
320,
28055,
6105,
281,
7770,
311,
279,
3717,
8,
1389,
720,
10497,
2424,
320,
396,
11,
10309,
8,
1389,
53812,
279,
1396,
315,
4642,
13537,
304,
198,
1820,
7463,
13,
37090,
311,
220,
20,
627,
2880,
80173,
320,
396,
11,
10309,
8,
1389,
53812,
279,
7340,
1396,
315,
13537,
198,
21642,
7953,
279,
7463,
2424,
13,
37090,
311,
220,
605,
627,
14482,
320,
3733,
11,
10309,
8,
1389,
46080,
279,
7340,
3868,
892,
304,
6622,
369,
198,
34500,
287,
264,
3717,
13,
37090,
311,
220,
966,
627,
7898,
320,
12494,
8,
1389,
720,
3875,
320,
496,
11,
10309,
8,
1389,
46080,
279,
29215,
11,
6933,
2686,
11,
477,
5665,
369,
279,
198,
12494,
3717,
13,
578,
1670,
13155,
374,
1054,
12552,
863,
627,
882,
320,
496,
11,
10309,
8,
1389,
10199,
6059,
627,
3918,
320,
496,
11,
10309,
8,
1389,
10199,
3636,
627,
403,
320,
396,
11,
10309,
8,
1389,
10199,
2700,
13,
37090,
311,
220,
10568,
21,
369,
2536,
12,
9412,
198,
51086,
11,
220,
1490,
369,
10339,
13537,
11,
323,
220,
17147,
369,
62144,
13537,
627,
12494,
320,
496,
11,
10309,
8,
1389,
10199,
836,
627,
1820,
320,
30119,
10309,
6105,
3493,
4726,
49141,
927,
8,
1389,
720,
7898,
1389,
720,
52833,
56969,
320,
2707,
11,
10309,
8,
1389,
350,
51952,
279,
28087,
3941,
13,
1442,
3082,
345,
3376,
988,
304,
10748,
13325,
3941,
627,
2497,
1265,
1213,
320,
2707,
11,
10309,
8,
1389,
46871,
2254,
1052,
67663,
627,
26395,
320,
496,
11,
10309,
8,
1389,
46080,
279,
3752,
743,
369,
925,
2819,
627,
25658,
3173,
320,
496,
11,
10309,
8,
1389,
46080,
279,
1853,
315,
279,
1052,
8649,
279,
26384,
198,
798,
627,
25658,
38197,
320,
496,
11,
10309,
8,
1389,
46080,
279,
1853,
315,
279,
1052,
8649,
279,
26384,
198,
64686,
627,
25658,
50704,
320,
496,
11,
10309,
8,
1389,
46080,
279,
1853,
315,
279,
1052,
8649,
279,
26384,
198,
64686,
11447,
627,
25658,
77792,
320,
496,
11,
10309,
8,
1389,
12808,
279,
26384,
32188,
1160,
627,
25658,
52501,
320,
2707,
11,
10309,
8,
1389,
4185,
4893,
26384,
10648,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-2 | ssl_disabled (bool, optional) – Disables SSL usage.
ssl_verify_cert (bool, optional) – Verifies the server’s certificate.
Automatically enabled if ssl_ca is specified.
ssl_verify_identity (bool, optional) – Verifies the server’s identity.
conv (dict[int, Callable], optional) – A dictionary of data conversion
functions.
credential_type (str, optional) – Specifies the type of authentication to
use: auth.PASSWORD, auth.JWT, or auth.BROWSER_SSO.
autocommit (bool, optional) – Enables autocommits.
results_type (str, optional) – Determines the structure of the query results:
tuples, namedtuples, dicts.
results_format (str, optional) – Deprecated. This option has been renamed to
results_type.
Examples
Basic Usage:
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import SingleStoreDB
vectorstore = SingleStoreDB(
OpenAIEmbeddings(),
host="https://user:password@127.0.0.1:3306/database"
)
Advanced Usage:
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import SingleStoreDB
vectorstore = SingleStoreDB(
OpenAIEmbeddings(),
distance_strategy=DistanceStrategy.EUCLIDEAN_DISTANCE,
host="127.0.0.1",
port=3306,
user="user",
password="password",
database="db",
table_name="my_custom_table",
pool_size=10,
timeout=60,
)
Using environment variables:
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import SingleStoreDB | [
25658,
52501,
320,
2707,
11,
10309,
8,
1389,
4185,
4893,
26384,
10648,
627,
25658,
36738,
38197,
320,
2707,
11,
10309,
8,
1389,
6383,
9803,
279,
3622,
753,
16125,
627,
42172,
7167,
9147,
422,
34637,
50704,
374,
5300,
627,
25658,
36738,
47344,
320,
2707,
11,
10309,
8,
1389,
6383,
9803,
279,
3622,
753,
9764,
627,
12296,
320,
8644,
19155,
11,
54223,
1145,
10309,
8,
1389,
362,
11240,
315,
828,
14747,
198,
22124,
627,
67899,
1857,
320,
496,
11,
10309,
8,
1389,
46080,
279,
955,
315,
17066,
311,
198,
817,
25,
4259,
1087,
16738,
11,
4259,
100173,
11,
477,
4259,
1823,
55431,
1117,
14202,
627,
2784,
12255,
1800,
320,
2707,
11,
10309,
8,
1389,
77416,
3154,
12255,
45803,
627,
8234,
1857,
320,
496,
11,
10309,
8,
1389,
53812,
279,
6070,
315,
279,
3319,
3135,
512,
83,
29423,
11,
7086,
83,
29423,
11,
98699,
627,
8234,
9132,
320,
496,
11,
10309,
8,
1389,
85016,
13,
1115,
3072,
706,
1027,
28379,
311,
198,
8234,
1857,
627,
41481,
198,
16323,
25585,
512,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
1527,
8859,
8995,
48203,
44569,
1179,
11579,
6221,
3590,
198,
3295,
4412,
284,
11579,
6221,
3590,
1021,
262,
5377,
15836,
26566,
25624,
3227,
262,
3552,
429,
2485,
1129,
882,
25,
3918,
31,
6804,
13,
15,
13,
15,
13,
16,
25,
10568,
21,
42705,
702,
340,
36557,
25585,
512,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
1527,
8859,
8995,
48203,
44569,
1179,
11579,
6221,
3590,
198,
3295,
4412,
284,
11579,
6221,
3590,
1021,
262,
5377,
15836,
26566,
25624,
3227,
262,
6138,
50408,
28,
15121,
20403,
5253,
52,
3218,
12420,
1111,
64317,
345,
262,
3552,
429,
6804,
13,
15,
13,
15,
13,
16,
761,
262,
2700,
28,
10568,
21,
345,
262,
1217,
429,
882,
761,
262,
3636,
429,
3918,
761,
262,
4729,
429,
2042,
761,
262,
2007,
1292,
429,
2465,
16254,
5350,
761,
262,
7463,
2424,
28,
605,
345,
262,
9829,
28,
1399,
345,
340,
16834,
4676,
7482,
512,
1527,
8859,
8995,
41541,
25624,
1179,
5377,
15836,
26566,
25624,
198,
1527,
8859,
8995,
48203,
44569,
1179,
11579,
6221,
3590
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-3 | from langchain.vectorstores import SingleStoreDB
os.environ['SINGLESTOREDB_URL'] = 'me:p455w0rd@s2-host.com/my_db'
vectorstore = SingleStoreDB(OpenAIEmbeddings())
Methods
__init__(embedding, *[, distance_strategy, ...])
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, ...])
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. | [
1527,
8859,
8995,
48203,
44569,
1179,
11579,
6221,
3590,
198,
437,
24656,
681,
50,
26780,
45050,
3590,
8159,
663,
284,
364,
2727,
45489,
20325,
86,
15,
6634,
61677,
17,
39689,
916,
35298,
8856,
1270,
3295,
4412,
284,
11579,
6221,
3590,
7,
5109,
15836,
26566,
25624,
2455,
18337,
198,
565,
2381,
3889,
95711,
11,
4194,
9,
38372,
4194,
19909,
50408,
11,
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,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-4 | Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas, ...])
Create a SingleStoreDB vectorstore from raw documents. This is a user-friendly interface that: 1. Embeds documents. 2. Creates a new table for the embeddings in SingleStoreDB. 3. Adds the documents to the newly created table. This is intended to be a quick way to get started. .. rubric:: Example.
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])
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_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.
Attributes
vector_field
Pass the rest of the kwargs to the connection.
connection_kwargs
Add program name and version to connection attributes.
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]¶ | [
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,
4110,
264,
11579,
6221,
3590,
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,
2007,
369,
279,
71647,
304,
11579,
6221,
3590,
13,
220,
18,
13,
25483,
279,
9477,
311,
279,
13945,
3549,
2007,
13,
1115,
374,
10825,
311,
387,
264,
4062,
1648,
311,
636,
3940,
13,
5354,
10485,
2265,
487,
13688,
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,
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,
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,
10738,
198,
3295,
5121,
198,
12465,
279,
2800,
315,
279,
16901,
311,
279,
3717,
627,
7898,
37335,
198,
2261,
2068,
836,
323,
2373,
311,
3717,
8365,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-5 | 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, embeddings: Optional[List[List[float]]] = None, **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.
Returns
empty list
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. | [
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,
71647,
25,
12536,
53094,
53094,
96481,
5163,
60,
284,
2290,
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,
16851,
198,
3274,
1160,
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.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-6 | 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) → SingleStoreDBRetriever[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.
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,
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,
11579,
6221,
3590,
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,
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.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-7 | Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, distance_strategy: DistanceStrategy = DistanceStrategy.DOT_PRODUCT, table_name: str = 'embeddings', content_field: str = 'content', metadata_field: str = 'metadata', vector_field: str = 'vector', pool_size: int = 5, max_overflow: int = 10, timeout: float = 30, **kwargs: Any) → SingleStoreDB[source]¶
Create a SingleStoreDB vectorstore from raw documents.
This is a user-friendly interface that:
Embeds documents.
Creates a new table for the embeddings in SingleStoreDB.
Adds the documents to the newly created table.
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. | [
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,
6138,
50408,
25,
32235,
20403,
284,
32235,
20403,
920,
1831,
32950,
11,
2007,
1292,
25,
610,
284,
364,
12529,
25624,
518,
2262,
5121,
25,
610,
284,
364,
1834,
518,
11408,
5121,
25,
610,
284,
364,
18103,
518,
4724,
5121,
25,
610,
284,
364,
3295,
518,
7463,
2424,
25,
528,
284,
220,
20,
11,
1973,
80173,
25,
528,
284,
220,
605,
11,
9829,
25,
2273,
284,
220,
966,
11,
3146,
9872,
25,
5884,
8,
11651,
11579,
6221,
3590,
76747,
60,
55609,
198,
4110,
264,
11579,
6221,
3590,
4724,
4412,
505,
7257,
9477,
627,
2028,
374,
264,
1217,
22658,
3834,
430,
512,
26566,
82,
9477,
627,
55968,
264,
502,
2007,
369,
279,
71647,
304,
11579,
6221,
3590,
627,
73211,
279,
9477,
311,
279,
13945,
3549,
2007,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-8 | 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, filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Returns the most similar indexed documents to the query text.
Uses cosine similarity.
Parameters
query (str) – The query text for which to find similar documents.
k (int) – The number of documents to return. Default is 4.
filter (dict) – A dictionary of metadata fields and values to filter by.
Returns
A list of documents that are most similar to the query text.
Return type
List[Document]
Examples
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶ | [
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,
4141,
25,
12536,
58,
8644,
60,
284,
2290,
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,
70065,
76359,
38723,
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,
5428,
320,
8644,
8,
1389,
362,
11240,
315,
11408,
5151,
323,
2819,
311,
4141,
555,
627,
16851,
198,
32,
1160,
315,
9477,
430,
527,
1455,
4528,
311,
279,
3319,
1495,
627,
5715,
955,
198,
861,
58,
7676,
933,
41481,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
d3ab2791d54f-9 | 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) → List[Tuple[Document, float]][source]¶
Return docs most similar to query. Uses cosine similarity.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – A dictionary of metadata fields and values to filter by.
Defaults to None.
Returns
List of Documents most similar to the query and score for each
connection_kwargs¶
Add program name and version to connection attributes.
vector_field¶
Pass the rest of the kwargs to the connection. | [
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,
8,
11651,
1796,
20961,
6189,
58,
7676,
11,
2273,
28819,
2484,
60,
55609,
198,
5715,
27437,
1455,
4528,
311,
3319,
13,
39923,
76359,
38723,
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,
362,
11240,
315,
11408,
5151,
323,
2819,
311,
4141,
555,
627,
16672,
311,
2290,
627,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
323,
5573,
369,
1855,
198,
7898,
37335,
55609,
198,
2261,
2068,
836,
323,
2373,
311,
3717,
8365,
627,
3295,
5121,
55609,
198,
12465,
279,
2800,
315,
279,
16901,
311,
279,
3717,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.singlestoredb.SingleStoreDB.html |
6a656ca57d75-0 | langchain.vectorstores.alibabacloud_opensearch.create_metadata¶
langchain.vectorstores.alibabacloud_opensearch.create_metadata(fields: Dict[str, Any]) → Dict[str, Any][source]¶
Create metadata from fields.
Parameters
fields – The fields of the document. The fields must be a dict.
Returns
The metadata of the document. The metadata must be a dict.
Return type
metadata | [
5317,
8995,
48203,
44569,
49762,
12641,
10499,
1137,
1132,
2581,
23012,
55609,
198,
5317,
8995,
48203,
44569,
49762,
12641,
10499,
1137,
1132,
2581,
23012,
38801,
25,
30226,
17752,
11,
5884,
2526,
11651,
30226,
17752,
11,
5884,
1483,
2484,
60,
55609,
198,
4110,
11408,
505,
5151,
627,
9905,
198,
9184,
1389,
578,
5151,
315,
279,
2246,
13,
578,
5151,
2011,
387,
264,
6587,
627,
16851,
198,
791,
11408,
315,
279,
2246,
13,
578,
11408,
2011,
387,
264,
6587,
627,
5715,
955,
198,
18103
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.create_metadata.html |
dd853a8e5584-0 | langchain.vectorstores.chroma.Chroma¶
class langchain.vectorstores.chroma.Chroma(collection_name: str = 'langchain', embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, collection_metadata: Optional[Dict] = None, client: Optional[chromadb.Client] = None)[source]¶
Bases: VectorStore
Wrapper around ChromaDB embeddings platform.
To use, you should have the chromadb python package installed.
Example
from langchain.vectorstores import Chroma
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Chroma("langchain_store", embeddings)
Initialize with Chroma client.
Methods
__init__([collection_name, ...])
Initialize with Chroma 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(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs) | [
5317,
8995,
48203,
44569,
5442,
58084,
6487,
58084,
55609,
198,
1058,
8859,
8995,
48203,
44569,
5442,
58084,
6487,
58084,
36966,
1292,
25,
610,
284,
364,
5317,
8995,
518,
40188,
9353,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
23135,
15191,
25,
12536,
17752,
60,
284,
2290,
11,
3016,
11090,
25,
12536,
58,
41484,
40691,
5539,
28098,
60,
284,
2290,
11,
4526,
23012,
25,
12536,
58,
13755,
60,
284,
2290,
11,
3016,
25,
12536,
58,
41484,
40691,
11978,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
11803,
2212,
35318,
64,
3590,
71647,
5452,
627,
1271,
1005,
11,
499,
1288,
617,
279,
22083,
40691,
10344,
6462,
10487,
627,
13617,
198,
1527,
8859,
8995,
48203,
44569,
1179,
35318,
64,
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,
35318,
64,
446,
5317,
8995,
15153,
498,
71647,
340,
10130,
449,
35318,
64,
3016,
627,
18337,
198,
565,
2381,
565,
2625,
13727,
1292,
11,
4194,
1131,
2608,
10130,
449,
35318,
64,
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,
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,
8
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-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 IDs.
delete_collection()
Delete the collection.
from_documents(documents[, embedding, ids, ...])
Create a Chroma vectorstore from a list of documents.
from_texts(texts[, embedding, metadatas, ...])
Create a Chroma vectorstore from a raw documents.
get([ids, where, limit, offset, ...])
Gets the collection.
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.
persist()
Persist the collection.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter])
Run similarity search with Chroma.
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])
Run similarity search with Chroma with distance.
update_document(document_id, document)
Update a document in the collection. | [
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,
29460,
627,
4644,
26071,
746,
6571,
279,
4526,
627,
1527,
77027,
19702,
2901,
38372,
4194,
95711,
11,
4194,
3447,
11,
4194,
1131,
2608,
4110,
264,
35318,
64,
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,
35318,
64,
4724,
4412,
505,
264,
7257,
9477,
627,
456,
2625,
3447,
11,
4194,
2940,
11,
4194,
9696,
11,
4194,
3255,
11,
4194,
1131,
2608,
50458,
279,
4526,
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,
40926,
746,
62367,
279,
4526,
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,
2608,
6869,
38723,
2778,
449,
35318,
64,
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,
6869,
38723,
2778,
449,
35318,
64,
449,
6138,
627,
2443,
27326,
15649,
851,
11,
4194,
6190,
340,
4387,
264,
2246,
304,
279,
4526,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-2 | update_document(document_id, document)
Update a document in the collection.
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 embeddings and add to the vectorstore.
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. | [
2443,
27326,
15649,
851,
11,
4194,
6190,
340,
4387,
264,
2246,
304,
279,
4526,
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,
71647,
323,
923,
311,
279,
4724,
4412,
627,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-3 | 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.
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]) → None[source]¶
Delete by vector IDs.
Parameters
ids – List of ids to delete.
delete_collection() → None[source]¶
Delete the collection. | [
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,
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,
2290,
76747,
60,
55609,
198,
6571,
555,
4724,
29460,
627,
9905,
198,
3447,
1389,
1796,
315,
14483,
311,
3783,
627,
4644,
26071,
368,
11651,
2290,
76747,
60,
55609,
198,
6571,
279,
4526,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-4 | delete_collection() → None[source]¶
Delete the collection.
classmethod from_documents(documents: List[Document], embedding: Optional[Embeddings] = None, ids: Optional[List[str]] = None, collection_name: str = 'langchain', persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, client: Optional[chromadb.Client] = None, **kwargs: Any) → Chroma[source]¶
Create a Chroma vectorstore from a list of documents.
If a persist_directory is specified, the collection will be persisted there.
Otherwise, the data will be ephemeral in-memory.
Parameters
collection_name (str) – Name of the collection to create.
persist_directory (Optional[str]) – Directory to persist the collection.
ids (Optional[List[str]]) – List of document IDs. Defaults to None.
documents (List[Document]) – List of documents to add to the vectorstore.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
client_settings (Optional[chromadb.config.Settings]) – Chroma client settings
Returns
Chroma vectorstore.
Return type
Chroma
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, collection_name: str = 'langchain', persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, client: Optional[chromadb.Client] = None, **kwargs: Any) → Chroma[source]¶
Create a Chroma vectorstore from a raw documents.
If a persist_directory is specified, the collection will be persisted there.
Otherwise, the data will be ephemeral in-memory.
Parameters
texts (List[str]) – List of texts to add to the collection. | [
4644,
26071,
368,
11651,
2290,
76747,
60,
55609,
198,
6571,
279,
4526,
627,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
4526,
1292,
25,
610,
284,
364,
5317,
8995,
518,
23135,
15191,
25,
12536,
17752,
60,
284,
2290,
11,
3016,
11090,
25,
12536,
58,
41484,
40691,
5539,
28098,
60,
284,
2290,
11,
3016,
25,
12536,
58,
41484,
40691,
11978,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
35318,
64,
76747,
60,
55609,
198,
4110,
264,
35318,
64,
4724,
4412,
505,
264,
1160,
315,
9477,
627,
2746,
264,
23135,
15191,
374,
5300,
11,
279,
4526,
690,
387,
54095,
1070,
627,
81556,
11,
279,
828,
690,
387,
83234,
3333,
304,
65196,
627,
9905,
198,
13727,
1292,
320,
496,
8,
1389,
4076,
315,
279,
4526,
311,
1893,
627,
40926,
15191,
320,
15669,
17752,
2526,
1389,
18524,
311,
23135,
279,
4526,
627,
3447,
320,
15669,
53094,
17752,
30716,
1389,
1796,
315,
2246,
29460,
13,
37090,
311,
2290,
627,
51878,
320,
861,
58,
7676,
2526,
1389,
1796,
315,
9477,
311,
923,
311,
279,
4724,
4412,
627,
95711,
320,
15669,
58,
26566,
25624,
2526,
1389,
38168,
7113,
734,
13,
37090,
311,
2290,
627,
3045,
11090,
320,
15669,
58,
41484,
40691,
5539,
28098,
2526,
1389,
35318,
64,
3016,
5110,
198,
16851,
198,
1163,
58084,
4724,
4412,
627,
5715,
955,
198,
1163,
58084,
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,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
4526,
1292,
25,
610,
284,
364,
5317,
8995,
518,
23135,
15191,
25,
12536,
17752,
60,
284,
2290,
11,
3016,
11090,
25,
12536,
58,
41484,
40691,
5539,
28098,
60,
284,
2290,
11,
3016,
25,
12536,
58,
41484,
40691,
11978,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
35318,
64,
76747,
60,
55609,
198,
4110,
264,
35318,
64,
4724,
4412,
505,
264,
7257,
9477,
627,
2746,
264,
23135,
15191,
374,
5300,
11,
279,
4526,
690,
387,
54095,
1070,
627,
81556,
11,
279,
828,
690,
387,
83234,
3333,
304,
65196,
627,
9905,
198,
87042,
320,
861,
17752,
2526,
1389,
1796,
315,
22755,
311,
923,
311,
279,
4526,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-5 | Parameters
texts (List[str]) – List of texts to add to the collection.
collection_name (str) – Name of the collection to create.
persist_directory (Optional[str]) – Directory to persist the collection.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) – List of metadatas. Defaults to None.
ids (Optional[List[str]]) – List of document IDs. Defaults to None.
client_settings (Optional[chromadb.config.Settings]) – Chroma client settings
Returns
Chroma vectorstore.
Return type
Chroma
get(ids: Optional[OneOrMany[ID]] = None, where: Optional[Where] = None, limit: Optional[int] = None, offset: Optional[int] = None, where_document: Optional[WhereDocument] = None, include: Optional[List[str]] = None) → Dict[str, Any][source]¶
Gets the collection.
Parameters
ids – The ids of the embeddings to get. Optional.
where – A Where type dict used to filter results by.
E.g. {“color” : “red”, “price”: 4.20}. Optional.
limit – The number of documents to return. Optional.
offset – The offset to start returning results from.
Useful for paging results with limit. Optional.
where_document – A WhereDocument type dict used to filter by the documents.
E.g. {$contains: {“text”: “hello”}}. Optional.
include – A list of what to include in the results.
Can contain “embeddings”, “metadatas”, “documents”.
Ids are always included.
Defaults to [“metadatas”, “documents”]. Optional. | [
9905,
198,
87042,
320,
861,
17752,
2526,
1389,
1796,
315,
22755,
311,
923,
311,
279,
4526,
627,
13727,
1292,
320,
496,
8,
1389,
4076,
315,
279,
4526,
311,
1893,
627,
40926,
15191,
320,
15669,
17752,
2526,
1389,
18524,
311,
23135,
279,
4526,
627,
95711,
320,
15669,
58,
26566,
25624,
2526,
1389,
38168,
7113,
734,
13,
37090,
311,
2290,
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,
3045,
11090,
320,
15669,
58,
41484,
40691,
5539,
28098,
2526,
1389,
35318,
64,
3016,
5110,
198,
16851,
198,
1163,
58084,
4724,
4412,
627,
5715,
955,
198,
1163,
58084,
198,
456,
44548,
25,
12536,
58,
4054,
2244,
8607,
89477,
5163,
284,
2290,
11,
1405,
25,
12536,
58,
9241,
60,
284,
2290,
11,
4017,
25,
12536,
19155,
60,
284,
2290,
11,
4445,
25,
12536,
19155,
60,
284,
2290,
11,
1405,
27326,
25,
12536,
58,
9241,
7676,
60,
284,
2290,
11,
2997,
25,
12536,
53094,
17752,
5163,
284,
2290,
8,
11651,
30226,
17752,
11,
5884,
1483,
2484,
60,
55609,
198,
50458,
279,
4526,
627,
9905,
198,
3447,
1389,
578,
14483,
315,
279,
71647,
311,
636,
13,
12536,
627,
2940,
1389,
362,
11208,
955,
6587,
1511,
311,
4141,
3135,
555,
627,
36,
1326,
13,
314,
2118,
3506,
863,
551,
1054,
1171,
9520,
1054,
6692,
57633,
220,
19,
13,
508,
7966,
12536,
627,
9696,
1389,
578,
1396,
315,
9477,
311,
471,
13,
12536,
627,
3255,
1389,
578,
4445,
311,
1212,
13758,
3135,
505,
627,
10464,
1285,
369,
57387,
3135,
449,
4017,
13,
12536,
627,
2940,
27326,
1389,
362,
11208,
7676,
955,
6587,
1511,
311,
4141,
555,
279,
9477,
627,
36,
1326,
13,
14249,
13676,
25,
314,
2118,
1342,
57633,
1054,
15339,
863,
3500,
13,
12536,
627,
1012,
1389,
362,
1160,
315,
1148,
311,
2997,
304,
279,
3135,
627,
6854,
6782,
1054,
12529,
25624,
9520,
1054,
4150,
329,
19907,
9520,
1054,
51878,
863,
627,
12990,
527,
2744,
5343,
627,
16672,
311,
510,
2118,
4150,
329,
19907,
9520,
1054,
51878,
863,
948,
12536,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-6 | Defaults to [“metadatas”, “documents”]. Optional.
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, 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.
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.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → 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. | [
16672,
311,
510,
2118,
4150,
329,
19907,
9520,
1054,
51878,
863,
948,
12536,
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,
4141,
25,
12536,
58,
13755,
17752,
11,
610,
5163,
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,
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,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
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,
13755,
17752,
11,
610,
5163,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-7 | to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
Returns
List of Documents selected by maximal marginal relevance.
persist() → None[source]¶
Persist the collection.
This can be used to explicitly persist the data to disk.
It will also be called automatically when the object is destroyed.
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[str, str]] = None, **kwargs: Any) → List[Document][source]¶
Run similarity search with Chroma.
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 text.
Return type
List[Document]
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to embedding vector.
:param embedding: Embedding to look up documents similar to.
:type embedding: str
:param k: Number of Documents to return. Defaults to 4.
:type k: int
:param filter: Filter by metadata. Defaults to None.
:type filter: Optional[Dict[str, str]]
Returns
List of Documents most similar to the query vector. | [
998,
7340,
20057,
323,
220,
16,
311,
8187,
20057,
627,
16672,
311,
220,
15,
13,
20,
627,
5428,
320,
15669,
58,
13755,
17752,
11,
610,
30716,
1389,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
16851,
198,
861,
315,
45890,
4183,
555,
54229,
32873,
41961,
627,
40926,
368,
11651,
2290,
76747,
60,
55609,
198,
62367,
279,
4526,
627,
2028,
649,
387,
1511,
311,
21650,
23135,
279,
828,
311,
13668,
627,
2181,
690,
1101,
387,
2663,
9651,
994,
279,
1665,
374,
14763,
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,
13755,
17752,
11,
610,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
6869,
38723,
2778,
449,
35318,
64,
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,
9477,
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,
4141,
25,
12536,
58,
13755,
17752,
11,
610,
5163,
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,
68416,
40188,
25,
38168,
7113,
311,
1427,
709,
9477,
4528,
311,
627,
47545,
40188,
25,
610,
198,
68416,
597,
25,
5742,
315,
45890,
311,
471,
13,
37090,
311,
220,
19,
627,
47545,
597,
25,
528,
198,
68416,
4141,
25,
12619,
555,
11408,
13,
37090,
311,
2290,
627,
47545,
4141,
25,
12536,
58,
13755,
17752,
11,
610,
14623,
16851,
198,
861,
315,
45890,
1455,
4528,
311,
279,
3319,
4724,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
dd853a8e5584-8 | 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[str, str]] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Run similarity search with Chroma 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 text and cosine distance in float for each.
Lower score represents more similarity.
Return type
List[Tuple[Document, float]]
update_document(document_id: str, document: Document) → None[source]¶
Update a document in the collection.
Parameters
document_id (str) – ID of the document to update.
document (Document) – Document to update. | [
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,
13755,
17752,
11,
610,
5163,
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,
35318,
64,
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,
9477,
1455,
4528,
311,
198,
1820,
3319,
1495,
323,
76359,
6138,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
5715,
955,
198,
861,
20961,
6189,
58,
7676,
11,
2273,
14623,
2443,
27326,
15649,
851,
25,
610,
11,
2246,
25,
12051,
8,
11651,
2290,
76747,
60,
55609,
198,
4387,
264,
2246,
304,
279,
4526,
627,
9905,
198,
6190,
851,
320,
496,
8,
1389,
3110,
315,
279,
2246,
311,
2713,
627,
6190,
320,
7676,
8,
1389,
12051,
311,
2713,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
9e7a07182c23-0 | langchain.vectorstores.analyticdb.AnalyticDB¶
class langchain.vectorstores.analyticdb.AnalyticDB(connection_string: str, embedding_function: Embeddings, embedding_dimension: int = 1536, collection_name: str = 'langchain_document', pre_delete_collection: bool = False, logger: Optional[Logger] = None)[source]¶
Bases: VectorStore
VectorStore implementation using AnalyticDB.
AnalyticDB is a distributed full PostgresSQL syntax cloud-native database.
- connection_string is a postgres connection string.
- embedding_function any embedding function implementing
langchain.embeddings.base.Embeddings interface.
collection_name is the name of the collection to use. (default: langchain)
NOTE: This is not the name of the table, but the name of the collection.The tables will be created when initializing the store (if not exists)
So, make sure the user has the right permissions to create tables.
pre_delete_collection if True, will delete the collection 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_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. | [
5317,
8995,
48203,
44569,
10985,
5893,
29150,
2042,
8794,
5893,
29150,
3590,
55609,
198,
1058,
8859,
8995,
48203,
44569,
10985,
5893,
29150,
2042,
8794,
5893,
29150,
3590,
25119,
3991,
25,
610,
11,
40188,
9353,
25,
38168,
25624,
11,
40188,
50719,
25,
528,
284,
220,
9800,
21,
11,
4526,
1292,
25,
610,
284,
364,
5317,
8995,
27326,
518,
864,
11607,
26071,
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,
38527,
29150,
3590,
627,
74407,
29150,
3590,
374,
264,
4332,
2539,
3962,
18297,
6827,
20047,
9624,
15971,
4729,
627,
12,
3717,
3991,
374,
264,
60926,
3717,
925,
627,
12,
40188,
9353,
904,
40188,
734,
25976,
198,
5317,
8995,
41541,
25624,
9105,
58955,
25624,
3834,
627,
13727,
1292,
374,
279,
836,
315,
279,
4526,
311,
1005,
13,
320,
2309,
25,
8859,
8995,
340,
28892,
25,
1115,
374,
539,
279,
836,
315,
279,
2007,
11,
719,
279,
836,
315,
279,
4526,
11829,
12920,
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,
26071,
422,
3082,
11,
690,
3783,
279,
4526,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-1 | 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(driver, ...)
Return connection string from database parameters.
create_collection()
create_table_if_not_exists()
delete(ids)
Delete by vector ID.
delete_collection()
from_documents(documents, embedding[, ...])
Return VectorStore initialized from documents and 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.
similarity_search(query[, k, filter])
Run similarity search with AnalyticDB 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]. | [
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,
24994,
11,
4194,
32318,
5715,
3717,
925,
505,
4729,
5137,
627,
3261,
26071,
746,
3261,
5350,
11366,
8072,
9965,
746,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
4644,
26071,
746,
1527,
77027,
19702,
2901,
11,
4194,
95711,
38372,
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,
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,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
11,
4194,
5428,
2608,
6869,
38723,
2778,
449,
38527,
29150,
3590,
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,
948
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-2 | 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_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_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.
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. | [
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,
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,
7309,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-3 | 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.
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(driver: str, host: str, port: int, database: str, user: str, password: str) → str[source]¶ | [
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,
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,
24994,
25,
610,
11,
3552,
25,
610,
11,
2700,
25,
528,
11,
4729,
25,
610,
11,
1217,
25,
610,
11,
3636,
25,
610,
8,
11651,
610,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-4 | Return connection string from database parameters.
create_collection() → None[source]¶
create_table_if_not_exists() → 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]
delete_collection() → None[source]¶
classmethod from_documents(documents: List[Document], embedding: Embeddings, embedding_dimension: int = 1536, collection_name: str = 'langchain_document', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any) → AnalyticDB[source]¶
Return VectorStore initialized from documents and embeddings.
Postgres Connection string is required
Either pass it as a parameter
or set the PG_CONNECTION_STRING environment variable.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, embedding_dimension: int = 1536, collection_name: str = 'langchain_document', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any) → AnalyticDB[source]¶
Return VectorStore initialized from texts and embeddings.
Postgres Connection string is required
Either pass it as a parameter
or set the PG_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 | [
5715,
3717,
925,
505,
4729,
5137,
627,
3261,
26071,
368,
11651,
2290,
76747,
60,
55609,
198,
3261,
5350,
11366,
8072,
9965,
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,
4644,
26071,
368,
11651,
2290,
76747,
60,
55609,
198,
27853,
505,
77027,
19702,
2901,
25,
1796,
58,
7676,
1145,
40188,
25,
38168,
25624,
11,
40188,
50719,
25,
528,
284,
220,
9800,
21,
11,
4526,
1292,
25,
610,
284,
364,
5317,
8995,
27326,
518,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
864,
11607,
26071,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
38527,
29150,
3590,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
4226,
18297,
11278,
925,
374,
2631,
198,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31144,
41808,
12563,
4676,
3977,
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,
40188,
50719,
25,
528,
284,
220,
9800,
21,
11,
4526,
1292,
25,
610,
284,
364,
5317,
8995,
27326,
518,
14483,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
864,
11607,
26071,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
38527,
29150,
3590,
76747,
60,
55609,
198,
5715,
4290,
6221,
17719,
505,
22755,
323,
71647,
627,
4226,
18297,
11278,
925,
374,
2631,
198,
50344,
1522,
433,
439,
264,
5852,
198,
269,
743,
279,
31144,
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
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-5 | 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.
similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Run similarity search with AnalyticDB with distance.
Parameters
query (str) – Query text to search for. | [
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,
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,
38527,
29150,
3590,
449,
6138,
627,
9905,
198,
1663,
320,
496,
8,
1389,
11615,
1495,
311,
2778,
369,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-6 | 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
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. | [
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.analyticdb.AnalyticDB.html |
9e7a07182c23-7 | 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,
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.analyticdb.AnalyticDB.html |
8be6a4ebf49e-0 | langchain.vectorstores.sklearn.BaseSerializer¶
class langchain.vectorstores.sklearn.BaseSerializer(persist_path: str)[source]¶
Bases: ABC
Abstract base class for saving and loading data.
Methods
__init__(persist_path)
extension()
The file extension suggested by this serializer (without dot).
load()
Loads the data from the persist_path
save(data)
Saves the data to the persist_path
abstract classmethod extension() → str[source]¶
The file extension suggested by this serializer (without dot).
abstract load() → Any[source]¶
Loads the data from the persist_path
abstract save(data: Any) → None[source]¶
Saves the data to the persist_path | [
5317,
8995,
48203,
44569,
40554,
12964,
13316,
14233,
55609,
198,
1058,
8859,
8995,
48203,
44569,
40554,
12964,
13316,
14233,
1319,
5082,
2703,
25,
610,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
19921,
198,
16328,
2385,
538,
369,
14324,
323,
8441,
828,
627,
18337,
198,
565,
2381,
3889,
40926,
2703,
340,
12709,
746,
791,
1052,
9070,
12090,
555,
420,
22508,
320,
30096,
13046,
4390,
1096,
746,
79617,
279,
828,
505,
279,
23135,
2703,
198,
6766,
2657,
340,
50,
4798,
279,
828,
311,
279,
23135,
2703,
198,
16647,
538,
4492,
9070,
368,
11651,
610,
76747,
60,
55609,
198,
791,
1052,
9070,
12090,
555,
420,
22508,
320,
30096,
13046,
4390,
16647,
2865,
368,
11651,
5884,
76747,
60,
55609,
198,
79617,
279,
828,
505,
279,
23135,
2703,
198,
16647,
3665,
2657,
25,
5884,
8,
11651,
2290,
76747,
60,
55609,
198,
50,
4798,
279,
828,
311,
279,
23135,
2703
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.sklearn.BaseSerializer.html |
f87148a21e93-0 | langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch¶
class langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch(doc_index: BaseDocIndex, embedding: Embeddings)[source]¶
Bases: DocArrayIndex
Wrapper around HnswLib storage.
To use it, you should have the docarray package with version >=0.32.0 installed.
You can install it with pip install “langchain[docarray]”.
Initialize a vector store from DocArray’s DocIndex.
Methods
__init__(doc_index, embedding)
Initialize a vector store from DocArray's DocIndex.
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. | [
5317,
8995,
48203,
44569,
24595,
1686,
870,
77,
2332,
43552,
1895,
39,
77,
2332,
6014,
55609,
198,
1058,
8859,
8995,
48203,
44569,
24595,
1686,
870,
77,
2332,
43552,
1895,
39,
77,
2332,
6014,
19702,
3644,
25,
5464,
9743,
1581,
11,
40188,
25,
38168,
25624,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
22452,
1895,
1581,
198,
11803,
2212,
473,
77,
2332,
9374,
5942,
627,
1271,
1005,
433,
11,
499,
1288,
617,
279,
4733,
1686,
6462,
449,
2373,
2669,
15,
13,
843,
13,
15,
10487,
627,
2675,
649,
4685,
433,
449,
24547,
4685,
1054,
5317,
8995,
58,
5349,
1686,
60,
863,
627,
10130,
264,
4724,
3637,
505,
22452,
1895,
753,
22452,
1581,
627,
18337,
198,
565,
2381,
3889,
5349,
3644,
11,
4194,
95711,
340,
10130,
264,
4724,
3637,
505,
22452,
1895,
596,
22452,
1581,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-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_params(embedding, work_dir, n_dim[, ...])
Initialize DocArrayHnswSearch store.
from_texts(texts, embedding[, metadatas, ...])
Create an DocArrayHnswSearch store and insert data.
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 most similar to query.
Attributes
doc_cls
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] | [
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,
6887,
50825,
7113,
11,
4194,
1816,
4432,
11,
4194,
77,
11024,
38372,
4194,
1131,
2608,
10130,
22452,
1895,
39,
77,
2332,
6014,
3637,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
11,
4194,
1131,
2608,
4110,
459,
22452,
1895,
39,
77,
2332,
6014,
3637,
323,
5774,
828,
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,
1455,
4528,
311,
3319,
627,
10738,
198,
5349,
39756,
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,
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.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-2 | 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, **kwargs: Any) → List[str]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
Returns
List of ids from adding the texts into the vectorstore.
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,
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,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-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. | [
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.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-4 | Return VectorStore initialized from documents and embeddings.
classmethod from_params(embedding: Embeddings, work_dir: str, n_dim: int, dist_metric: Literal['cosine', 'ip', 'l2'] = 'cosine', max_elements: int = 1024, index: bool = True, ef_construction: int = 200, ef: int = 10, M: int = 16, allow_replace_deleted: bool = True, num_threads: int = 1, **kwargs: Any) → DocArrayHnswSearch[source]¶
Initialize DocArrayHnswSearch store.
Parameters
embedding (Embeddings) – Embedding function.
work_dir (str) – path to the location where all the data will be stored.
n_dim (int) – dimension of an embedding.
dist_metric (str) – Distance metric for DocArrayHnswSearch can be one of:
“cosine”, “ip”, and “l2”. Defaults to “cosine”.
max_elements (int) – Maximum number of vectors that can be stored.
Defaults to 1024.
index (bool) – Whether an index should be built for this field.
Defaults to True.
ef_construction (int) – defines a construction time/accuracy trade-off.
Defaults to 200.
ef (int) – parameter controlling query time/accuracy trade-off.
Defaults to 10.
M (int) – parameter that defines the maximum number of outgoing
connections in the graph. Defaults to 16.
allow_replace_deleted (bool) – Enables replacing of deleted elements
with new added ones. Defaults to True.
num_threads (int) – Sets the number of cpu threads to use. Defaults to 1.
**kwargs – Other keyword arguments to be passed to the get_doc_cls method. | [
5715,
4290,
6221,
17719,
505,
9477,
323,
71647,
627,
27853,
505,
6887,
50825,
7113,
25,
38168,
25624,
11,
990,
4432,
25,
610,
11,
308,
11024,
25,
528,
11,
1612,
42394,
25,
50774,
681,
9594,
483,
518,
364,
575,
518,
364,
75,
17,
663,
284,
364,
9594,
483,
518,
1973,
23646,
25,
528,
284,
220,
4278,
19,
11,
1963,
25,
1845,
284,
3082,
11,
31469,
3464,
3099,
25,
528,
284,
220,
1049,
11,
31469,
25,
528,
284,
220,
605,
11,
386,
25,
528,
284,
220,
845,
11,
2187,
10858,
40518,
25,
1845,
284,
3082,
11,
1661,
30825,
25,
528,
284,
220,
16,
11,
3146,
9872,
25,
5884,
8,
11651,
22452,
1895,
39,
77,
2332,
6014,
76747,
60,
55609,
198,
10130,
22452,
1895,
39,
77,
2332,
6014,
3637,
627,
9905,
198,
95711,
320,
26566,
25624,
8,
1389,
38168,
7113,
734,
627,
1816,
4432,
320,
496,
8,
1389,
1853,
311,
279,
3813,
1405,
682,
279,
828,
690,
387,
9967,
627,
77,
11024,
320,
396,
8,
1389,
13167,
315,
459,
40188,
627,
12489,
42394,
320,
496,
8,
1389,
32235,
18767,
369,
22452,
1895,
39,
77,
2332,
6014,
649,
387,
832,
315,
512,
2118,
9594,
483,
9520,
1054,
575,
9520,
323,
1054,
75,
17,
11453,
37090,
311,
1054,
9594,
483,
863,
627,
2880,
23646,
320,
396,
8,
1389,
27697,
1396,
315,
23728,
430,
649,
387,
9967,
627,
16672,
311,
220,
4278,
19,
627,
1275,
320,
2707,
8,
1389,
13440,
459,
1963,
1288,
387,
5918,
369,
420,
2115,
627,
16672,
311,
3082,
627,
830,
3464,
3099,
320,
396,
8,
1389,
19170,
264,
8246,
892,
14,
33829,
6696,
12744,
627,
16672,
311,
220,
1049,
627,
830,
320,
396,
8,
1389,
5852,
26991,
3319,
892,
14,
33829,
6696,
12744,
627,
16672,
311,
220,
605,
627,
44,
320,
396,
8,
1389,
5852,
430,
19170,
279,
7340,
1396,
315,
37798,
198,
51086,
304,
279,
4876,
13,
37090,
311,
220,
845,
627,
7331,
10858,
40518,
320,
2707,
8,
1389,
77416,
25935,
315,
11309,
5540,
198,
4291,
502,
3779,
6305,
13,
37090,
311,
3082,
627,
2470,
30825,
320,
396,
8,
1389,
12808,
279,
1396,
315,
17769,
14906,
311,
1005,
13,
37090,
311,
220,
16,
627,
334,
9872,
1389,
7089,
16570,
6105,
311,
387,
5946,
311,
279,
636,
19401,
39756,
1749,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-5 | **kwargs – Other keyword arguments to be passed to the get_doc_cls method.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, work_dir: Optional[str] = None, n_dim: Optional[int] = None, **kwargs: Any) → DocArrayHnswSearch[source]¶
Create an DocArrayHnswSearch store and insert data.
Parameters
texts (List[str]) – Text data.
embedding (Embeddings) – Embedding function.
metadatas (Optional[List[dict]]) – Metadata for each text if it exists.
Defaults to None.
work_dir (str) – path to the location where all the data will be stored.
n_dim (int) – dimension of an embedding.
**kwargs – Other keyword arguments to be passed to the __init__ method.
Returns
DocArrayHnswSearch Vector Store
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. | [
334,
9872,
1389,
7089,
16570,
6105,
311,
387,
5946,
311,
279,
636,
19401,
39756,
1749,
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,
990,
4432,
25,
12536,
17752,
60,
284,
2290,
11,
308,
11024,
25,
12536,
19155,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
22452,
1895,
39,
77,
2332,
6014,
76747,
60,
55609,
198,
4110,
459,
22452,
1895,
39,
77,
2332,
6014,
3637,
323,
5774,
828,
627,
9905,
198,
87042,
320,
861,
17752,
2526,
1389,
2991,
828,
627,
95711,
320,
26566,
25624,
8,
1389,
38168,
7113,
734,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
8644,
30716,
1389,
34689,
369,
1855,
1495,
422,
433,
6866,
627,
16672,
311,
2290,
627,
1816,
4432,
320,
496,
8,
1389,
1853,
311,
279,
3813,
1405,
682,
279,
828,
690,
387,
9967,
627,
77,
11024,
320,
396,
8,
1389,
13167,
315,
459,
40188,
627,
334,
9872,
1389,
7089,
16570,
6105,
311,
387,
5946,
311,
279,
1328,
2381,
565,
1749,
627,
16851,
198,
9743,
1895,
39,
77,
2332,
6014,
4290,
9307,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-6 | 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]¶
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.
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. | [
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,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f87148a21e93-7 | 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]]¶
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 text and
cosine distance in float for each.
Lower score represents more similarity.
property doc_cls: Type[BaseDoc]¶ | [
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,
5163,
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,
9477,
1455,
4528,
311,
279,
3319,
1495,
323,
198,
9594,
483,
6138,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
3784,
4733,
39756,
25,
4078,
58,
4066,
9743,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch.html |
f8ac205f1df6-0 | langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch¶
class langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch(doc_index: BaseDocIndex, embedding: Embeddings)[source]¶
Bases: DocArrayIndex
Wrapper around in-memory storage for exact search.
To use it, you should have the docarray package with version >=0.32.0 installed.
You can install it with pip install “langchain[docarray]”.
Initialize a vector store from DocArray’s DocIndex.
Methods
__init__(doc_index, embedding)
Initialize a vector store from DocArray's DocIndex.
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]) | [
5317,
8995,
48203,
44569,
24595,
1686,
1896,
19745,
43552,
1895,
644,
10869,
6014,
55609,
198,
1058,
8859,
8995,
48203,
44569,
24595,
1686,
1896,
19745,
43552,
1895,
644,
10869,
6014,
19702,
3644,
25,
5464,
9743,
1581,
11,
40188,
25,
38168,
25624,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
22452,
1895,
1581,
198,
11803,
2212,
304,
65196,
5942,
369,
4839,
2778,
627,
1271,
1005,
433,
11,
499,
1288,
617,
279,
4733,
1686,
6462,
449,
2373,
2669,
15,
13,
843,
13,
15,
10487,
627,
2675,
649,
4685,
433,
449,
24547,
4685,
1054,
5317,
8995,
58,
5349,
1686,
60,
863,
627,
10130,
264,
4724,
3637,
505,
22452,
1895,
753,
22452,
1581,
627,
18337,
198,
565,
2381,
3889,
5349,
3644,
11,
4194,
95711,
340,
10130,
264,
4724,
3637,
505,
22452,
1895,
596,
22452,
1581,
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,
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,
2526
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-1 | 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_params(embedding[, metric])
Initialize DocArrayInMemorySearch store.
from_texts(texts, embedding[, metadatas])
Create an DocArrayInMemorySearch store and insert data.
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 most similar to query.
Attributes
doc_cls
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,
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,
6887,
50825,
7113,
38372,
4194,
16282,
2608,
10130,
22452,
1895,
644,
10869,
6014,
3637,
627,
1527,
80746,
7383,
82,
11,
4194,
95711,
38372,
4194,
4150,
329,
19907,
2608,
4110,
459,
22452,
1895,
644,
10869,
6014,
3637,
323,
5774,
828,
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,
1455,
4528,
311,
3319,
627,
10738,
198,
5349,
39756,
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,
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.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-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, **kwargs: Any) → List[str]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
Returns
List of ids from adding the texts into the vectorstore.
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. | [
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,
3146,
9872,
25,
5884,
8,
11651,
1796,
17752,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-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_params(embedding: Embeddings, metric: Literal['cosine_sim', 'euclidian_dist', 'sgeuclidean_dist'] = 'cosine_sim', **kwargs: Any) → DocArrayInMemorySearch[source]¶
Initialize DocArrayInMemorySearch store.
Parameters
embedding (Embeddings) – Embedding function.
metric (str) – metric for exact nearest-neighbor search.
Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”.
Defaults to “cosine_sim”. | [
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,
6887,
50825,
7113,
25,
38168,
25624,
11,
18767,
25,
50774,
681,
9594,
483,
18819,
518,
364,
20732,
566,
36742,
16416,
518,
364,
82,
713,
84,
51178,
16416,
663,
284,
364,
9594,
483,
18819,
518,
3146,
9872,
25,
5884,
8,
11651,
22452,
1895,
644,
10869,
6014,
76747,
60,
55609,
198,
10130,
22452,
1895,
644,
10869,
6014,
3637,
627,
9905,
198,
95711,
320,
26566,
25624,
8,
1389,
38168,
7113,
734,
627,
16282,
320,
496,
8,
1389,
18767,
369,
4839,
24379,
12,
37569,
2778,
627,
6854,
387,
832,
315,
25,
1054,
9594,
483,
18819,
9520,
1054,
20732,
51178,
16416,
863,
323,
1054,
29443,
20732,
51178,
16416,
863,
627,
16672,
311,
1054,
9594,
483,
18819,
11453
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-4 | Defaults to “cosine_sim”.
**kwargs – Other keyword arguments to be passed to the get_doc_cls method.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, **kwargs: Any) → DocArrayInMemorySearch[source]¶
Create an DocArrayInMemorySearch store and insert data.
Parameters
texts (List[str]) – Text data.
embedding (Embeddings) – Embedding function.
metadatas (Optional[List[Dict[Any, Any]]]) – Metadata for each text
if it exists. Defaults to None.
metric (str) – metric for exact nearest-neighbor search.
Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”.
Defaults to “cosine_sim”.
Returns
DocArrayInMemorySearch Vector Store
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. | [
16672,
311,
1054,
9594,
483,
18819,
863,
627,
334,
9872,
1389,
7089,
16570,
6105,
311,
387,
5946,
311,
279,
636,
19401,
39756,
1749,
627,
27853,
505,
80746,
7383,
82,
25,
1796,
17752,
1145,
40188,
25,
38168,
25624,
11,
2322,
329,
19907,
25,
12536,
53094,
58,
13755,
71401,
11,
5884,
5163,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
22452,
1895,
644,
10869,
6014,
76747,
60,
55609,
198,
4110,
459,
22452,
1895,
644,
10869,
6014,
3637,
323,
5774,
828,
627,
9905,
198,
87042,
320,
861,
17752,
2526,
1389,
2991,
828,
627,
95711,
320,
26566,
25624,
8,
1389,
38168,
7113,
734,
627,
4150,
329,
19907,
320,
15669,
53094,
58,
13755,
71401,
11,
5884,
5163,
2526,
1389,
34689,
369,
1855,
1495,
198,
333,
433,
6866,
13,
37090,
311,
2290,
627,
16282,
320,
496,
8,
1389,
18767,
369,
4839,
24379,
12,
37569,
2778,
627,
6854,
387,
832,
315,
25,
1054,
9594,
483,
18819,
9520,
1054,
20732,
51178,
16416,
863,
323,
1054,
29443,
20732,
51178,
16416,
863,
627,
16672,
311,
1054,
9594,
483,
18819,
863,
627,
16851,
198,
9743,
1895,
644,
10869,
6014,
4290,
9307,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-5 | 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]¶
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.
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. | [
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,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
f8ac205f1df6-6 | 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]]¶
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 text and
cosine distance in float for each.
Lower score represents more similarity.
property doc_cls: Type[BaseDoc]¶ | [
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,
5163,
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,
9477,
1455,
4528,
311,
279,
3319,
1495,
323,
198,
9594,
483,
6138,
304,
2273,
369,
1855,
627,
9230,
5573,
11105,
810,
38723,
627,
3784,
4733,
39756,
25,
4078,
58,
4066,
9743,
60,
55609
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch.html |
59eb3f9cbcce-0 | langchain.vectorstores.awadb.AwaDB¶
class langchain.vectorstores.awadb.AwaDB(table_name: str = 'langchain_awadb', embedding: Optional[Embeddings] = None, log_and_data_dir: Optional[str] = None, client: Optional[awadb.Client] = None)[source]¶
Bases: VectorStore
Interface implemented by AwaDB vector stores.
Initialize with AwaDB client.
Methods
__init__([table_name, embedding, ...])
Initialize with AwaDB 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, is_duplicate_texts])
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. | [
5317,
8995,
48203,
44569,
6064,
40691,
885,
10196,
3590,
55609,
198,
1058,
8859,
8995,
48203,
44569,
6064,
40691,
885,
10196,
3590,
16138,
1292,
25,
610,
284,
364,
5317,
8995,
55268,
40691,
518,
40188,
25,
12536,
58,
26566,
25624,
60,
284,
2290,
11,
1515,
8543,
1807,
4432,
25,
12536,
17752,
60,
284,
2290,
11,
3016,
25,
12536,
58,
675,
40691,
11978,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
4290,
6221,
198,
5160,
11798,
555,
362,
10196,
3590,
4724,
10756,
627,
10130,
449,
362,
10196,
3590,
3016,
627,
18337,
198,
565,
2381,
565,
2625,
2048,
1292,
11,
4194,
95711,
11,
4194,
1131,
2608,
10130,
449,
362,
10196,
3590,
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,
285,
71534,
80746,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
59eb3f9cbcce-1 | Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
create_table(table_name, **kwargs)
Create a new table.
delete(ids)
Delete by vector ID.
from_documents(documents[, embedding, ...])
Create an AwaDB vectorstore from a list of documents.
from_texts(texts[, embedding, metadatas, ...])
Create an AwaDB vectorstore from a raw documents.
get_current_table(**kwargs)
Get the current table.
list_tables(**kwargs)
List all the tables created by the client.
load_local(table_name, **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.
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, normalized on a scale from 0 to 1.
similarity_search_with_score(query[, k])
Return docs and relevance scores, normalized on a scale from 0 to 1.
use(table_name, **kwargs)
Use the specified table.
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. | [
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,
5350,
16138,
1292,
11,
4194,
334,
9872,
340,
4110,
264,
502,
2007,
627,
4644,
44548,
340,
6571,
555,
4724,
3110,
627,
1527,
77027,
19702,
2901,
38372,
4194,
95711,
11,
4194,
1131,
2608,
4110,
459,
362,
10196,
3590,
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,
459,
362,
10196,
3590,
4724,
4412,
505,
264,
7257,
9477,
627,
456,
11327,
5350,
22551,
9872,
340,
1991,
279,
1510,
2007,
627,
1638,
36732,
22551,
9872,
340,
861,
682,
279,
12920,
3549,
555,
279,
3016,
627,
1096,
13876,
16138,
1292,
11,
4194,
334,
9872,
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,
627,
15124,
49325,
10947,
10974,
38372,
4194,
74,
2608,
5715,
27437,
1455,
4528,
311,
3319,
627,
15124,
49325,
10947,
3795,
12526,
2625,
95711,
11,
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,
11,
30510,
389,
264,
5569,
505,
220,
15,
311,
220,
16,
627,
15124,
49325,
10947,
6753,
10622,
10974,
38372,
4194,
74,
2608,
5715,
27437,
323,
41961,
12483,
11,
30510,
389,
264,
5569,
505,
220,
15,
311,
220,
16,
627,
817,
16138,
1292,
11,
4194,
334,
9872,
340,
10464,
279,
5300,
2007,
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,
13
] | https://langchain.readthedocs.io/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.