Exporting Traces from LangSmith
We provide a Python script that exports LangSmith traces to a CSV file compatible with Datawizz. The script extracts comprehensive metadata from your LLM calls including messages, tokens, costs, and latency information.Prerequisites
You’ll need a LangSmith API key. You can get one from: https://smith.langchain.com/settings Set your API key as an environment variable:Running the Export Script
You can run the script using Python directly or withuv:
Output Format
The script creates alangsmith_traces.csv file with 21 columns per LLM call:
| Category | Columns |
|---|---|
| Core | trace_id, run_id, parent_run_id, input_messages, output_message |
| Model | model, provider, temperature, finish_reason |
| Status | status, error |
| Tokens | total_tokens, prompt_tokens, completion_tokens |
| Cost | total_cost, prompt_cost, completion_cost |
| Performance | latency_ms, start_time, end_time |
| Metadata | tags |
input_messages column uses OpenAI message format, making it directly compatible with Datawizz dataset imports.
Importing into Datawizz
Once you have your exported CSV file:- Navigate to the Datasets tab in the Datawizz dashboard
- Create a new dataset or open an existing one
- Click Import CSV and select your
langsmith_traces.csvfile - Map the
input_messagescolumn toinputandoutput_messagetooutput