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

# LangDB Embedder

> Generate embeddings through a LangDB project endpoint.

`LangDBEmbedder` routes OpenAI-compatible embedding requests through the project selected by `LANGDB_PROJECT_ID`.

```python langdb_embedder.py theme={null}
from os import environ

from agno.knowledge.embedder.langdb import LangDBEmbedder

project_id = environ["LANGDB_PROJECT_ID"]
embedder = LangDBEmbedder(
    base_url=f"https://api.langdb.ai/{project_id}/v1",
)
embedding = embedder.get_embedding(
    "The quick brown fox jumps over the lazy dog."
)

print(f"First values: {embedding[:5]}")
print(f"Dimensions: {len(embedding)}")
```

The default model is `text-embedding-ada-002` with 1536 dimensions. Pass `id` and `dimensions` together when selecting another model.

<Warning>
  Agno v2.7.2 constructs the legacy `api.us-east-1.langdb.ai` host when `base_url` is omitted. LangDB's current API guide uses `api.langdb.ai`. Pass `base_url` as shown above.
</Warning>

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Configure the project">
    ```bash theme={null}
    export LANGDB_API_KEY=your_langdb_api_key_here
    export LANGDB_PROJECT_ID=your_langdb_project_id_here
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Run the example">
    ```bash theme={null}
    python langdb_embedder.py
    ```
  </Step>
</Steps>

## Developer Resources

* [Embedders overview](/knowledge/concepts/embedder/overview)
* [LangDB API setup](https://docs.langdb.ai/getting-started/working-with-api/)
* [LangDB embeddings endpoint](https://docs.langdb.ai/api-reference/generate-embeddings/)
