https://github.com/spirali/nicetrace
https://github.com/spirali/nicetrace
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/spirali/nicetrace
- Owner: spirali
- License: mit
- Created: 2024-06-19T15:54:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T21:18:36.000Z (over 1 year ago)
- Last Synced: 2024-11-01T20:12:16.437Z (over 1 year ago)
- Language: Python
- Size: 1.56 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NiceTrace
NiceTrace is a Python module for user-friendly structured tracing and elegant display of resulting traces.
Traces are stored as plain JSON files. NiceTrace support exploring traces of running processes.
While designed for generic usage, it's particularly well-suited for tracing experiments with Large Language Models (LLMs).
## Documentation
* [Documentation](https://spirali.github.io/nicetrace/latest/)
## Installation
```bash
# For tracing only
pip install nicetrace
# For tracing & displaying traces
pip install nicetrace[server]
```
## Getting started
Here's how to create a simple trace and write it to a JSON file:
```python
from nicetrace import trace, FileWriter
with FileWriter("traces/my_trace.json"):
with trace("Root node"):
with trace("Child node", inputs={"x": 10, "y": 20}) as node:
node.add_output("", "Hello world!")
```
To start a traceview server over the `traces` directory:
```commandline
python3 -m nicetrace.server traces
```
Then, open your web browser and navigate to http://localhost:4090 to view your traces.