Skip to Content
Confident AI is free to try . No credit card required.

Metadata

With Confident AI, you can attach additional metadata to both traces and spans. This information can be used for filtering, grouping, and analyzing your traces in the observatory.

Add Metadata

Use update_current_span and update_current_trace to add span-level and trace-level metadata.

Each metadata argument is a dictionary whose keys are strings and whose values are any JSON-serializable type.

from deepeval.tracing import observe, update_current_span, update_current_trace @observe() async def llm_app(query: str): # Add span-level metadata update_current_span( metadata={ "source": "knowledge_base_1", "retrieved_documents": 3 } ) # Add trace-level metadata update_current_trace( metadata={ "user_id": "user-456", "app_version": "1.2.3", } ) llm_app("Test Metadata")
Last updated on