Skip to content

Commit 3f98331

Browse files
committed
Fix domain map temperature to 1 for o1 models
1 parent 2e96217 commit 3f98331

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.0.14] - 2025-07-05
2+
3+
- o1 models don't support temperature so force it to 1
4+
15
## [0.0.13] - 2025-06-27
26

37
- Add GenerateChatCompletion command

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
foobara-ai (0.0.13)
4+
foobara-ai (0.0.14)
55

66
GEM
77
remote: https://rubygems.org/
@@ -55,7 +55,7 @@ GEM
5555
foobara-type-generator (~> 0.0.1)
5656
foobara-typescript-react-command-form-generator (~> 0.0.1)
5757
foobara-typescript-remote-command-generator (~> 0.0.1)
58-
foobara (0.0.134)
58+
foobara (0.0.135)
5959
bigdecimal
6060
foobara-lru-cache (~> 0.0.2)
6161
foobara-util (>= 1.0.0)
@@ -194,7 +194,7 @@ GEM
194194
rb-fsevent (0.11.2)
195195
rb-inotify (0.11.1)
196196
ffi (~> 1.0)
197-
rdoc (6.14.1)
197+
rdoc (6.14.2)
198198
erb
199199
psych (>= 4.0.0)
200200
regexp_parser (2.10.0)

spec/foobara/answer_bot/generate_next_message_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
context "when using anthropic" do
5151
let(:model) { "claude-3-5-sonnet-20241022" }
5252

53-
it "is successful", vcr: { record: :once } do
53+
it "is successful", vcr: { record: :none } do
5454
expect(outcome).to be_success
5555
expect(result.content).to match(/vinegar/i)
5656
end

src/foobara/ai/answer_bot/domain_mappers/open_ai_api/chat_to_generate_chat_completion.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def map
2121
}
2222

2323
if temperature
24-
inputs[:temperature] = temperature
24+
# NOTE: some models don't support temperature, like o1. Instead of possibly receiving an error
25+
# we will set the temperature to 1 which prevents a 400. Maybe print a warning instead?
26+
inputs[:temperature] = model_supports_temperature? ? temperature : 1
2527
end
2628

2729
if model
@@ -42,6 +44,10 @@ def temperature
4244
def model
4345
from[:model]
4446
end
47+
48+
def model_supports_temperature?
49+
model && model.to_s !~ /\Ao1(-|$)/
50+
end
4551
end
4652
end
4753
end

version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Foobara
22
module Ai
3-
VERSION = "0.0.13".freeze
3+
VERSION = "0.0.14".freeze
44
MINIMUM_RUBY_VERSION = ">= 3.4.0".freeze
55
end
66
end

0 commit comments

Comments
 (0)