Add Tags to Traces
Adding tags to your traces for better visibility on Confident AI
Overview
Unlike metadata, which can contain complex structured data, tags are simple string labels that make it easy to group related traces together, and cannot be applied to spans.
Add Tags to Traces
Tags are applied at the trace level, making them visible for all spans within that trace.
from deepeval.tracing import observe, update_current_trace
from openai import OpenAI
client = OpenAI()
@observe(type="agent")
def llm_app(query: str):
update_current_trace(tags=["Causal Chit-Chat"])
return client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": query}]
).choices[0].message.content
llm_app("Write me a poem.")import { observe, updateCurrentTrace } from 'deepeval/tracing';
import OpenAI from 'openai';
const llmApp = async (query: string) => {
updateCurrentTrace({ tags: ["Causal Chit-Chat"] });
const openai = new OpenAI();
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [ { role: "user", content: query } ]
});
return response.choices[0].message.content;
};
const observedLlmApp = observe({ type: "agent", fn: llmApp });
observedLlmApp("Write me a poem.");Last updated on