Quickstart - LLM tracing
LLM tracing "Hello world."
This quickstart shows how to instrument a simple LLM app to send inputs and outputs to Evidently Cloud. You will use the open-source Tracely library.
You will need an OpenAI key to create a toy LLM app.
Need help? Ask on Discord.
1. Set up Evidently Cloud
Set up your Evidently Cloud workspace:
Sign up. If you do not have one yet, sign up for a free Evidently Cloud account.
Create an Organization. When you log in the first time, create and name your Organization.
Create a Project. Click + button under Project List. Create a Project, copy and save the Project ID. (Projects page)
Get your API token. Click the Key icon in the left menu. Generate and save the token. (Token page).
You can now go to your Python environment.
2. Installation
Install the Tracely library to instrument your app:
Install the Evidently library to interact with Evidently Cloud:
Install the OpenAI library to create a toy app:
Imports:
2. Initialize Tracing
Initialize the OpenAI client. Pass the token as an environment variable:
Set up tracing parameters. Give it a name to identify your tracing dataset.
3. Trace a simple function
Create a simple function to send questions to Open AI API and receive a completion. Set the questions list:
Create a function and use the trace_event()
decorator to trace it:
4. View Traces
Go to the Evidently Cloud, open Datasets in the left menu (Datasets Page), and view your Traces.
What's next?
Want to run evaluations over this data? See a Quickstart.
Check out a more in-depth tutorial to learn more about tracing:
Last updated