Set up tracing

Set up LLM tracing with tracely.

For an end-to-end example, check the Tracing Quickstart.

Installation and Imports

Install the tracely package from PyPi.

!pip install tracely 

Imports:

from tracely import init_tracing
from tracely import trace_event

Initialize tracing

Use init_tracing to enable tracely tracing. Example:

init_tracing(
   address="https://app.evidently.cloud/",
   api_key=”YOUR_EVIDENTLY_TOKEN”,
   team_id="YOUR_EVIDENTLY_TEAM_ID",
   export_name="YOUR_TRACING_DATASET_NAME",
   )

Tracing parameters

Tracing a function

To trace a function call use trace_event() decorator.

Example 1. To log all arguments of the function:

@trace_event()

Example 2. To log only input arguments of the function:

@trace_event(track_args=[])

Example 3. To log only "arg1" and "arg2":

@trace_event(track_args=["arg1", "arg2"])

See the Tracing Quickstart for an end-to-end example.

Last updated