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

# Together Embedder

The `TogetherEmbedder` can be used to embed text data into vectors using the Together API. Together uses the OpenAI API specification, so the `TogetherEmbedder` class is similar to the `OpenAIEmbedder` class, incorporating adjustments to ensure compatibility with the Together platform. Get your key from [here](https://api.together.xyz/settings/api-keys).

## Usage

```python together_embedder.py theme={null}
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.pgvector import PgVector
from agno.knowledge.embedder.together import TogetherEmbedder

# Embed sentence in database
embeddings = TogetherEmbedder().get_embedding("The quick brown fox jumps over the lazy dog.")

# Print the embeddings and their dimensions
print(f"Embeddings: {embeddings[:5]}")
print(f"Dimensions: {len(embeddings)}")

# Use an embedder in a knowledge base
knowledge = Knowledge(
    vector_db=PgVector(
        db_url="postgresql+psycopg://ai:ai@localhost:5532/ai",
        table_name="together_embeddings",
        embedder=TogetherEmbedder(),
    ),
    max_results=2,
)
```

## Params

| Parameter      | Type   | Default                                  | Description                                                       |
| -------------- | ------ | ---------------------------------------- | ----------------------------------------------------------------- |
| `model`        | `str`  | `"nomic-ai/nomic-embed-text-v1.5"`       | The name of the model used for generating embeddings.             |
| `dimensions`   | `int`  | `768`                                    | The dimensionality of the embeddings generated by the model.      |
| `api_key`      | `str`  |                                          | The API key used for authenticating requests.                     |
| `base_url`     | `str`  | `"https://api.Together.ai/inference/v1"` | The base URL for the API endpoint.                                |
| `enable_batch` | `bool` | `False`                                  | Enable batch processing to reduce API calls and avoid rate limits |
| `batch_size`   | `int`  | `100`                                    | Number of texts to process in each API call for batch operations. |

## Developer Resources

* View [Cookbook](https://github.com/agno-agi/agno/tree/main/cookbook/08_knowledge/embedders/together_embedder.py)
