Export your traces and log them to Deepchecks
Exporting Traces to JSON
Deepchecks lets you export traces to a local JSON file instead of sending them to Deepchecks in real time. This is useful for developers who want to inspect, store, or upload traces at a later time.
To export traces to a JSON file, install the required packages:
pip install "deepchecks-llm-client[otel]"
Then, use the following code:
from deepchecks_llm_client.data_types import EnvType
from deepchecks_llm_client.otel import LanggraphIntegration # Or "import CrewaiIntegration"
LanggraphIntegration().register_json_exporter( # Or "CrewaiIntegration()."
output_folder="Your Output Folder Here",
log_to_console=True # Optional: Set to True to log spans to console
)
After running this, a JSON file containing the run traces will appear in the specified output folder.
Logging a trace JSON to Deepchecks
Once you have exported traces, you can log them to Deepchecks for observability and evaluation using the following code:
from deepchecks_llm_client.otel import DeepchecksLLMClient
import os
import json
from dotenv import load_dotenv
load_dotenv()
host = os.getenv("DEEPCHECKS_HOST")
api_token = os.getenv("DEEPCHECKS_API_TOKEN")
dc_client = DeepchecksLLMClient(
host=host,
api_token=api_token
)
dc_client.send_spans(
app_name="Your App Name",
version_name="Your Version Name",
env_type="EVAL",
json_path="Path of the JSON File"
)
This process allows you to upload previously exported traces to Deepchecks for observability, evaluation, and monitoring.
Updated 1 day ago