Opensearch
OpensearchVectorStore #
Bases: BasePydanticVectorStore
# Opensearch/Opensearch向量存储。
# Args:
# client (OpensearchVectorClient):用于数据插入/查询的向量索引客户端。
# 示例:
# `pip install llama-index-vector-stores-opensearch`
# ```python
# from llama_index.vector_stores.opensearch import (
# OpensearchVectorStore,
# OpensearchVectorClient,
# )
# # 集群的http端点(需要opensearch来使用向量索引)
# endpoint = "http://localhost:9200"
# # 用于演示VectorStore实现的索引
# idx = "gpt-index-demo"
# # OpensearchVectorClient默认将文本存储在此字段中
# text_field = "content"
# # OpensearchVectorClient默认将嵌入存储在此字段中
# embedding_field = "embedding"
# # OpensearchVectorClient封装了启用向量搜索的单个opensearch索引的逻辑
# client = OpensearchVectorClient(
# endpoint, idx, 1536, embedding_field=embedding_field, text_field=text_field
# )
# # 初始化向量存储
# vector_store = OpensearchVectorStore(client)
# ```
Source code in llama_index/vector_stores/opensearch/base.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
|
add #
add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
将节点添加到索引中。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes |
List[BaseNode]
|
List[BaseNode]: 带有嵌入的节点列表。 |
required |
Source code in llama_index/vector_stores/opensearch/base.py
482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
async_add
async
#
async_add(
nodes: List[BaseNode], **add_kwargs: Any
) -> List[str]
异步将节点添加到索引中。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes |
List[BaseNode]
|
List[BaseNode]: 带有嵌入的节点列表。 |
required |
Source code in llama_index/vector_stores/opensearch/base.py
496 497 498 499 500 501 502 503 504 505 506 507 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
使用ref_doc_id删除节点。
Source code in llama_index/vector_stores/opensearch/base.py
509 510 511 512 513 514 515 516 517 |
|
adelete
async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
使用ref_doc_id异步删除节点。
Source code in llama_index/vector_stores/opensearch/base.py
519 520 521 522 523 524 525 |
|
query #
query(
query: VectorStoreQuery, **kwargs: Any
) -> VectorStoreQueryResult
查询前k个最相似节点的索引。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
VectorStoreQuery
|
存储查询对象。 |
required |
Source code in llama_index/vector_stores/opensearch/base.py
527 528 529 530 531 532 533 |
|
aquery
async
#
aquery(
query: VectorStoreQuery, **kwargs: Any
) -> VectorStoreQueryResult
异步查询索引以获取最相似的前k个节点。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
VectorStoreQuery
|
存储查询对象。 |
required |
Source code in llama_index/vector_stores/opensearch/base.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
|