ruby_llm 1.13.0 → 1.13.1

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: efa046d43a24a45287ca68b9ec54c12374dd7a716a41bda2226974925067f547
4
- data.tar.gz: e7d5187b9cb8d543e8b3b6b2590569cdcedec745f7ff35b6944d68768f803a6c
3
+ metadata.gz: e037afc338572ce65ca4ff1d7db24005a13d07852421bbdcc33a0a75eab9dcca
4
+ data.tar.gz: 7d7faf8f14d05a8b9fb384d7a3d88379a6def691a0c420eeccfac2df91ff0257
5
5
  SHA512:
6
- metadata.gz: 61a499df157a4276b21aaaebab88518ad8a57a497dc032307bce6a02522ae45eccad01e7989ae1dfafb7149502eb5878d1604cba99ab3f4e2c0a34ef33e43c56
7
- data.tar.gz: e2a03066ca8fdc265316bff01a9afed4c16a8e9bb32d7ed7f05bb594a00b3897c621039800b7fa8a75eb729b4511af133e240fdd054065d9aa82617899664595
6
+ metadata.gz: 4dc5e45a77b4158568a6992e18b5f73cf01a59b51a5aea1cde3117f2714dc72f08ba84aee4f75584c021101ce0b13622dfb364a138279c2cd21e7e836ac5e98d
7
+ data.tar.gz: 3b31148c54a256e11796c4b7a07f77f887637d651b43a6930e8e5f03ca760c3001c714e06b153fe0a8edab83934afb0577e3c8da0f260a77fc15fb30244e538f
@@ -134,7 +134,7 @@ module RubyLLM
134
134
  end
135
135
 
136
136
  def load_content_from_path
137
- @content = File.read(@source)
137
+ @content = File.binread(@source)
138
138
  end
139
139
 
140
140
  def load_content_from_io
data/lib/ruby_llm/chat.rb CHANGED
@@ -152,7 +152,7 @@ module RubyLLM
152
152
 
153
153
  @on[:new_message]&.call unless block_given?
154
154
 
155
- if @schema && response.content.is_a?(String)
155
+ if @schema && response.content.is_a?(String) && !response.tool_call?
156
156
  begin
157
157
  response.content = JSON.parse(response.content)
158
158
  rescue JSON::ParserError
@@ -120,6 +120,7 @@ module RubyLLM
120
120
  tool_calls: tool_calls,
121
121
  input_tokens: data.dig('usageMetadata', 'promptTokenCount'),
122
122
  output_tokens: calculate_output_tokens(data),
123
+ cached_tokens: data.dig('usageMetadata', 'cachedContentTokenCount'),
123
124
  thinking_tokens: data.dig('usageMetadata', 'thoughtsTokenCount'),
124
125
  model_id: data['modelVersion'] || response.env.url.path.split('/')[3].split(':')[0],
125
126
  raw: response
@@ -22,6 +22,7 @@ module RubyLLM
22
22
  ),
23
23
  input_tokens: extract_input_tokens(data),
24
24
  output_tokens: extract_output_tokens(data),
25
+ cached_tokens: data.dig('usageMetadata', 'cachedContentTokenCount'),
25
26
  thinking_tokens: data.dig('usageMetadata', 'thoughtsTokenCount'),
26
27
  tool_calls: extract_tool_calls(data)
27
28
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLLM
4
- VERSION = '1.13.0'
4
+ VERSION = '1.13.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino