Spaces:
Sleeping
Sleeping
januarevan
commited on
Commit
•
37db268
1
Parent(s):
741b955
init
Browse files
main.py
CHANGED
@@ -65,16 +65,18 @@ def create_a_collection(milvus_client, collection_name):
|
|
65 |
# Create an index for the collection
|
66 |
# IVF_FLAT index is used here, with metric_type COSINE
|
67 |
index_params = {
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
71 |
}
|
|
|
72 |
|
73 |
# Create the index on the vector field
|
74 |
milvus_client.create_index(
|
75 |
collection_name=collection_name,
|
76 |
field_name="vector",
|
77 |
-
index_params=index_params
|
78 |
)
|
79 |
|
80 |
@app.get("/")
|
|
|
65 |
# Create an index for the collection
|
66 |
# IVF_FLAT index is used here, with metric_type COSINE
|
67 |
index_params = {
|
68 |
+
"index_type": "IVF_FLAT",
|
69 |
+
"metric_type": "COSINE",
|
70 |
+
"params": {
|
71 |
+
"nlist": 128
|
72 |
}
|
73 |
+
}
|
74 |
|
75 |
# Create the index on the vector field
|
76 |
milvus_client.create_index(
|
77 |
collection_name=collection_name,
|
78 |
field_name="vector",
|
79 |
+
index_params=index_params # Pass the dictionary, not a string
|
80 |
)
|
81 |
|
82 |
@app.get("/")
|