tracebook 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +10 -0
- data/CHANGELOG.md +43 -0
- data/MIT-LICENSE +20 -0
- data/README.md +881 -0
- data/Rakefile +21 -0
- data/app/assets/images/tracebook/.keep +0 -0
- data/app/assets/javascripts/tracebook/application.js +88 -0
- data/app/assets/stylesheets/tracebook/application.css +173 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/tracebook/application_controller.rb +4 -0
- data/app/controllers/tracebook/exports_controller.rb +25 -0
- data/app/controllers/tracebook/interactions_controller.rb +71 -0
- data/app/helpers/tracebook/application_helper.rb +4 -0
- data/app/helpers/tracebook/interactions_helper.rb +35 -0
- data/app/jobs/tracebook/application_job.rb +5 -0
- data/app/jobs/tracebook/daily_rollups_job.rb +100 -0
- data/app/jobs/tracebook/export_job.rb +162 -0
- data/app/jobs/tracebook/persist_interaction_job.rb +160 -0
- data/app/mailers/tracebook/application_mailer.rb +6 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/tracebook/application_record.rb +5 -0
- data/app/models/tracebook/interaction.rb +100 -0
- data/app/models/tracebook/pricing_rule.rb +84 -0
- data/app/models/tracebook/redaction_rule.rb +81 -0
- data/app/models/tracebook/rollup_daily.rb +73 -0
- data/app/views/layouts/tracebook/application.html.erb +18 -0
- data/app/views/tracebook/interactions/index.html.erb +105 -0
- data/app/views/tracebook/interactions/show.html.erb +44 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20241112000100_create_tracebook_interactions.rb +55 -0
- data/db/migrate/20241112000200_create_tracebook_rollups_dailies.rb +24 -0
- data/db/migrate/20241112000300_create_tracebook_pricing_rules.rb +21 -0
- data/db/migrate/20241112000400_create_tracebook_redaction_rules.rb +19 -0
- data/lib/tasks/tracebook_tasks.rake +4 -0
- data/lib/tasks/yard.rake +29 -0
- data/lib/tracebook/adapters/active_agent.rb +82 -0
- data/lib/tracebook/adapters/ruby_llm.rb +97 -0
- data/lib/tracebook/adapters.rb +6 -0
- data/lib/tracebook/config.rb +130 -0
- data/lib/tracebook/engine.rb +5 -0
- data/lib/tracebook/errors.rb +9 -0
- data/lib/tracebook/mappers/anthropic.rb +59 -0
- data/lib/tracebook/mappers/base.rb +38 -0
- data/lib/tracebook/mappers/ollama.rb +49 -0
- data/lib/tracebook/mappers/openai.rb +75 -0
- data/lib/tracebook/mappers.rb +283 -0
- data/lib/tracebook/normalized_interaction.rb +86 -0
- data/lib/tracebook/pricing/calculator.rb +39 -0
- data/lib/tracebook/pricing.rb +5 -0
- data/lib/tracebook/redaction_pipeline.rb +88 -0
- data/lib/tracebook/redactors/base.rb +29 -0
- data/lib/tracebook/redactors/card_pan.rb +15 -0
- data/lib/tracebook/redactors/email.rb +15 -0
- data/lib/tracebook/redactors/phone.rb +15 -0
- data/lib/tracebook/redactors.rb +8 -0
- data/lib/tracebook/result.rb +53 -0
- data/lib/tracebook/version.rb +3 -0
- data/lib/tracebook.rb +201 -0
- metadata +164 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 07dade3c360434e9cfa9df70dad0b102fc6787cd6c4c808096a4cdb6edb7fb61
|
|
4
|
+
data.tar.gz: 9aa38825ebdcfd85bf4c12e4eaacbbbf4fcef5d3ed507a00cc03e12a74a0f5ed
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eeab9cefcc540469b78420a3f582241ebb18e173e9c72d9c86e81ca99914389543e8ee515a2ce9aa055a5c46a44cd042b3b7e6f9838e2a05914b8b873126d23c
|
|
7
|
+
data.tar.gz: 79365c2393c7db94686073301913b75313ceaa253c36f2a441934ada60f0d3dca522cf481b22c74f41a7ddd35e4e1e1d6c7735778354685826ab283bf1d18ef2
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2025-11-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Core Engine**: Rails 8.1+ mountable engine with isolated namespace
|
|
15
|
+
- **Provider Support**: Mappers for OpenAI, Anthropic, and Ollama APIs
|
|
16
|
+
- **Adapters**: Integration adapters for ActiveAgent and RubyLLM libraries
|
|
17
|
+
- **Recording API**: `TraceBook.record!` for capturing LLM interactions
|
|
18
|
+
- **Configuration**: Flexible `TraceBook.config` with authorization hooks
|
|
19
|
+
- **Models**:
|
|
20
|
+
- `Interaction` - Core model for storing LLM call data
|
|
21
|
+
- `PricingRule` - Cost calculation rules per model
|
|
22
|
+
- `RedactionRule` - Custom PII pattern definitions
|
|
23
|
+
- `RollupDaily` - Aggregated daily metrics
|
|
24
|
+
- **PII Redaction**: Pre-persist redaction pipeline with built-in redactors:
|
|
25
|
+
- Email addresses
|
|
26
|
+
- Phone numbers
|
|
27
|
+
- Credit card PANs
|
|
28
|
+
- **Cost Tracking**: Pricing calculator with configurable rules per provider/model
|
|
29
|
+
- **Background Jobs**:
|
|
30
|
+
- `PersistInteractionJob` - Async ingestion pipeline
|
|
31
|
+
- `DailyRollupsJob` - Nightly metric aggregation
|
|
32
|
+
- `ExportJob` - Async data export
|
|
33
|
+
- **Web UI**: Turbo + Stimulus dashboard with:
|
|
34
|
+
- Interaction list with filtering (provider, model, date range, review state)
|
|
35
|
+
- Detail view with formatted request/response payloads
|
|
36
|
+
- Review workflow (pending → approved/flagged/rejected)
|
|
37
|
+
- KPI display (token counts, costs, latency)
|
|
38
|
+
- **Export**: CSV and NDJSON export capabilities
|
|
39
|
+
- **Normalized Schema**: Consistent data structure across all providers
|
|
40
|
+
- **Test Suite**: Full MiniTest coverage for models, controllers, jobs, and lib
|
|
41
|
+
|
|
42
|
+
[Unreleased]: https://github.com/dpaluy/tracebook/compare/v0.1.0...HEAD
|
|
43
|
+
[0.1.0]: https://github.com/dpaluy/tracebook/releases/tag/v0.1.0
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright TODO: Write your name
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|