boxcars 0.7.5 → 0.7.6

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: fba0b8f234c11e72583e1058f76d4d29116dd76d34e59cb6337f242a16ce1b90
4
- data.tar.gz: e3b2a7f524934c3ba6271eb5530012659c2fa9e03326b23f2105c4cc15fc8966
3
+ metadata.gz: 998fff351b071b938cb5ba4cb0427b7448ffbb46e71b5272761bac45625dca3a
4
+ data.tar.gz: c6c945e4cabc226f4eb37e1368b77276a18023a26e1e05a5d60bb02742b3ed05
5
5
  SHA512:
6
- metadata.gz: 4f0a6d64dbcfb79dadefd3ffad4ac318617d985fee5f57eb40338338edfeb3e4815266665884dd00544d95e215ef20f8d431113933532a75f9f9be6104c216e5
7
- data.tar.gz: 9a123e55156fabf642dd69c0eec7d544d54b9cd80d0a1dd661189cafe406560aa115195b376db0654fb873a71c7f397ceb6572907786c34cbeb546ad31d26447
6
+ metadata.gz: 4e4fad15d9c08ff76efec828697b387241534114f4594605ce5f257ce9de4d354f77aa5481f36961158b97399dba8d7913732b7644984eb864994103bab38839
7
+ data.tar.gz: 329d630f296a6e193633efe238e04aeb8ad54ebd4f378ee71467caa373786289529d40c9e0d1337dfb7b0b7acc7c94dc9cbe9cd9a8c3b1178bed7680d1d0aeb7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxcars (0.7.5)
4
+ boxcars (0.7.6)
5
5
  google_search_results (~> 2.2)
6
6
  gpt4all (~> 0.0.5)
7
7
  hnswlib (~> 0.9)
@@ -66,10 +66,7 @@ module Boxcars
66
66
  params.delete(:response_format)
67
67
  params.delete(:stop)
68
68
  end
69
- params = prompt.as_messages(inputs).merge(params)
70
- if Boxcars.configuration.log_prompts
71
- Boxcars.debug(params[:messages].last(2).map { |p| ">>>>>> Role: #{p[:role]} <<<<<<\n#{p[:content]}" }.join("\n"), :cyan)
72
- end
69
+ params = get_params(prompt, inputs, params)
73
70
  clnt.chat(parameters: params)
74
71
  else
75
72
  params = prompt.as_prompt(inputs: inputs).merge(params)
@@ -151,4 +148,14 @@ module Boxcars
151
148
  max_size = modelname_to_contextsize(model_name)
152
149
  max_size - num_tokens
153
150
  end
151
+
152
+ def get_params(prompt, inputs, params)
153
+ params = prompt.as_messages(inputs).merge(params)
154
+ # Handle models like o1-mini that don't support the system role
155
+ params[:messages].first[:role] = :user if params[:model] =~ /^o/ && params[:messages].first&.fetch(:role) == :system
156
+ if Boxcars.configuration.log_prompts
157
+ Boxcars.debug(params[:messages].last(2).map { |p| ">>>>>> Role: #{p[:role]} <<<<<<\n#{p[:content]}" }.join("\n"), :cyan)
158
+ end
159
+ params
160
+ end
154
161
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Boxcars
4
4
  # The current version of the gem.
5
- VERSION = "0.7.5"
5
+ VERSION = "0.7.6"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxcars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Sullivan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-04-21 00:00:00.000000000 Z
12
+ date: 2025-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google_search_results