ruby_llm-monitoring 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e52e6dea68700fd216eccecf56e4719846c9040a68096b8da36da5a0099fa0cc
4
- data.tar.gz: eec1e3ab7de906a30776d42d189484c71fce51c29cae46e2ef1700a24f345f92
3
+ metadata.gz: b9205c2eb30d3dd82db0fa7df08407bc3f4d90f254d8b8dd8e11167b2af6f322
4
+ data.tar.gz: 9e71952817c4d060dd71806cb09f3c75b6db766aa64c2e2f62457e4811c8ea45
5
5
  SHA512:
6
- metadata.gz: 8ebe9da90c03d03a0f0c841adcc9c5f1169e70f94944e45adde7d728c2a6b4895c69fa58cdee9fb48271d017fc8f9539e3cf247439cd83f8da6220072f9defaf
7
- data.tar.gz: 7e44d71fbdeea4827557596c55e32728d6c8a8079c5eba6aa59ceba2f3353dbb519f86bb948bcce4164b00c44fea69b64802ba0848f5feadd3deaba20aa60fff
6
+ metadata.gz: 90dca447aa7dfef057dc7fb8abc8f7bdcc737513785e105fa1f07bf56a8ca0f86ec232005aa3ddff0c1bcedd805b417f9a28934e0996c077f562861943429f47
7
+ data.tar.gz: c9b8f50e46a30abba58fe29f5d4b608b4a9470e6c8976219b7047c1bd094a620867b45296d4a2567082fdbd655d3b5212444b282e00eaa0e3ddce4bd0fe905aa
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.2] - 2026-04-07
9
+
10
+ ### Fixed
11
+
12
+ - Fix `#set_cost` crash when using `RubyLLM.context`. [#66](https://github.com/sinaptia/ruby_llm-monitoring/pull/66) [@bborn](https://github.com/bborn)
13
+
8
14
  ## [0.3.1] - 2026-03-07
9
15
 
10
16
  ### Added
@@ -9,14 +9,15 @@ module RubyLLM::Monitoring
9
9
  def set_cost
10
10
  return self.cost = 0.0 if [ payload["input_tokens"], payload["output_tokens"] ].all?(nil)
11
11
 
12
- model, provider = RubyLLM.models.resolve payload["model"], provider: payload["provider"]
13
- return self.cost = 0.0 if provider.nil? || provider.local?
12
+ model = RubyLLM::Models.find(payload["model"], payload["provider"])
14
13
 
15
14
  input_cost = payload["input_tokens"].to_f / 1_000_000.0 * model.input_price_per_million.to_f
16
15
  output_cost = payload["output_tokens"].to_f / 1_000_000.0 * model.output_price_per_million.to_f
17
16
  thinking_cost = payload["thinking_tokens"].to_f / 1_000_000.0 * model.output_price_per_million.to_f
18
17
 
19
18
  self.cost = input_cost + output_cost + thinking_cost
19
+ rescue RubyLLM::ModelNotFoundError
20
+ self.cost = 0.0
20
21
  end
21
22
  end
22
23
  end
@@ -1,5 +1,5 @@
1
1
  module RubyLLM
2
2
  module Monitoring
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-monitoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patricio Mac Adden