import asyncio
from actian_vectorai import AsyncVectorAIClient
import random
async def main():
# Connect to VectorAI DB server
async with AsyncVectorAIClient("localhost:50051") as client:
# Generate query vector
query_vector = [random.gauss(0, 1) for _ in range(128)]
# Include both payload and vector data
results = await client.points.search(
"my_collection", # Collection name
vector=query_vector, # Query vector
limit=10, # Number of results
with_payload=True, # Include payload metadata
with_vectors=True # Include vector embeddings
)
# Display results
for result in results:
print(f"ID: {result.id}, Score: {result.score}")
print(f"Payload: {result.payload}")
if result.vectors:
print(f"Vector dimensions: {len(result.vectors)}")
asyncio.run(main())