module pixeltable.functions.openllm
Pixeltable UDFs for OpenLLM. OpenLLM connects your AI subscriptions, provider API keys, and local models, and serves them through one OpenAI-compatible endpoint. By default, these UDFs call the local OpenLLM daemon athttp://127.0.0.1:8787/v1,
which needs no configuration. Set OPENLLM_BASE_URL to use another endpoint, and OPENLLM_API_KEY if that
endpoint requires authentication. To get started, see the OpenLLM quickstart.
udf chat_completions()
Signature
chat/completions endpoint of OpenLLM.
For additional details, see: https://docs.openllm.sh
The model can be a fallback alias such as plus, which moves to the next model in its chain when a provider
is rate-limited or unavailable, or any model ID listed by the OpenLLM models endpoint.
Request throttling:
Applies the rate limit set in the config (section openllm, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install openai
messages(pxt.Json[(Json): A list of messages to use for chat completion, in the OpenAI chat format.model(Any): The model or fallback alias to use for chat completion.model_kwargs(Any): Additional OpenAI-compatible parameters for thechat/completionsendpoint.tools(Any): An optional list of Pixeltable tools to use for the request.tool_choice(Any): An optional tool choice configuration.
pxt.Json: A dictionary containing the response and other metadata.
plus alias to an existing Pixeltable column tbl.prompt
of the table tbl:
'image_url' field of the message content, as in this example:
udf responses()
Signature
responses endpoint of OpenLLM.
For additional details, see: https://docs.openllm.sh
The model can be a fallback alias such as plus, which moves to the next model in its chain when a provider
is rate-limited or unavailable, or any model ID listed by the OpenLLM models endpoint.
Request throttling:
Applies the rate limit set in the config (section openllm, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install openai
input(pxt.Json[(Json): A list of input items for the model, in the OpenAI Responses format.model(Any): The model or fallback alias to use for generating a response.model_kwargs(Any): Additional OpenAI-compatible parameters for theresponsesendpoint, such asinstructions,temperatureormax_output_tokens.tools(Any): An optional list of Pixeltable tools to use for the request.tool_choice(Any): An optional tool choice configuration.
pxt.Json: A dictionary containing the response and other metadata. The response text is in theoutputlist.
plus alias to an existing Pixeltable column tbl.prompt
of the table tbl:
input_image content type: