Send Traces to Projects
Send traces to different projects on Confident AI
Included on the Enterprise plan. Book a demo, opens in a new tab. Included on the Team plan. Included on the Starter plan. Not included on the Free plan.
Overview
You can specify which project each trace should be sent to by setting the Confident API key on a trace. This is especially useful when you need to separate traces to different projects within the same LLM application.
Route Traces to Projects
You can use update_current_trace to set the confident_api_key for a specific trace.
from deepeval.tracing import observe, update_current_trace
from openai import OpenAI
client = OpenAI()
@observe()
def llm_app(query: str):
res = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": query}]
).choices[0].message.content
if query == "Write me a poem.":
update_current_trace(confident_api_key="confident-api-key-1")
else:
update_current_trace(confident_api_key="confident-api-key-2")
return res
llm_app("Write me a poem.")You can use updateCurrentTrace to set the confidentApiKey for a specific trace.
import { observe, updateCurrentTrace } from 'deepeval/tracing';
import OpenAI from 'openai';
const llmApp = async (query: string) => {
const openai = new OpenAI();
const res = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: query }]
})
if (query === "Write me a poem.") {
updateCurrentTrace({ confidentApiKey: "confident-api-key-1" });
} else {
updateCurrentTrace({ confidentApiKey: "confident-api-key-2" });
}
return res.choices[0].message.content;
};
const observedLlmApp = observe({fn: llmApp});
observedLlmApp("Write me a poem.");Last updated on