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

# Vector database integrations

> Configure vector storage backends for HeavenBase workspaces.

<Note>
  Vector fields route through the same workspace storage planner as SQL and search fields.
</Note>

## 1. Supported vector backends

HeavenBase includes vector backend implementations for:

* `lance`
* `milvus`
* `pgvector`
* `chroma`
* `pinecone`
* `inmem`

Use `inmem` for dependency-light tests, `lance` for local file-backed vector storage, `milvus` for a local or remote Milvus service, and `pgvector` when vectors should live beside Postgres rows.

<br />

## 2. Presets

The built-in `debug` workspace preset uses SQLite for rows plus in-memory vector and search backends:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import heavenbase as hb

workspace = hb.HeavenBase("demo", preset="debug")
```

The `local-lts` preset is shaped for a local stack with Postgres rows, LanceDB vectors, and Elasticsearch search:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
workspace = hb.HeavenBase("agent-shop", preset="local-lts")
```

The Lance path uses the workspace id in its configured URI, so each workspace gets an isolated vector directory.

<br />

## 3. Explicit backend config

You can pass backend config directly when a test or application should avoid global presets:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
workspace = hb.HeavenBase(
    "vector-demo",
    backends={
        "main": {"type": "sqlite", "database": ":memory:"},
        "vec": {"type": "inmem", "name": "vec"},
    },
)
```

Then define vector fields in normal entities:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
class Issue(hb.Entity):
    title = hb.field(hb.ShortText)
    emb = hb.field(hb.Vector[3])
```

Queries use the same JSON and Python DSL surfaces:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
workspace.query(Issue).near(Issue.emb, [1.0, 0.0, 0.0], top_k=5).execute()
```

<br />

## Further Exploration

<Tip>
  **Related resources:**

  * [Backends](/features/backends) - Backend capabilities and storage families
  * [Routing](/features/routing) - How field placement is planned
  * [Query](/features/query) - JSON and Python query surfaces
  * [Database integrations](/integrations/databases) - SQL-family provider setup
</Tip>

<br />
