Build a RAG pipeline
Create a retrieval-augmented generation system that answers questions using your documents as context.
Build the six architectural patterns of agentic AI (prompt chaining, routing, parallelization, tool use, evaluator-optimizer, orchestrator-worker) and the ReAct and planning strategies as Pixeltable tables and computed columns.
Agents · 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.
pip install pixeltable openai
OPENAI_API_KEYopenai.chat_completions()openai.invoke_tools()pxt.create_table()@pxt.udfpxt.tools()pxt.udf()add_computed_column()insert()# Step 1: generate an outlinechain.add_computed_column(outline_response=openai.chat_completions(messages=[{'role': 'user','content': 'Create a 3-point outline for a short article about: '+ chain.topic,}],model='gpt-4o-mini',))chain.add_computed_column(outline=chain.outline_response.choices[0].message.content.astype(pxt.String))
One cell of the notebook, copied as it is. Open it in Colab for the rest.
Create a retrieval-augmented generation system that answers questions using your documents as context.
Score model output with a second model, as a chain of computed columns
In this tutorial, we'll demonstrate how RAG operations can be implemented in Pixeltable. In particular, we'll develop a RAG application that summarizes a collection of PDF documents and uses ChatGPT to answer questions about them.
In this tutorial, we'll explore Pixeltable's flexible handling of RAG operations on unstructured text.