Projects

Send traces to different projects on Confident AI

Overview

You can specify which project each trace should be sent to by setting the confident_api_key. This is especially useful when you need to separate traces to different projects within the same llm application.

The Confident API key is unique to each project and can be found in your project settings on Confident AI.

Set Projects At Runtime

You can use the update_current_trace function to set the confident_api_key for a specific trace.

main.py
1from deepeval.tracing import observe, update_current_trace
2from openai import OpenAI
3
4client = OpenAI()
5
6@observe()
7def llm_app(query: str):
8 res = client.chat.completions.create(
9 model="gpt-4o",
10 messages=[{"role": "user", "content": query}]
11 ).choices[0].message.content
12
13 if query == "Write me a poem.":
14 update_current_trace(confident_api_key="confident-api-key-1")
15 else:
16 update_current_trace(confident_api_key="confident-api-key-2")
17 return res
18
19llm_app("Write me a poem.")

confident_api_key overrides the CONFIDENT_API_KEY environment variable.