Working with Anthropic in Pixeltable

Pixeltable's Anthropic integration enables you to access Anthropic's Claude LLM via the Anthropic API.

Providers · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it uses

Install
terminal
pip install pixeltable anthropic
Environment variables it names
ANTHROPIC_API_KEY
Pixeltable calls
anthropic.messages()pxt.create_table()add_computed_column()insert()

A look at the code

working-with-anthropic.ipynb
from pixeltable.functions import anthropic
# Create a table in Pixeltable and add a computed column that calls Anthropic
t = pxt.create_table('anthropic_demo/chat', {'input': pxt.String})
msgs = [{'role': 'user', 'content': t.input}]
t.add_computed_column(
output=anthropic.messages(
messages=msgs,
model='claude-haiku-4-5-20251001',
max_tokens=300,
model_kwargs={
# Optional dict with parameters for the Anthropic API
'system': 'Respond to the prompt with detailed historical information.'
},
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103