Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmtraceviewer-0.2.0.tar.gz (254.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmtraceviewer-0.2.0-py3-none-any.whl (261.4 kB view details)

Uploaded Python 3

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

Hashes for llmtraceviewer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9ed103a846165b4618bd7e668e075831d256af8a0bd293a3ee97f609052c1b46
MD5 6e95e411a1e1e35b77ae1e46f45a9b5f
BLAKE2b-256 d8f7377a4d904a6750b33a4be78104f96cb12dccf8178a37ea9ef3da4f4038fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmtraceviewer-0.2.0.tar.gz:

Publisher: publish.yml on shonohs/llmtraceviewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for llmtraceviewer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00e7e8766b33ad2fa028478648c9ff9709e11d67d716bbd26bd5c11a3af8e7d1
MD5 04bab3d250b8f19d3586a095323e6dad
BLAKE2b-256 a79a6cdff7084f6e1d4d221b94aeef606a9f459dfda2cb60af973f25d30c00c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmtraceviewer-0.2.0-py3-none-any.whl:

Publisher: publish.yml on shonohs/llmtraceviewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page