MCPcopy Create free account
hub / github.com/cosdata/cosdata / batch_ann_search

Function batch_ann_search

tests/test-dataset.py:812–823  ·  view source on GitHub ↗

Perform batch ANN search using the Client class

(collection, vectors)

Source from the content-addressed store, hash-verified

810
811
812def batch_ann_search(collection, vectors):
813 """Perform batch ANN search using the Client class"""
814 try:
815 # Format the vectors for batch search
816 queries = [{"vector": vector["dense_values"], "top_k": 5} for vector in vectors]
817
818 # Use the collection's search method
819 results = collection.search.batch_dense(queries)
820 return results
821 except Exception as e:
822 print(f"Error in batch search: {e}")
823 raise
824
825
826if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected