Class: AISpec::Core::Reporters::JSONReporter
- Defined in:
- lib/aispec/core/reporters/json.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from AISpec::Core::Reporters::Base
Instance Method Details
#render ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/aispec/core/reporters/json.rb', line 9 def render contract = results[:contract] stats = results[:statistics] data = { contract: contract.name, provider: results[:provider_name], model: results[:model], summary: stats.summary, runs: results[:runs].map do |run| { input: run[:input], output: run[:output], latency_ms: run[:latency_ms], cost: run[:cost], tokens: run[:tokens], passed: run[:passed], assertions: run[:assertion_results].map do |ar| { name: ar.name, passed: ar.passed?, message: ar., metadata: ar. } end } end } formatted = JSON.pretty_generate(data) output_io.puts formatted formatted end |