Skip to main content

module  pixeltable.functions.nebius

Pixeltable UDFs for Nebius Token Factory models. Provides integration with Nebius Token Factory’s language and embedding models. In order to use them, you must first pip install openai and configure your Nebius Token Factory API key, by setting the NEBIUS_API_KEY environment variable or nebius.api_key in the Pixeltable config file.

udf  chat_completions()

Signature
Creates a model response for the given chat conversation. Equivalent to the Nebius Token Factory chat/completions API endpoint. For additional details, see: https://docs.tokenfactory.nebius.com/api-reference/inference/create-chat-completion Nebius Token Factory exposes an OpenAI-compatible API, so you will need to install the openai package to use this UDF. Request throttling: Applies the rate limit set in the config (section nebius, key rate_limit). If no rate limit is configured, a default rate limit is applied. Requirements:
  • pip install openai
Parameters:
  • messages (pxt.Json[(Json): A list of messages to use for chat completion, as described in the Nebius API documentation.
  • model (Any): The model to use for chat completion.
  • model_kwargs (Any): Additional keyword args for the Nebius chat/completions API. For details on the available parameters, see: https://docs.tokenfactory.nebius.com/api-reference/inference/create-chat-completion
  • tools (Any): An optional list of Pixeltable tools to use for the request.
  • tool_choice (Any): An optional tool choice configuration.
Returns:
  • pxt.Json: A dictionary containing the response and other metadata.
Examples: Add a computed column that applies the model meta-llama/Llama-3.3-70B-Instruct to an existing Pixeltable column tbl.prompt of the table tbl:
You can also include images in the messages list, for vision-capable models such as Qwen/Qwen2.5-VL-72B-Instruct, by passing image data directly in the input dictionary, in the 'image_url' field of the message content, as in this example:

udf  embeddings()

Signature
Query an embedding model for a given string of text. Equivalent to the Nebius Token Factory embeddings API endpoint. For additional details, see: https://docs.tokenfactory.nebius.com/api-reference/inference/create-embeddings Request throttling: Applies the rate limit set in the config (section nebius, key rate_limit). If no rate limit is configured, a default rate limit is applied. Requirements:
  • pip install openai
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.
  • model_kwargs (pxt.Json | None): Additional keyword args for the Nebius embeddings API, e.g. dimensions to request a truncated embedding for models that support it (see the note below).
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 Qwen/Qwen3-Embedding-8B to an existing Pixeltable column tbl.text of the table tbl:
Qwen/Qwen3-Embedding-8B produces 4096-dimensional embeddings by default, which exceed the maximum of 4000 dimensions supported by Pixeltable embedding indexes. Request a smaller, indexable size via model_kwargs:
Last modified on July 20, 2026