Contextual AI lets you create and run specialized AI agents that are powered by your data. These notebooks introduce an end-to-end example workflow for creating a Retrieval-Augmented Generation (RAG) agent for a financial use case. The agent will answer questions based on the documents provided, but avoid any forward looking statements, e.g., Tell me about sales in 2028.
The full documentation is available at docs.contextual.ai
You can go through this lab in 30-60 minutes. To get started in Colab click the following button:
In this lab you will learn how to:
- Creating a Datastore: this is where your documents live (unstructured data)
- Ingesting Documents: we will use a single PDF document but the platform is fully scalable and supports HTML among other formats
- Creating an RAG Agent: all you need is a good system prompt to get started
- Query a RAG Agent: answers based on your data and nothing more
- Evaluate the accuracy using a sample eval set
- Prompt engineering
- Fine-tuning
-
API key. You can request one here.
-
We will share the key with you or you will have to:
- Login to your account at app.contextual.ai
- Click on "API Keys"
- Click on "Create API Key". Note: Please keep your key in a secure place, and do not share it with anyone
-
Python 3.9+
To quickly get started running the notebook we reccomend using Google Colab. If you'd prefer to run it locally, you can run in VS Code following these steps:
-
📥 Clone this repository
git clone https://github.com/ContextualAI/examples cd examples/02-hands-on-lab/
-
🌎 Create a virtual environment:
python -m venv . && source bin/activate
-
📦 Install required dependencies
pip install -r requirements.txt
-
🎮 Open the notebook in VS Code, click on "Select Kernel" (top right) -> "Python Environments" and select the newly created
venv
environment: -
🔑 Set up your API credentials in the respective notebook
API_TOKEN = '...' # Replace with your actual API token