Overview
This guide shows you how to use Luna-2 metrics to evaluate your AI applications. You will be running a basic AI app using OpenAI as an LLM, and evaluating it for input toxicity and prompt injections using Luna-2. In this guide you will:- Set up a project with Galileo
- Create your AI application
- Configure Luna-2 metrics
- Run your app again to evaluate these metrics
- Adjust your prompt to increase toxicity and add a prompt injection
Before you start
To complete this how-to, you will need:- An OpenAI API key
- A Galileo project configured to use the Luna-2 model
- 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 your AI application
Create a file for your app called app.py or app.ts.
Add the following code to this file
package.json file:Run the app to ensure everything is working
View the app in the Galileo Console
Configure Luna-2 metrics
Now you can configure metrics using Luna-2. You will be adding metrics to look for toxicity and prompt injection attacks in the input.Configure metrics for the logstream

Turn on the Luna-2 input toxicity and prompt injection metrics


Save and close the metric configuration tab
Run your app again to evaluate these metrics
Run your app again
View the traces for your app in the Galileo Console

Adjust your prompt to increase toxicity and add a prompt injection
Now that your app is evaluating metrics using Luna-2, you will change the prompt to see them in action.Update the prompt
Run your app again
View the traces for your app in the Galileo Console
