Docarray
DocArrayHnswVectorStore #
基类: DocArrayVectorStore
表示 DocArray HNSW 向量存储的类。
此类是 Docarray 提供的一个轻量级文档索引实现。它将向量存储在磁盘上的 hnswlib 中,并将所有其他数据存储在 SQLite 中。
示例
pip install llama-index-vector-stores-docarray
from llama_index.vector_stores.docarray import DocArrayHnswVectorStore
# Initialize the DocArrayHnswVectorStore
vector_store = DocArrayHnswVectorStore(work_dir="hnsw_index", dim=1536)
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/hnsw.py
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
DocArrayInMemoryVectorStore #
基类: DocArrayVectorStore
表示 DocArray 内存向量存储的类。
此类是 Docarray 提供的一个将文档存储在内存中的文档索引。
示例
pip install llama-index-vector-stores-docarray
from llama_index.vector_stores.docarray import DocArrayInMemoryVectorStore
# Create an instance of DocArrayInMemoryVectorStore
vector_store = DocArrayInMemoryVectorStore()
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/in_memory.py
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 |
|
persist #
persist(persist_path: str, fs: Optional[AbstractFileSystem] = None) -> None
将内存向量存储持久化到文件。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
persist_path
|
str
|
索引持久化的路径。 |
必需的 |
fs
|
AbstractFileSystem
|
要持久化到的文件系统。(不适用) |
无
|
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/in_memory.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|