.NET 10 + Pinecone: integrating a vector database
A tutorial that wires .NET 10 into Pinecone, the managed vector database, using HttpClient and the REST data-plane endpoints instead of the archived C# SDK. It covers options binding, DI registration, upsert and similarity query, plus validation that keeps embeddings consistent.
Key points
- Pinecone is a managed vector database: embeddings are stored in an index with a fixed dimension and similarity metric (Cosine in the sample).
- The official C# SDK was archived in July 2026, so the article calls /vectors/upsert and /query over HttpClient instead.
- PineconeOptions binds ApiKey and IndexHost from configuration, registers through AddHttpClient and validates options at startup.
- UpsertAsync sends id, values and metadata; SearchAsync sets topK and includeMetadata to control the payload.
- A validation helper rejects wrong-length vectors and non-finite floats before any request is sent.
- The API key belongs in user-secrets or an environment variable, never in the versioned appsettings.json.
Pinecone is a managed vector database: you store embeddings in an index that has a fixed dimension and a similarity metric, then query it with the vector of your search text. This walkthrough connects a .NET 10 Web API to Pinecone over the REST data-plane, sending POST requests to /vectors/upsert and /query through HttpClient and IHttpClientFactory instead of the C# SDK, whose repository was archived in July 2026.
Configuration lives in a PineconeOptions class bound from appsettings, with the API key supplied through user-secrets or an environment variable. The typed client sets the base address, a 30-second timeout and the Api-Key and X-Pinecone-Api-Version headers. Before each call the service checks that the vector length matches the configured dimension and that no value is NaN or infinite. The embedding step is left as an interface to implement with a real model, and the same model must be used for indexing and querying.
Real-world use
- A support chatbot that retrieves the closest help-center articles before a model writes an answer.
- An internal document search that finds semantically related content even when the wording differs.
- A recommendation service that stores item embeddings and returns nearest neighbours for a user profile.
- A RAG pipeline where retrieved metadata is passed to an LLM as context.
Why it matters
It gives .NET teams a working reference for adding semantic search and RAG without a dedicated SDK, but the unmaintained official client and the strict dimension matching are the two pitfalls to plan for.