Zilliz/Milvus
Learn how to integrate Zilliz/Milvus with HoneyHive for vector database monitoring, tracing, and retrieval evaluations.
Zilliz
Zilliz is the company behind Milvus, an open-source vector database built for AI applications and similarity search. By integrating Milvus with HoneyHive, you can:
- Trace vector database operations
- Monitor latency, embedding quality, and context relevance
- Evaluate retrieval performance in your RAG pipelines
- Optimize paramaters such as
chunk_size
orchunk_overlap
Prerequisites
- A HoneyHive account and API key
- Python 3.7+
- Basic understanding of vector databases and RAG pipelines
Installation
Install the required packages:
Basic Integration Example
The following example demonstrates a complete RAG pipeline with HoneyHive tracing for Milvus operations. We’ll break down each component step by step.
Step 1: Initialize Clients
First, set up the necessary clients for HoneyHive, OpenAI, and Milvus:
Step 2: Create Embedding Function
Step 3: Set Up Milvus Collection with Tracing
The @trace
decorator logs this operation to HoneyHive with metadata about the collection name and dimension. The function itself creates a fresh collection for our vectors, with the dimension matching our embedding model’s output size.
Step 4: Insert Documents with Tracing
This function converts a list of text documents into vectors using our embedding function, then inserts them into Milvus. The @trace
decorator logs information about the embedding model used, allowing you to compare different models’ performance.
Step 5: Search for Similar Documents with Tracing
Step 6: Generate Response with Tracing
Create a function to generate a response using OpenAI with tracing:
Step 7: Complete RAG Pipeline with Tracing
Create a function that combines all the previous steps into a complete RAG pipeline:
Step 8: Run the Example
Finally, create a main function to run the example:
Advanced Configuration
Using Milvus Lite
Use Milvus Lite with local files for demo, the setup is straightforward.
Using Self-hosted Milvus Server
To connect to a Milvus server, specify your server address (e.g. "http://localhost:19530"
) and "<username>:<password>"
(e.g. "root:Milvus"
) as Token in the MilvusClient.
Connect to Zilliz Cloud
To connect to Zilliz Cloud (fully managed Milvus), add your cluster endpoint and token to the MilvusClient.
Adding Custom Metadata to Traces
Add custom metadata to your traces for better analysis:
Analyzing Results in HoneyHive
After running your application with tracing enabled, you can analyze the results in the HoneyHive dashboard:
- Navigate to your project in the HoneyHive dashboard
- View traces for your Milvus operations
- Analyze retrieval performance metrics
- Compare different embedding models and configurations
By integrating Zilliz into your workflow, you can easily track and improve the performance of your AI applications. Keep an eye on what’s working, spot issues quickly, and fine-tune your embeddings to boost accuracy