januarevan commited on
Commit
37db268
1 Parent(s): 741b955
Files changed (1) hide show
  1. main.py +6 -4
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
- "index_type": "IVF_FLAT",
69
- "metric_type": "COSINE", # Ensure this matches with the search metric
70
- "params": {"nlist": 128} # nlist is a hyperparameter for IVF
 
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("/")