Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
{
  "mcpServers": {
    "respan-docs": {
      "url": "https://respan.ai/docs/mcp"
    }
  }
}

What is ChromaDB?

ChromaDB is an open-source embedding database for building AI applications. It handles embedding, storing, and searching vectors with built-in support for metadata filtering.

Setup

1

Install packages

pip install respan-tracing chromadb openai
2

Set environment variables

export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
3

Initialize Respan and query ChromaDB

Respan auto-instruments ChromaDB — all collection operations (add, query, update, delete) are captured as spans.
from respan_tracing import RespanTelemetry
from respan_tracing.decorators import workflow, task
import chromadb
from openai import OpenAI

# Initialize — auto-instruments ChromaDB
telemetry = RespanTelemetry()
client = OpenAI()
chroma = chromadb.Client()
collection = chroma.get_or_create_collection("docs")

# Add documents (ChromaDB handles embeddings internally)
collection.add(
    documents=[
        "Respan provides observability for LLM applications.",
        "Traces capture the full lifecycle of an LLM request.",
    ],
    ids=["doc1", "doc2"],
)


@task(name="search_docs")
def search_docs(query: str):
    results = collection.query(query_texts=[query], n_results=3)
    return results["documents"][0]


@workflow(name="rag_pipeline")
def rag_pipeline(query: str):
    context = search_docs(query)
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": f"Context: {context}"},
            {"role": "user", "content": query},
        ],
    )
    return response.choices[0].message.content


result = rag_pipeline("How does tracing work?")
print(result)
4

View your trace

Open the Traces page to see ChromaDB operations as spans in your trace tree.

Configuration

ChromaDB is auto-instrumented via Instruments.CHROMA (Python) or chromaDB (JavaScript). No additional configuration is needed. See the Python Tracing SDK reference or JavaScript Tracing SDK reference for configuration options.