- 
                Notifications
    
You must be signed in to change notification settings  - Fork 277
 
Description
I use docker compose to run project.
Now, I try to use milvus but get this problem.I try some time but not fix it.please help me check milvus db script where is wron.
Ps: Script Reference [semantic-router/src/semantic-router/pkg/cache/milvus_cache.go] createCollection method.
err:
python script:
`
from pymilvus import connections, FieldSchema, CollectionSchema, DataType, Collection,utility
connections.connect("default", host="localhost", port="19530")
collection_name = "semantic_cache"
if utility.has_collection(collection_name):
utility.drop_collection(collection_name)
print(f"🗑️ Dropped existing collection: {collection_name}")
fields = [
FieldSchema(name="id", dtype=DataType.VARCHAR,max_length=64, is_primary=True),
FieldSchema(name="request_id", dtype=DataType.VARCHAR, max_length=64),
FieldSchema(name="model", dtype=DataType.VARCHAR, max_length=256),
FieldSchema(name="query", dtype=DataType.VARCHAR, max_length=65535),
FieldSchema(name="request_body", dtype=DataType.VARCHAR, max_length=65535),
FieldSchema(name="response_body", dtype=DataType.VARCHAR, max_length=65535),
FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=384),
FieldSchema(name="timestamp", dtype=DataType.INT64),
]
schema = CollectionSchema(
fields=fields,
description="Semantic cache for semantic-router"
)
collection = Collection(name=collection_name, schema=schema)
`
index_params = {
"index_type": "HNSW",
"metric_type": "IP",
"params": {"M": 16, "efConstruction": 200}
}
collection.create_index(
field_name="embedding",
index_params=index_params
)
collection.flush()
collection.load()
``