Skip to content

Commit 7945a9d

Browse files
committed
Fix Opus PR lens request parameters
1 parent 27a78cb commit 7945a9d

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

.github/scripts/evalops-pr-lens-review.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ def call_anthropic(prompt:, model:, api_key:)
322322
request.body = JSON.generate(
323323
model: model,
324324
max_tokens: 6000,
325-
temperature: 0,
326325
system: "You are a careful EvalOps PR reviewer. Return valid JSON only.",
327326
messages: [
328327
{

test/evalops_pr_lens_review_test.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ def test_comment_body_contains_only_ranked_findings
121121
assert_includes body, "`evalops-pr-lens/iam-blast-radius`"
122122
end
123123

124+
def test_anthropic_request_omits_temperature_for_opus_4_7
125+
request_body = nil
126+
fake_response = Struct.new(:body) do
127+
def is_a?(klass)
128+
klass == Net::HTTPSuccess || super
129+
end
130+
end.new(JSON.generate({ "content" => [{ "text" => "{\"findings\":[]}" }] }))
131+
fake_http = Object.new
132+
fake_http.define_singleton_method(:request) do |request|
133+
request_body = JSON.parse(request.body)
134+
fake_response
135+
end
136+
137+
http_start = ->(*_args, &block) { block.call(fake_http) }
138+
Net::HTTP.stub(:start, http_start) do
139+
EvalOpsPrLensReview.call_anthropic(
140+
prompt: "Return JSON",
141+
model: "claude-opus-4-7",
142+
api_key: "test-key"
143+
)
144+
end
145+
146+
assert_equal "claude-opus-4-7", request_body.fetch("model")
147+
refute_includes request_body.keys, "temperature"
148+
end
149+
124150
private
125151

126152
def finding(title, confidence, priority, path, line)

0 commit comments

Comments
 (0)