Musterby Elitery
Integrations

Milvus

Trace LlamaIndex + Milvus vector store retrieval in Muster.

Milvus is an open-source vector database. The most direct path to tracing Milvus operations in Muster is via LlamaIndex — Milvus serves as the vector store, and the LlamaIndex callback handler forwards retrieval and LLM events to Muster.

Setup

pip install llama-index langfuse llama-index-vector-stores-milvus --upgrade
import os

os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["OPENAI_API_KEY"] = "sk-..."

Wire the callback handler

from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager
from langfuse.llama_index import LlamaIndexCallbackHandler

langfuse_callback_handler = LlamaIndexCallbackHandler()
Settings.callback_manager = CallbackManager([langfuse_callback_handler])

Build the index against Milvus

from llama_index.core import VectorStoreIndex, Document, StorageContext
from llama_index.vector_stores.milvus import MilvusVectorStore

vector_store = MilvusVectorStore(uri="tmp/milvus_demo.db", dim=1536)
storage_context = StorageContext.from_defaults(vector_store=vector_store)

index = VectorStoreIndex.from_documents(
    [Document(text="Muster is built on Langfuse.")],
    storage_context=storage_context,
)

query_engine = index.as_query_engine()
print(query_engine.query("What is Muster?"))

Every query produces a trace in Muster with retrieval, embedding, and LLM sub-spans.

Milvus + LlamaIndex trace example in Muster

See also