- Set up your project with Galileo
- Create a basic RAG application
- Add logging with Galileo
- Run your app using an experiment
Before you start
To complete this how-to, you will need:- An OpenAI API key
- A Galileo project
- An LLM integration configured to calculate LLM-as-a-judge metrics
- Your Galileo API key
Install dependencies
To use Galileo, you need to install some package dependencies, and configure environment variables.Install Required Dependencies
Create a .env file, and add the following values
Create a basic RAG application
In this section you will create a basic RAG application. This will use tool calling to call a function that simulates a RAG system by returning some pre-defined documents.Create a file called app.py (Python) or app.ts (TypeScript)
Add imports
Add a RAG function
Add a tool to get the horoscope
Add code to interact with an LLM
Add a function to generate the horoscope using the LLM and tools
Add a main function
Run your code
Add logging with Galileo
You now have a basic AI application with a tool that uses RAG. Let’s add logging with Galileo.Add imports for Galileo
Create a session and trace
Use the Galileo OpenAI wrapper to log an LLM span
Log the RAG call as a retriever span
Log the tool call as a tool span
Run your code

Run your app using an experiment
Now that your app is running, let’s create an experiment file to run the app as an experiment. In this code you’ll create a new file to run as a test, but in the real world you would probably create this as a unit test using your preferred framework of choice.Create a file called experiment.py (Python) or experiment.ts (TypeScript)
Add code to run the experiment
Run your code
