索引类型不一致 #440
索引类型不一致
#440
-
你好,请问为什么我建立数据库的时候,索引选择的是HNSW,但是通过attu显示的是FLAT import logging
import sys
# Uncomment to see debug logs
# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
# logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Document
from llama_index.vector_stores.milvus import MilvusVectorStore
from IPython.display import Markdown, display
import textwrap
import openai
from llama_index.core import StorageContext,load_index_from_storage
index ={
"params": {"M": 16,
"efConstruction": 100,
"index_type": "HNSW"
} #
}
search_params ={
"params":{"ef":128}
}
vector_store = MilvusVectorStore(
dim=1024,
overwrite=True,
uri="http://localhost:19530",
similarity_metric="L2",
index_config = index,
search_config=search_params
)
# 建立连接
storage_context = StorageContext.from_defaults(vector_store=vector_store)
print("successful!")
retriever = index.as_retriever()
import time
start = time.time()
nodes = retriever.retrieve("Who is Paul Graham?")
end = time.time()
print(end-start) |
Beta Was this translation helpful? Give feedback.
Answered by
HelloEveryonehh
Mar 17, 2024
Replies: 1 comment
-
我自己代码写错了,在llama-index里面应该是这样 index ={
"params": {
"M": 32,
"efConstruction": 100
}, #
"index_type":"HNSW"
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
shanghaikid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我自己代码写错了,在llama-index里面应该是这样