Lindorm
Bases: BasePydanticVectorStore
Lindorm 向量存储。
参数
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
添加
|
用于数据插入/查询的向量索引客户端。
|
必需 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
示例
源代码位于 llama-index-integrations/vector_stores/llama-index-vector-stores-lindorm/llama_index/vector_stores/lindorm/base.py
from llama_index.vector_stores.lindorm import (
LindormVectorStore,
LindormVectorClient,
)
# lindorm instance info
# how to obtain an lindorm search instance:
# https://alibabacloud.com/help/en/lindorm/latest/create-an-instance
# how to access your lindorm search instance:
# https://www.alibabacloud.com/help/en/lindorm/latest/view-endpoints
# run curl commands to connect to and use LindormSearch:
# https://www.alibabacloud.com/help/en/lindorm/latest/connect-and-use-the-search-engine-with-the-curl-command
host = "ld-bp******jm*******-proxy-search-pub.lindorm.aliyuncs.com"
port = 30070
username = 'your_username'
password = 'your_password'
# index to demonstrate the VectorStore impl
index_name = "lindorm_test_index"
# extension param of lindorm search, number of cluster units to query; between 1 and method.parameters.nlist.
nprobe = "a number(string type)"
# extension param of lindorm search, usually used to improve recall accuracy, but it increases performance overhead;
# between 1 and 200; default: 10.
reorder_factor = "a number(string type)"
# LindormVectorClient encapsulates logic for a single index with vector search enabled
client = LindormVectorClient(
host=host,
port=port,
username=username,
password=password,
index=index_name,
dimension=1536, # match with your embedding model
nprobe=nprobe,
reorder_factor=reorder_factor,
# filter_type="pre_filter/post_filter(default)"
)
# initialize vector store
vector_store = LindormVectorStore(client)
client property
#
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
|
将节点添加到索引。同步包装器,以同步方式使用 async_add 函数的异步逻辑。
add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
节点
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
List[BaseNode]
|
List[BaseNode]:带有嵌入的节点列表。
|
返回值 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
List[str]
描述 | 默认值 |
---|---|
List[str]:node_id 列表
|
List[str]: 节点ID列表 |
client property
#
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
async_add async
#
async_add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
异步向索引添加节点。
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
List[BaseNode]
|
List[BaseNode]:带有嵌入的节点列表。
|
返回值 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
List[str]
描述 | 默认值 |
---|---|
List[str]:node_id 列表
|
List[str]: 节点ID列表 |
client property
#
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
使用 ref_doc_id 删除节点。同步包装器,以同步方式使用 async_add 函数的异步逻辑。
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
ref_doc_id
|
str
|
应删除其节点的文档的 doc_id。 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
client property
#
880 881 882 883 884 885 886 887 888 889 890 891 |
|
adelete async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
使用 ref_doc_id 异步删除节点。
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
ref_doc_id
|
str
|
应删除其节点的文档的 doc_id。 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
client property
#
893 894 895 896 897 898 899 900 901 |
|
query #
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
查询索引以获取 top k 最相似的节点。同步包装器,以同步方式使用 async_add 函数的异步逻辑。
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
异步查询
|
VectorStoreQuery
|
存储查询对象。 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
client property
#
903 904 905 906 907 908 909 910 911 912 |
|
aquery async
#
aquery(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
异步查询索引以获取 top k 最相似的节点。
名称
类型 | 描述 | 默认值 | LindormVectorClient |
---|---|---|---|
异步查询
|
VectorStoreQuery
|
存储查询对象。 |
pip install llama-index pip install opensearch-py pip install llama-index-vector-stores-lindorm
|
client property
#
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
|