> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/ai/vector-stores.md).

# Vector stores and embeddings

Choose where knowledge-base documents are stored and which model creates their embeddings. Leave both unset to use **Postgres** and the **embedding model on your subscription**.

You can set this once on the client, or pass it on `addDocument`, `updateDocument`, `deleteDocument`, `getDocument`, `listDocuments`, and `search`.

{% hint style="info" %}
These calls use **HTTP transport**. Connect with `transport: "http"` first.
{% endhint %}

## Set it once

`serverConfig` on the notifier applies to later knowledge calls on that client. Pass it in the constructor, or assign it later. Set it to `null` to use the defaults again.

```js
notifier.serverConfig = {
  vectorStore: { provider: "postgres" },
  embedding: {
    provider: "ollama",
    baseUrl: "http://127.0.0.1:11434",
    model: "nomic-embed-text",
  },
};
```

`vectorStoreConfig` is another name for `vectorStore`. `embeddingConfig` is another name for `embedding`. Use either name on the client or on a call.

## Override one call

Pass `vectorStore` or `embedding` on that call. Each one overrides only itself: a store on the call keeps the embedding you already set, and an embedding on the call keeps the store you already set.

```js
await notifier.search({
  senderId: "user-123",
  query: "refund timeline",
  vectorStore: {
    provider: "pinecone",
    apiKey: process.env.PINECONE_API_KEY,
    host: process.env.PINECONE_HOST,
  },
});
```

A `serverConfig` object on the call applies to that call only.

Include `dimensions` when the embedding model should use a specific size.

## Vector stores

| `provider`     | Also accepted                                           | Required                                                                                   | Defaults                                                                |
| -------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| `postgres`     | Omit the object                                         | —                                                                                          | Platform Postgres. Keyword and hybrid search are available              |
| `pinecone`     | —                                                       | `apiKey`, and `host` or `index`                                                            | `namespace` optional                                                    |
| `weaviate`     | —                                                       | `host`                                                                                     | `apiKey` optional. `className` defaults to `RagChunk`                   |
| `qdrant`       | —                                                       | `host`                                                                                     | `apiKey` optional. `collection` defaults to `rag_chunks`                |
| `azure_search` | `azure`, `azure_ai_search`                              | `endpoint`, `apiKey`                                                                       | `index` defaults to `rag-chunks`. `apiVersion` defaults to `2024-07-01` |
| `s3_vectors`   | `aws`, `aws_s3`, `s3`, `s3vectors`, `amazon_s3_vectors` | `accessKeyId`, `secretAccessKey`, and either `indexArn` or both `vectorBucket` and `index` | `region` defaults to `us-east-1`. `sessionToken` optional               |

Keyword and hybrid search are available with Postgres. Use the other stores for semantic search.

## Embedding providers

Omit `embedding` to use the model on your subscription.

| `provider`     | Also accepted                          | Default `model`                          | Notes                                                         |
| -------------- | -------------------------------------- | ---------------------------------------- | ------------------------------------------------------------- |
| `open_ai`      | —                                      | `text-embedding-3-small`                 |                                                               |
| `azure_ai`     | `azure`, `azure_openai`                | none                                     | `deploymentName` is required when `model` is omitted          |
| `gemini`       | `google`                               | `text-embedding-004`                     |                                                               |
| `bedrock`      | `aws`, `aws_bedrock`, `amazon_bedrock` | `amazon.titan-embed-text-v2:0`           | `region` defaults to `us-east-1`                              |
| `hugging_face` | `huggingface`                          | `sentence-transformers/all-MiniLM-L6-v2` |                                                               |
| `ollama`       | —                                      | `nomic-embed-text`                       | No API key. Uses this model instead of the subscription model |
| `cohere`       | —                                      | `embed-english-v3.0`                     |                                                               |
| `voyage`       | `voyageai`, `voyage_ai`                | `voyage-3`                               |                                                               |
| `mistral`      | `mistral_ai`                           | `mistral-embed`                          |                                                               |
| `jina`         | `jina_ai`                              | `jina-embeddings-v3`                     |                                                               |
| any other name | —                                      | —                                        | OpenAI-compatible endpoint. Provide `apiKey` and `baseUrl`    |

## Example: local Weaviate and Ollama

```bash
docker run --rm -p 8080:8080 \
  -e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \
  -e PERSISTENCE_DATA_PATH=/var/lib/weaviate \
  cr.weaviate.io/semitechnologies/weaviate:1.27.0

ollama pull nomic-embed-text
```

```js
notifier.serverConfig = {
  vectorStore: {
    provider: "weaviate",
    host: "http://127.0.0.1:8080",
    className: "RagChunk",
  },
  embedding: {
    provider: "ollama",
    baseUrl: "http://127.0.0.1:11434",
    model: "nomic-embed-text",
  },
};
```

Provider names, required fields, and default models are listed under [Integrations](https://dnotifier.gitbook.io/product-docs/integrations/integrations.md).

## Language guides

| Language                | Guide                                                                                                           |
| ----------------------- | --------------------------------------------------------------------------------------------------------------- |
| JavaScript / TypeScript | [javascript-typescript.md](https://dnotifier.gitbook.io/product-docs/ai/vector-stores/javascript-typescript.md) |
| Dart / Flutter          | [dart-flutter.md](https://dnotifier.gitbook.io/product-docs/ai/vector-stores/dart-flutter.md)                   |
| Python                  | [python.md](https://dnotifier.gitbook.io/product-docs/ai/vector-stores/python.md)                               |

## Next steps

* [**Manage documents**](https://dnotifier.gitbook.io/product-docs/ai/manage-documents.md) — index content into the store you selected
* [**Semantic search**](https://dnotifier.gitbook.io/product-docs/ai/semantic-search.md) — query that store
* [**Knowledge base overview**](https://dnotifier.gitbook.io/product-docs/ai/knowledge-base-overview.md)
