Find answers from the community

Updated 3 months ago

Hello there I am having issues when

Hello there, I am having issues when trying to connect to use the milvus vector store. I currently started milvus in my local env with the yaml provided via docker. An issue that I'm having comes as I attempt running a query as it prompts the next exception: ValueError: Milvus instance not initialized. Can anybody help with this?
L
R
5 comments
How did you "load"/connect to the existing milvus vector store?
I ran the folowing:
from pymilvus import (
connections,
utility,
FieldSchema,
CollectionSchema,
DataType,
Collection,
)

connections.connect("default", host="localhost", port="19530")

vector_store = MilvusVectorStore(
overwrite='True'
)

storage_context = StorageContext.from_defaults(
fs=file_system,
persist_dir=index_path,
graph_store=SimpleGraphStore(), # pass default graph store to prevent unauthorized request to GCS
vector_store = vector_store
)

callback_handler = OpenInferenceCallbackHandler()
service_context = ServiceContext.from_defaults(
llm_predictor=LLMPredictor(llm=ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)),
embed_model=OpenAIEmbedding(model="text-embedding-ada-002"),
callback_manager=CallbackManager(handlers=[callback_handler]),
)
index = load_index_from_storage(
storage_context,
service_context=service_context,
)
query_engine = index.as_query_engine()


for query in queries:
print("Query")
print("=====")
print()
print(textwrap.fill(query, max_line_length))
print()
response = query_engine.query(query)
print("Response")
print("========")
print()
print(textwrap.fill(str(response), max_line_length))
print()
So, if you are loading an existing milvus store that was created with llama-index, you probably
  • want to set overwrite=False
  • no need to call persist() or load_index_from_storage(). Instead, setup the vector store and storage context, create the initial index. Then, to re-load the index, setup the vector store object to point to the existing vector store, then do index = VectorStoreIndex.from_vector_store(vector_store), which should reload the index
thanks! How can I guarantee that my information is being correctly stored into Milvus? With these changes I can now get a response from the query_engine, however not the ones that I'm expecting nor see a collection or anything else shown in milvus (I am using attu as gui). also if I attempt to pass in a new collection name as an argument it brings back the same "Milvus instance not initialized".
Add a reply
Sign up and join the conversation on Discord