Working with Replicate in Pixeltable

Pixeltable's Replicate integration enables you to access Replicate's models via the Replicate 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 replicate
Environment variables it names
REPLICATE_API_TOKEN
Pixeltable calls
replicate.run()pxt.create_table()add_computed_column()join()insert()

A look at the code

working-with-replicate.ipynb
from pixeltable.functions.replicate import run
# Create a table in Pixeltable and pick a model hosted on Replicate with some parameters
t = pxt.create_table('replicate_demo/chat', {'prompt': pxt.String})
input = {
'system_prompt': 'You are a helpful assistant.',
'prompt': t.prompt,
# These parameters are optional and can be used to tune model behavior:
'max_tokens': 300,
'top_p': 0.9,
'temperature': 0.8,
}
t.add_computed_column(
output=run(input, ref='meta/meta-llama-3-8b-instruct')
)

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

Browse all 103