forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkv_store_feat_table.py
107 lines (87 loc) · 4.67 KB
/
kv_store_feat_table.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import sys
from pathlib import Path
from langchain_community import document_loaders
from langchain_core.document_loaders.base import BaseLoader
KV_STORE_TEMPLATE = """\
---
sidebar_class_name: hidden
keywords: [compatibility]
custom_edit_url:
hide_table_of_contents: true
---
# Key-value stores
[Key-value stores](/docs/concepts/key_value_stores) are used by other LangChain components to store and retrieve data.
:::info
If you'd like to contribute an integration, see [Contributing integrations](/docs/contributing/how_to/integrations/).
:::
## Features
The following table shows information on all available key-value stores.
{table}
"""
KV_STORE_FEAT_TABLE = {
"AstraDBByteStore": {
"class": "[AstraDBByteStore](https://python.langchain.com/api_reference/astradb/storage/langchain_astradb.storage.AstraDBByteStore.html)",
"local": False,
"package": "[langchain_astradb](https://python.langchain.com/api_reference/astradb/)",
"downloads": "",
},
"CassandraByteStore": {
"class": "[CassandraByteStore](https://python.langchain.com/api_reference/community/storage/langchain_community.storage.cassandra.CassandraByteStore.html)",
"local": False,
"package": "[langchain_community](https://python.langchain.com/api_reference/community/)",
"downloads": "",
},
"ElasticsearchEmbeddingsCache": {
"class": "[ElasticsearchEmbeddingsCache](https://python.langchain.com/api_reference/elasticsearch/cache/langchain_elasticsearch.cache.ElasticsearchEmbeddingsCache.html)",
"local": True,
"package": "[langchain_elasticsearch](https://python.langchain.com/api_reference/elasticsearch/)",
"downloads": "",
},
"LocalFileStore": {
"class": "[LocalFileStore](https://python.langchain.com/api_reference/storage/langchain.storage.file_system.LocalFileStore.html)",
"local": True,
"package": "[langchain](https://python.langchain.com/api_reference/langchain/)",
"downloads": "",
},
"InMemoryByteStore": {
"class": "[InMemoryByteStore](https://python.langchain.com/api_reference/core/stores/langchain_core.stores.InMemoryByteStore.html)",
"local": True,
"package": "[langchain_core](https://python.langchain.com/api_reference/core/)",
"downloads": "",
},
"RedisStore": {
"class": "[RedisStore](https://python.langchain.com/api_reference/community/storage/langchain_community.storage.redis.RedisStore.html)",
"local": True,
"package": "[langchain_community](https://python.langchain.com/api_reference/community/)",
"downloads": "",
},
"UpstashRedisByteStore": {
"class": "[UpstashRedisByteStore](https://python.langchain.com/api_reference/community/storage/langchain_community.storage.upstash_redis.UpstashRedisByteStore.html)",
"local": False,
"package": "[langchain_community](https://python.langchain.com/api_reference/community/)",
"downloads": "",
},
}
DEPRECATED = []
def get_kv_store_table() -> str:
"""Get the table of KV stores."""
header = ["name", "local", "package", "downloads"]
title = ["Class", "Local", "Package", "Downloads"]
rows = [title, [":-"] + [":-:"] * (len(title) - 1)]
for loader, feats in sorted(KV_STORE_FEAT_TABLE.items()):
if not feats or loader in DEPRECATED:
continue
rows += [
[feats["class"]]
+ ["✅" if feats.get(h) else "❌" for h in header[1:2]]
+ [feats["package"], feats["downloads"]]
]
return "\n".join(["|".join(row) for row in rows])
if __name__ == "__main__":
output_dir = Path(sys.argv[1])
output_integrations_dir = output_dir / "integrations"
output_integrations_dir_kv_stores = output_integrations_dir / "stores"
output_integrations_dir_kv_stores.mkdir(parents=True, exist_ok=True)
kv_stores_page = KV_STORE_TEMPLATE.format(table=get_kv_store_table())
with open(output_integrations_dir / "stores" / "index.mdx", "w") as f:
f.write(kv_stores_page)