Vertex AI 向量搜索
VertexAIVectorStore #
Bases: BasePydanticVectorStore
Vertex AI Vector Search 向量存储。
在此向量存储中,embedding 存储在 Vertex AI Vector Store 中,文档存储在 Cloud Storage bucket 中。
在查询时,索引使用 Vertex AI Vector Search 查询最相似的 Top k 个节点。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
project_id
|
str)
|
Google Cloud 项目 ID。 |
无
|
region
|
str)
|
发起 API 调用的默认位置。它必须与 Vector Search 索引创建的位置相同,并且必须是区域性的。 |
无
|
index_id
|
str)
|
在 Vertex AI Vector Search 中创建的索引的完全限定资源名称。 |
无
|
endpoint_id
|
str
|
在 Vertex AI Vector Search 中创建的索引端点的完全限定资源名称。 |
无
|
gcs_bucket_name
|
可选[str]
|
|
无
|
credentials_path
|
可选[str]
|
|
无
|
示例
pip install llama-index-vector-stores-vertexaivectorsearch
from
vector_store = VertexAIVectorStore(
project_id=PROJECT_ID,
region=REGION,
index_id="<index_resource_name>"
endpoint_id="<index_endpoint_resource_name>"
)
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-vertexaivectorsearch/llama_index/vector_stores/vertexaivectorsearch/base.py
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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
from_params 类方法
#
from_params(project_id: Optional[str] = None, region: Optional[str] = None, index_id: Optional[str] = None, endpoint_id: Optional[str] = None, gcs_bucket_name: Optional[str] = None, credentials_path: Optional[str] = None, text_key: str = DEFAULT_TEXT_KEY, **kwargs: Any) -> VertexAIVectorStore
从配置创建 VertexAIVectorStore。
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-vertexaivectorsearch/llama_index/vector_stores/vertexaivectorsearch/base.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
add #
add(nodes: List[BaseNode], is_complete_overwrite: bool = False, **add_kwargs: Any) -> List[str]
将节点添加到索引。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
nodes
|
列表[BaseNode]
|
List[BaseNode]: 包含 embedding 的节点列表 |
必需 |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-vertexaivectorsearch/llama_index/vector_stores/vertexaivectorsearch/base.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
使用 ref_doc_id 删除节点。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
ref_doc_id
|
str
|
要删除的文档的 doc_id。 |
必需 |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-vertexaivectorsearch/llama_index/vector_stores/vertexaivectorsearch/base.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
query #
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
查询索引以获取最相似的 Top k 个节点。
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-vertexaivectorsearch/llama_index/vector_stores/vertexaivectorsearch/base.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|