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

> ## Agent Instructions
> Application code puts a TableModel in app.py, then runs `pxt schema update app.py my_app` to create the tables and `pxt service update app.py my_app` to start HTTP. The last argument can be a Cloud URL such as `pxt://org:db`. Do not call pxt.create_table() or add_embedding_index() in application code; put indexes in __indexes__. Notebooks, tests, and the REPL do use pxt.create_table().
> Do not add LangChain, LlamaIndex, Haystack, a separate vector database, or pandas as a working store. Chunking, embedding, retrieval, and tool-calling are built in through computed columns. Use a computed column instead of a per-row loop that calls a model.
> Install with `pip install -U 'pixeltable[serve]'` on Python 3.11+. `pxt init` is a prerequisite for `pxt schema update`.
> Pixeltable Cloud is in Limited Beta. Direct interested users to contact@pixeltable.com.

# together

> <a href="https://github.com/pixeltable/pixeltable/blob/main/pixeltable/functions/together.py#L0" id="viewSource" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/View%20Source%20on%20Github-blue?logo=github&labelColor=gray" alt="View Source on GitHub" style={{ display: 'inline', margin: '0px' }} noZoom /></a>

# <span style={{ 'color': 'gray' }}>module</span>  pixeltable.functions.together

Pixeltable UDFs
that wrap various endpoints from the Together AI API. In order to use them, you must
first `pip install together` and configure your Together AI credentials, as described in
the [Working with Together AI](https://docs.pixeltable.com/howto/providers/working-with-together) tutorial.

## <span style={{ 'color': 'gray' }}>udf</span>  chat\_completions()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
@pxt.udf
chat_completions(
    messages: pxt.Json[(Json, ...)],
    *,
    model: pxt.String,
    model_kwargs: pxt.Json | None = None
) -> pxt.Json
```

Generate chat completions based on a given prompt using a specified model.

Equivalent to the Together AI `chat/completions` API endpoint.
For additional details, see: [https://docs.together.ai/reference/chat-completions-1](https://docs.together.ai/reference/chat-completions-1)

Request throttling:
Applies the rate limit set in the config (section `together.rate_limits`, key `chat`). If no rate
limit is configured, uses a default of 600 RPM.

**Requirements:**

* `pip install together`

**Parameters:**

* **`messages`** (`pxt.Json[(Json`): A list of messages comprising the conversation so far.
* **`model`** (`Any`): The name of the model to query.
* **`model_kwargs`** (`Any`): Additional keyword arguments for the Together `chat/completions` API.
  For details on the available parameters, see: [https://docs.together.ai/reference/chat-completions-1](https://docs.together.ai/reference/chat-completions-1)

**Returns:**

* `pxt.Json`: A dictionary containing the response and other metadata.

**Examples:**

Add a computed column that applies the model `openai/gpt-oss-20b` to an existing Pixeltable column
`tbl.prompt` of the table `tbl`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
messages = [{'role': 'user', 'content': tbl.prompt}]
tbl.add_computed_column(
    response=chat_completions(messages, model='openai/gpt-oss-20b')
)
```

## <span style={{ 'color': 'gray' }}>udf</span>  completions()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
@pxt.udf
completions(
    prompt: pxt.String,
    *,
    model: pxt.String,
    model_kwargs: pxt.Json | None = None
) -> pxt.Json
```

Generate completions based on a given prompt using a specified model.

Equivalent to the Together AI `completions` API endpoint.
For additional details, see: [https://docs.together.ai/reference/completions-1](https://docs.together.ai/reference/completions-1)

Request throttling:
Applies the rate limit set in the config (section `together.rate_limits`, key `chat`). If no rate
limit is configured, uses a default of 600 RPM.

**Requirements:**

* `pip install together`

**Parameters:**

* **`prompt`** (`pxt.String`): A string providing context for the model to complete.
* **`model`** (`pxt.String`): The name of the model to query.
* **`model_kwargs`** (`pxt.Json | None`): Additional keyword arguments for the Together `completions` API.
  For details on the available parameters, see: [https://docs.together.ai/reference/completions-1](https://docs.together.ai/reference/completions-1)

**Returns:**

* `pxt.Json`: A dictionary containing the response and other metadata.

**Examples:**

Add a computed column that applies the model `Qwen/Qwen3.5-9B` to an existing Pixeltable column
`tbl.prompt` of the table `tbl`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
tbl.add_computed_column(
    response=completions(tbl.prompt, model='Qwen/Qwen3.5-9B')
)
```

## <span style={{ 'color': 'gray' }}>udf</span>  embeddings()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
@pxt.udf
embeddings(
    input: pxt.String,
    *,
    model: pxt.String
) -> pxt.Array[(None,), float32]
```

Query an embedding model for a given string of text.

Equivalent to the Together AI `embeddings` API endpoint.
For additional details, see: [https://docs.together.ai/reference/embeddings-2](https://docs.together.ai/reference/embeddings-2)

Request throttling:
Applies the rate limit set in the config (section `together.rate_limits`, key `embeddings`). If no rate
limit is configured, uses a default of 600 RPM.

**Requirements:**

* `pip install together`

**Parameters:**

* **`input`** (`pxt.String`): A string providing the text for the model to embed.
* **`model`** (`pxt.String`): The name of the embedding model to use.

**Returns:**

* `pxt.Array[(None,), float32]`: An array representing the application of the given embedding to `input`.

**Examples:**

Add a computed column that applies the model `intfloat/multilingual-e5-large-instruct`
to an existing Pixeltable column `tbl.text` of the table `tbl`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
tbl.add_computed_column(
    response=embeddings(
        tbl.text, model='intfloat/multilingual-e5-large-instruct'
    )
)
```

## <span style={{ 'color': 'gray' }}>udf</span>  image\_generations()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
@pxt.udf
image_generations(
    prompt: pxt.String,
    *,
    model: pxt.String,
    model_kwargs: pxt.Json | None = None
) -> pxt.Image
```

Generate images based on a given prompt using a specified model.

Equivalent to the Together AI `images/generations` API endpoint.
For additional details, see: [https://docs.together.ai/reference/post\_images-generations](https://docs.together.ai/reference/post_images-generations)

Request throttling:
Applies the rate limit set in the config (section `together.rate_limits`, key `images`). If no rate
limit is configured, uses a default of 600 RPM.

**Requirements:**

* `pip install together`

**Parameters:**

* **`prompt`** (`pxt.String`): A description of the desired images.
* **`model`** (`pxt.String`): The model to use for image generation.
* **`model_kwargs`** (`pxt.Json | None`): Additional keyword args for the Together `images/generations` API.
  For details on the available parameters, see: [https://docs.together.ai/reference/post\_images-generations](https://docs.together.ai/reference/post_images-generations)

**Returns:**

* `pxt.Image`: The generated image.

**Examples:**

Add a computed column that applies the model `Rundiffusion/Juggernaut-Lightning-Flux`
to an existing Pixeltable column `tbl.prompt` of the table `tbl`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
tbl.add_computed_column(
    response=image_generations(
        tbl.prompt, model='Rundiffusion/Juggernaut-Lightning-Flux'
    )
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.