---
title: "Embedded Vector Stores"
description: "Embedded vector stores provide zero-dependency local indexing solutions that enable developers to run semantic memory systems without configuring external database services or cloud infrastructure...."
last_updated: "2026-10-11T17:37:10.218815+00:00"
canonical_url: "https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/vector-stores/embedded-vector-stores"
---

<details>
<summary>Relevant source files</summary>

The following files were used as context for generating this wiki page:

- [mem0/vector_stores/chroma.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py)
- [mem0-ts/src/oss/src/vector_stores/chroma.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/chroma.ts)
- [mem0/vector_stores/faiss.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py)
- [mem0-ts/src/oss/src/vector_stores/memory.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/memory.ts)
- [mem0/vector_stores/valkey.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/valkey.py)
- [mem0/vector_stores/upstash_vector.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/upstash_vector.py)
- [mem0/configs/vector_stores/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/configs/vector_stores/__init__.py)
- [mem0-ts/src/oss/src/vector_stores/valkey.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/valkey.ts)
- [mem0-ts/src/oss/src/vector_stores/azure_ai_search.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/azure_ai_search.ts)
- [mem0/vector_stores/azure_ai_search.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/azure_ai_search.py)
- [mem0/vector_stores/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/__init__.py)
- [mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts)
- [mem0-ts/src/oss/src/vector_stores/s3_vectors.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/s3_vectors.ts)
- [mem0/vector_stores/redis.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/redis.py)
- [mem0/vector_stores/langchain.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/langchain.py)
- [mem0-ts/src/oss/src/vector_stores/oracledb.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/oracledb.ts)
- [mem0/vector_stores/opensearch.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/opensearch.py)
- [mem0-ts/src/oss/src/vector_stores/cassandra.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/cassandra.ts)
- [mem0/vector_stores/weaviate.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/weaviate.py)
- [mem0/vector_stores/azure_mysql.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/azure_mysql.py)
- [mem0/vector_stores/neptune_analytics.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/neptune_analytics.py)
- [mem0-ts/src/oss/src/vector_stores/azure_mysql.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/azure_mysql.ts)
- [mem0-ts/src/oss/src/vector_stores/baidu.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/baidu.ts)
- [mem0/vector_stores/s3_vectors.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/s3_vectors.py)
- [mem0-ts/src/oss/src/vector_stores/qdrant.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/qdrant.ts)
- [mem0/vector_stores/cassandra.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/cassandra.py)
- [mem0/vector_stores/mongodb.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/mongodb.py)
- [mem0/vector_stores/supabase.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/supabase.py)
- [mem0/embeddings/mock.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/embeddings/mock.py)
- [mem0-ts/src/oss/src/vector_stores/milvus.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/milvus.ts)
</details>

## Overview

Embedded vector stores provide zero-dependency local indexing solutions that enable developers to run semantic memory systems without configuring external database services or cloud infrastructure. By embedding lightweight vector engines directly into application runtimes, these components facilitate rapid local prototyping, offline development, and deterministic unit testing. They bridge the gap between abstract vector embedding generation and persistent local storage by abstracting away low-level file I/O, memory buffering, and similarity index construction.
Sources: [mem0/vector_stores/chroma.py:23-75](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L23-L75)

Across both Python and TypeScript packages, embedded stores handle vector insertions, approximate nearest neighbor (ANN) lookups, payload metadata association, and collection lifecycle management locally. For instance, implementations like Chroma support persistent file-backed directory storage through Python and TypeScript client bindings, while native in-memory stores utilize local SQLite file layers with Float32 buffer serialization. These lightweight backends interact directly with core memory orchestrators [Vector Store Architecture](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/vector-stores/vector-store-architecture) while keeping administrative overhead minimal.
Sources: [mem0-ts/src/oss/src/vector_stores/chroma.ts:28-100](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/chroma.ts#L28-L100)

The following sections examine the specific architectural mechanics, client initialization sequences, data serialization patterns, and security guardrails governing embedded vector stores. By understanding these internals, developers can effectively choose between local file persistence (such as Chroma or FAISS) and zero-config embedded runtimes (such as SQLite-backed memory stores) during test-driven development and local prototyping.
Sources: [mem0-ts/src/oss/src/vector_stores/memory.ts:231-245](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/memory.ts#L231-L245)

## ChromaDB Integration and Client Lifecycle

The ChromaDB vector store driver provides both Python and TypeScript implementations that mirror each other to deliver seamless local persistence and server connectivity. In Python, `ChromaDB` extends `VectorStoreBase` to manage collections via `chromadb.Client` or `chromadb.CloudClient`. In TypeScript, `ChromaDB` implements the `VectorStore` interface, utilizing lazy peer loading of the `chromadb` package to ensure consumers who do not use Chroma are not forced to install the optional peer dependency.
Sources: [mem0/vector_stores/chroma.py:23-45](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L23-L45)

During initialization, if an existing client instance is omitted, the constructor configures local persistence settings (disabling anonymized telemetry by default) and defaults the local storage directory to `"db"` if no path is provided. It then invokes `get_or_create_collection` with an explicit null embedding function in TypeScript, ensuring that embeddings are pre-computed externally by mem0 prior to persistence.
Sources: [mem0/vector_stores/chroma.py:46-75](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L46-L75)

```mermaid
flowchart TD
    A["Initialize ChromaDB"] --> B{"Client Provided?"}
    B -- Yes --> C["Use Existing Client"]
    B -- No --> D{"API Key & Tenant?"}
    D -- Yes --> E["Initialize CloudClient"]
    D -- No --> F["Configure Settings<br>Persist Directory: path"]
    F --> G["Initialize ChromaClient"]
    C --> H["Get or Create Collection"]
    E --> H
    G --> H
```
Sources: [mem0-ts/src/oss/src/vector_stores/chroma.ts:35-100](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/chroma.ts#L35-L100)

## SQLite-Backed In-Memory Vector Store

For lightweight unit testing and zero-configuration execution, the TypeScript runtime provides an in-memory vector store backed by SQLite [Vector Store Architecture](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/vector-stores/vector-store-architecture). This implementation ensures that developers can execute tests or lightweight applications without external daemon processes or native vector binaries.
Sources: [mem0-ts/src/oss/src/vector_stores/memory.ts:231-240](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/memory.ts#L231-L240)

Vectors are serialized into binary buffers using `Float32Array` views mapped directly onto Node.js `Buffer` instances before insertion into SQLite tables. During vector similarity searches, rows are fetched and converted back into floating-point arrays to compute exact cosine similarity against the query vector.
Sources: [mem0-ts/src/oss/src/vector_stores/memory.ts:241-245](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/memory.ts#L241-L245)

```typescript
// Example usage of SQLite-backed memory store in TypeScript
import { MemoryVectorStore } from "mem0-ts/oss";

const store = new MemoryVectorStore({
  collectionName: "test_memories",
  dimension: 3
});

await store.insert(
  [[0.1, 0.2, 0.3]],
  ["mem_1"],
  [{ data: "Hello local vector world" }]
);

const results = await store.search([0.1, 0.2, 0.3], 5);
console.log(results);
```
Sources: [mem0-ts/src/oss/src/vector_stores/memory.ts:352-391](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/memory.ts#L352-L391)

## FAISS Local Indexing and Security Controls

The FAISS vector store integration (`FAISS`) provides high-performance local similarity search utilizing Facebook AI Similarity Search bindings. It supports distance strategies including `'euclidean'`, `'inner_product'`, and `'cosine'`, along with optional L2 normalization.
Sources: [mem0/vector_stores/faiss.py:127-146](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py#L127-L146)

To protect against arbitrary code execution vulnerabilities during local index deserialization, the FAISS driver implements a restricted unpickler (`SafeUnpickler`). This security guard strictly limits allowed pickle modules to `builtins` and restricts deserialized types to a strict whitelist.
Sources: [mem0/vector_stores/faiss.py:34-61](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py#L34-L61)

> [!CAUTION]
> Loading untrusted local FAISS index snapshots without `SafeUnpickler` active can lead to arbitrary code execution via standard Python `pickle` deserialization. The `SafeUnpickler` class enforces that only safe basic types (`dict`, `list`, `str`, `int`, `float`, `bool`, `tuple`, `set`, `frozenset`, `NoneType`) are instantiated during load operations.
Sources: [mem0/vector_stores/faiss.py:62-78](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py#L62-L78)

## Output Parsing and Score Normalization

Embedded vector stores return uniform results encapsulated in structured `OutputData` models. Because different underlying libraries compute raw metrics differently (such as unbounded Euclidean distances versus cosine similarity), embedded stores normalize raw scores into consistent similarity metrics.
Sources: [mem0/vector_stores/chroma.py:17-21](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L17-L21)

For instance, both Chroma and FAISS wrappers parse raw distance outputs using an inverse distance transformation formula: score equals one divided by one plus raw distance. This guarantees that similarity scores fall within a predictable range where higher values indicate closer proximity.
Sources: [mem0/vector_stores/chroma.py:76-102](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L76-L102)

The execution path for output parsing across local drivers processes raw results through array flattening and metric transformation before yielding structured output entries.
Sources: [mem0/vector_stores/chroma.py:103-110](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L103-L110)

```mermaid
sequenceDiagram
    participant Caller
    participant Store as VectorStoreDriver
    participant Parser as _parse_output()
    Caller->>Store: query(vectors, top_k)
    Store-->>Store: Execute local ANN search
    Store->>Parser: Pass raw query results (ids, distances, metadatas)
    Parser->>Parser: Flatten nested arrays & calculate 1 / (1 + distance)
    Parser-->>Store: Return List[OutputData]
    Store-->>Caller: Return standardized results
```
Sources: [mem0-ts/src/oss/src/vector_stores/chroma.ts:120-144](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/chroma.ts#L120-L144)

## Configuration and Initialization Parameters

Embedded vector stores accept specific configuration parameters to adjust persistence directories, dimension constraints, and distance metrics. The following table outlines key initialization arguments supported across embedded implementations:
Sources: [mem0/vector_stores/chroma.py:23-45](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L23-L45)

| Parameter Name | Target Driver | Default Value | Purpose |
| :--- | :--- | :--- | :--- |
| `collection_name` | All Drivers | Required | Unique identifier for the vector collection/index. |
| `path` | Chroma / FAISS | `None` / `"db"` | Local filesystem directory path for persistent database storage. |
| `distance_strategy` | FAISS | `"euclidean"` | Metric strategy used for similarity calculations. |
| `normalize_L2` | FAISS | `False` | Flag indicating whether to perform L2 normalization on vectors. |
| `embedding_model_dims` | FAISS / Memory | `1536` | Expected dimensionality of input vector embeddings. |

Sources: [mem0/vector_stores/faiss.py:127-146](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py#L127-L146)

> [!NOTE]
> When initializing local embedded stores like Chroma, omitting the `path` configuration automatically falls back to creating or utilizing a local `./db` directory relative to the execution context.
Sources: [mem0/vector_stores/chroma.py:64-71](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L64-L71)

## Error Handling and Graceful Fallbacks

Local embedded stores handle missing optional peer dependencies by raising informative installation instructions. For example, if `chromadb` or `faiss` packages are absent from the Python environment, import blocks catch `ImportError` exceptions and prompt the user to install the appropriate package via `pip`.
Sources: [mem0/vector_stores/chroma.py:6-11](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/chroma.py#L6-L11)

Similarly, in TypeScript implementations, peer dependencies such as `chromadb` are loaded lazily via dynamic `import()` statements wrapped in peer loaders. This design choice prevents application boot failures when importing modules that do not utilize local vector backends.
Sources: [mem0-ts/src/oss/src/vector_stores/chroma.ts:49-61](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/vector_stores/chroma.ts#L49-L61)

> [!WARNING]
> Ensure that matching native build tools (such as C++ build dependencies for FAISS CPU/GPU wheels) are present in your local environment when installing zero-dependency vector stores for local execution.
Sources: [mem0/vector_stores/faiss.py:21-28](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/vector_stores/faiss.py#L21-L28)

## Related

- [Vector Store Architecture](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/vector-stores/vector-store-architecture)


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/llms.txt) for all pages in this wiki.
