-{"codeList":["from pymilvus import MilvusClient\n\n# Prepare index building params\nindex_params = MilvusClient.prepare_index_params()\n\nindex_params.add_index(\n field_name=\"your_vector_field_name\", # Name of the vector field to be indexed\n index_type=\"GPU_CAGRA\", # Type of the index to create\n index_name=\"vector_index\", # Name of the index to create\n metric_type=\"L2\", # Metric type used to measure similarity\n params={\n \"intermediate_graph_degree\": 32, # Affects recall and build time by determining the graph’s degree before pruning\n \"graph_degree\": 64, # Affets search performance and recall by setting the graph’s degree after pruning\n \"build_algo\": \"IVF_PQ\", # Selects the graph generation algorithm before pruning\n \"cache_dataset_on_device\": \"true\", # Decides whether to cache the original dataset in GPU memory\n \"adapt_for_cpu\": \"false\", # Decides whether to use GPU for index-building and CPU for search\n } # Index building params\n)\n","search_params = {\n \"params\": {\n \"itopk_size\": 16, # Determines the size of intermediate results kept during the search\n \"search_width\": 8, # Specifies the number of entry points into the CAGRA graph during the search\n }\n}\n\nres = MilvusClient.search(\n collection_name=\"your_collection_name\", # Collection name\n anns_field=\"vector_field\", # Vector field name\n data=[[0.1, 0.2, 0.3, 0.4, 0.5]], # Query vector\n limit=3, # TopK results to return\n search_params=search_params\n)\n"],"headingContent":"GPU_CAGRA","anchorList":[{"label":"GPU_CAGRA","href":"GPUCAGRA","type":1,"isActive":false},{"label":"Build index","href":"Build-index","type":2,"isActive":false},{"label":"Search on index","href":"Search-on-index","type":2,"isActive":false},{"label":"Index params","href":"Index-params","type":2,"isActive":false}]}
0 commit comments