This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Pixeltable’s Deepseek integration enables you to access Deepseek’s LLM
via the Deepseek API.
Deepseek usage may incur costs based on your Deepseek plan.
Be mindful of sensitive data and consider security measures when
integrating with external services.
First you’ll need to install the required libraries and enter a Deepseek
API key. Deepseek uses the OpenAI SDK as its Python API, so we need to
install it in addition to Pixeltable.
%pip install -qU pixeltable openai
import getpassimport osif 'DEEPSEEK_API_KEY' not in os.environ: os.environ['DEEPSEEK_API_KEY'] = getpass.getpass('Deepseek API Key:')
Deepseek API Key: ········
Now let’s create a Pixeltable directory to hold the tables for our demo.
import pixeltable as pxt# Remove the 'deepseek_demo' directory and its contents, if it existspxt.drop_dir('deepseek_demo', force=True)pxt.create_dir('deepseek_demo')
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/sergeymkhitaryan/.pixeltable/pgdata
Created directory ‘deepseek_demo’.
<pixeltable.catalog.dir.Dir at 0x31342ada0>
Messages
Create a Table: In Pixeltable, create a table with columns to represent
your input data and the columns where you want to store the results from
Deepseek.deepseek-flash runs in thinking mode by default and generates
reasoning before its answer. To disable thinking, pass
model_kwargs={'extra_body': {'thinking': {'type': 'disabled'}}} to
chat_completions().
from pixeltable.functions import deepseek# Create a table in Pixeltable and add a computed column that calls Deepseekt = pxt.create_table('deepseek_demo/chat', {'input': pxt.String})msgs = [{'role': 'user', 'content': t.input}]t.add_computed_column( output=deepseek.chat_completions( messages=msgs, model='deepseek-flash' ))
Created table ‘chat’.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
# Parse the response into a new columnt.add_computed_column(response=t.output.choices[0].message.content)
Added 0 column values with 0 errors in 0.01 s
No rows affected.
# Start a conversationt.insert( [ { 'input': 'What was the outcome of the 1904 US Presidential election?' } ])t.select(t.input, t.response).show()
Inserted 1 row with 0 errors in 3.99 s (0.25 rows/s)
Learn more
To learn more about advanced techniques like RAG operations in
Pixeltable, check out the RAG Operations in
Pixeltable
tutorial.
Last modified on October 30, 2026
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.