> ## Documentation Index
> Fetch the complete documentation index at: https://langchat.neurobrains.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Pinecone Provider

> Pinecone vector database integration with OpenAI embeddings.

## Usage

```python theme={null}
from langchat.providers import Pinecone

vector_db = Pinecone("my-index")   # reads PINECONE_API_KEY + OPENAI_API_KEY
```

***

## Parameters

<ParamField path="index" type="str" required>
  Pinecone index name. First positional argument.
</ParamField>

<ParamField path="api_key" type="str | None" default="None">
  Pinecone API key. Falls back to `PINECONE_API_KEY`.
</ParamField>

<ParamField path="embedding_api_key" type="str | None" default="None">
  OpenAI API key used for creating embeddings. Falls back to `OPENAI_API_KEY`.
</ParamField>

<ParamField path="embedding_model" type="str" default="text-embedding-3-large">
  OpenAI embedding model for both indexing and retrieval.
</ParamField>

***

## Environment variables

```bash theme={null}
PINECONE_API_KEY=pcsk-...
OPENAI_API_KEY=sk-...    # used for embeddings
```

***

## Embedding models

| Model                    | Dimensions | Notes                           |
| ------------------------ | ---------- | ------------------------------- |
| `text-embedding-3-large` | 3072       | Default. Best quality.          |
| `text-embedding-3-small` | 1536       | Lower cost, still good quality. |
| `text-embedding-ada-002` | 1536       | Legacy baseline.                |

<Warning>
  Your Pinecone index dimensions must match the embedding model:

  * `text-embedding-3-large` → create index with **3072** dimensions
  * `text-embedding-3-small` → create index with **1536** dimensions
</Warning>

Change the embedding model:

```python theme={null}
vector_db = Pinecone("my-index", embedding_model="text-embedding-3-small")
```

***

## Creating a Pinecone index

1. Go to [app.pinecone.io](https://app.pinecone.io)
2. Create a **Serverless** index:
   * **Dimensions**: `3072` (for `text-embedding-3-large`)
   * **Metric**: `cosine`
   * **Cloud/Region**: choose based on your API server location
3. Copy the index name and your API key to `.env`

***

## Namespaces

Use namespaces to partition a single index into logical sections:

```python theme={null}
# Index with namespace
lc.index("products/", namespace="products")
lc.index("support/", namespace="support")
```

The retriever uses the namespace you configured when creating the `Pinecone` instance. For multi-namespace retrieval, you need separate `LangChat` instances or a custom adapter.
