Rocksetdb
RocksetVectorStore #
Rockset 向量存储。
示例
pip install llama-index-vector-stores-rocksetdb
from llama_index.vector_stores.rocksetdb import RocksetVectorStore
# Set up RocksetVectorStore with necessary configurations
vector_store = RocksetVectorStore(
collection="my_collection",
api_key="your_rockset_api_key",
api_server="https://api.use1a1.rockset.com",
embedding_col="my_embedding",
metadata_col="node",
distance_func=RocksetVectorStore.DistanceFunc.DOT_PRODUCT
)
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py
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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
|
add #
add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
在集合中存储向量。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
nodes
|
List[BaseNode]
|
带有嵌入的节点列表 |
必需 |
返回
类型 | 描述 |
---|---|
List[str]
|
存储的节点 ID (List[str]) |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py
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 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
根据节点的 ref_doc_id 从集合中删除。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
ref_doc_id
|
str
|
要删除其节点的文档的 ref_doc_id |
必需 |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py
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 |
|
query #
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
获取与查询相关的节点。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
查询
|
VectorStoreQuery
|
查询 |
必需 |
similarity_col
|
Optional[str]
|
选择余弦相似度的列(默认值:"_similarity") |
必需 |
返回
类型 | 描述 |
---|---|
VectorStoreQueryResult
|
查询结果 (llama_index.core.vector_stores.types.VectorStoreQueryResult) |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py
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 |
|
with_new_collection classmethod
#
with_new_collection(dimensions: int | None = None, **rockset_vector_store_args: Any) -> RocksetVectorStore
创建一个新集合并返回其 RocksetVectorStore。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
dimensions
|
Optional[int]
|
在集合的摄取转换中强制执行的向量长度。默认情况下,集合不会进行向量强制执行。 |
无
|
collection
|
str
|
要创建的集合的名称 |
必需 |
client
|
Optional[Any]
|
Rockset 客户端对象 |
必需 |
workspace
|
str
|
包含要创建的集合的工作空间(默认值:"commons") |
必需 |
text_key
|
str
|
节点文本的键(默认值:llama_index.core.vector_stores.utils.DEFAULT_TEXT_KEY) |
必需 |
embedding_col
|
str
|
包含嵌入的数据库列(默认值:llama_index.core.vector_stores.utils.DEFAULT_EMBEDDING_KEY) |
必需 |
metadata_col
|
str
|
包含节点元数据的数据库列(默认值:"metadata") |
必需 |
api_server
|
Optional[str]
|
要使用的 Rockset API 服务器 |
必需 |
api_key
|
Optional[str]
|
要使用的 Rockset API 密钥 |
必需 |
distance_func
|
DistanceFunc
|
衡量向量关系的指标(默认值:RocksetVectorStore.DistanceFunc.COSINE_SIM) |
必需 |
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
|