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 Pinecone?

Pinecone is a managed vector database for building search and retrieval systems. It handles indexing, storage, and similarity search at scale.

Setup

1

Install packages

pip install respan-tracing pinecone openai
2

Set environment variables

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

Initialize Respan and query Pinecone

Respan auto-instruments Pinecone — upsert, query, and delete operations are captured as spans.
from respan_tracing import RespanTelemetry
from respan_tracing.decorators import workflow, task
from pinecone import Pinecone
from openai import OpenAI

# Initialize — auto-instruments Pinecone
telemetry = RespanTelemetry()
client = OpenAI()
pc = Pinecone()
index = pc.Index("my-index")


def get_embedding(text: str) -> list[float]:
    response = client.embeddings.create(model="text-embedding-3-small", input=text)
    return response.data[0].embedding


@task(name="search_docs")
def search_docs(query: str):
    query_vector = get_embedding(query)
    results = index.query(vector=query_vector, top_k=3, include_metadata=True)
    return [match.metadata["text"] for match in results.matches]


@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: {chr(10).join(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 Pinecone operations as spans in your trace tree.

Configuration

Pinecone is auto-instrumented via Instruments.PINECONE (Python) or pinecone (JavaScript). No additional configuration is needed. See the Python Tracing SDK reference or JavaScript Tracing SDK reference for configuration options.