A tool to view LLM call traces from JSONL log files.
Project description
llmtraceviewer
A Python package and CLI tool to view LLM call traces from JSONL log files. It starts a local HTTP server for interactive log exploration.
Usage
llmtraceviewer <log_filename or directory>
- Starts a FastAPI server
- Provides an API endpoint for log data
- You can specify a single log file or a directory containing log files
Log File Format
The tool expects a JSONL (JSON Lines) log file where each relevant line contains the string LLMTRACE: followed by a JSON object. Only lines with LLMTRACE: are parsed.
Each JSON object should have the following structure:
{
"type": "chat.completion",
"messages": [
{ "role": "user", "content": "Hello, world!" },
{ "role": "assistant", "content": "Hi!" }
],
"response_format": "text",
"reasoning_effort": "low",
"temperature": 0.7,
"elapsed_time": 1.23,
"response": "Hi!",
"finish_reason": "stop",
"completion_tokens": 10,
"prompt_tokens": 8,
"reasoning_tokens": 2, // optional
"start_time": 1713268800.0 // optional (Unix timestamp)
}
Example log file:
2024-04-16T12:00:00Z INFO LLMTRACE: {"type": "chat.completion", "messages": [{"role": "user", "content": "Hello, world!"}], "response_format": "text", "reasoning_effort": "low", "temperature": 0.7, "elapsed_time": 1.23, "response": "Hi!", "finish_reason": "stop", "completion_tokens": 10, "prompt_tokens": 8}
2024-04-16T12:00:01Z INFO LLMTRACE: {"type": "chat.completion", "messages": [{"role": "user", "content": "How are you?"}], "response_format": "text", "reasoning_effort": "medium", "temperature": 0.7, "elapsed_time": 1.45, "response": "I'm an AI, so I don't have feelings, but thanks for asking!", "finish_reason": "stop", "completion_tokens": 15, "prompt_tokens": 10, "reasoning_tokens": 3, "start_time": 1713268801.0}
- Each line can have arbitrary text before
LLMTRACE: - The JSON object after
LLMTRACE:should contain the LLM call trace fields as shown above
Requirements
- Python 3.8+
- Node.js (for development)
Development
- Backend: FastAPI
- Frontend: Next.js (served as static files)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmtraceviewer-0.2.0.tar.gz.
File metadata
- Download URL: llmtraceviewer-0.2.0.tar.gz
- Upload date:
- Size: 254.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ed103a846165b4618bd7e668e075831d256af8a0bd293a3ee97f609052c1b46
|
|
| MD5 |
6e95e411a1e1e35b77ae1e46f45a9b5f
|
|
| BLAKE2b-256 |
d8f7377a4d904a6750b33a4be78104f96cb12dccf8178a37ea9ef3da4f4038fc
|
Provenance
The following attestation bundles were made for llmtraceviewer-0.2.0.tar.gz:
Publisher:
publish.yml on shonohs/llmtraceviewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtraceviewer-0.2.0.tar.gz -
Subject digest:
9ed103a846165b4618bd7e668e075831d256af8a0bd293a3ee97f609052c1b46 - Sigstore transparency entry: 198275132
- Sigstore integration time:
-
Permalink:
shonohs/llmtraceviewer@dfe35277bfb9a2c1b01b9c43ce2e6c45af8f1238 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shonohs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dfe35277bfb9a2c1b01b9c43ce2e6c45af8f1238 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llmtraceviewer-0.2.0-py3-none-any.whl.
File metadata
- Download URL: llmtraceviewer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 261.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00e7e8766b33ad2fa028478648c9ff9709e11d67d716bbd26bd5c11a3af8e7d1
|
|
| MD5 |
04bab3d250b8f19d3586a095323e6dad
|
|
| BLAKE2b-256 |
a79a6cdff7084f6e1d4d221b94aeef606a9f459dfda2cb60af973f25d30c00c6
|
Provenance
The following attestation bundles were made for llmtraceviewer-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on shonohs/llmtraceviewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtraceviewer-0.2.0-py3-none-any.whl -
Subject digest:
00e7e8766b33ad2fa028478648c9ff9709e11d67d716bbd26bd5c11a3af8e7d1 - Sigstore transparency entry: 198275134
- Sigstore integration time:
-
Permalink:
shonohs/llmtraceviewer@dfe35277bfb9a2c1b01b9c43ce2e6c45af8f1238 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shonohs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dfe35277bfb9a2c1b01b9c43ce2e6c45af8f1238 -
Trigger Event:
release
-
Statement type: