Environment

Set your environments during tracing for better debugging

Overview

The environment feature allows you to specify which environment your traces are coming from. This is useful for separating traces from different environments in "development", "staging", "production", or "testing".

Traces from component-level evals are automatically classified in the "testing" enviornment.

Configure Environment

You can configure the environment with the CONFIDENT_TRACE_ENVIRONMENT environment variable.

$export CONFIDENT_TRACE_ENVIRONMENT="staging"

Alternatively, you can set the environment directly in code:

main.py
1from openai import OpenAI
2from deepeval.tracing import observe, trace_manager
3
4trace_manager.configure(environment="production")
5client = OpenAI()
6
7@observe()
8def llm_app(query: str):
9 return client.chat.completions.create(
10 model="gpt-4o",
11 messages=[{"role": "user", "content": query}]
12 ).choices[0].message.content
13
14llm_app("Write me a poem.")

The environment can be either "production", "staging", or "development", and helps you identify where your traces are coming from.