module pixeltable.functions.anthropic
Pixeltable UDFs
that wrap various endpoints from the Anthropic API. In order to use them, you must
first pip install anthropic and configure your Anthropic credentials, as described in
the Working with Anthropic tutorial.
Converts an Anthropic response dict to Pixeltable tool invocation format and calls tools._invoke().
udf messages()
Create a Message.
Equivalent to the Anthropic messages API endpoint.
For additional details, see: https://docs.anthropic.com/en/api/messages
Request throttling:
Uses the rate limit-related headers returned by the API to throttle requests adaptively, based on available
request and token capacity. No configuration is necessary.
Requirements:
Parameters:
messages (Json): Input messages.
model (String): The model that will complete your prompt.
model_kwargs (Json | None): Additional keyword args for the Anthropic messages API.
For details on the available parameters, see: https://docs.anthropic.com/en/api/messages
tools (Json | None): An optional list of Pixeltable tools to use for the request.
tool_choice (Json | None): An optional tool choice configuration.
Returns:
Json: A dictionary containing the response and other metadata.
Examples:
Add a computed column that applies the model claude-3-5-sonnet-20241022 to an existing Pixeltable column tbl.prompt of the table tbl:
Last modified on January 15, 2026