Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: o3-mini doesn't support temperature #266

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions rig-core/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,18 +901,30 @@ impl completion::CompletionModel for CompletionModel {
json!({
"model": self.model,
"messages": full_history,
"temperature": completion_request.temperature,

})
} else {
json!({
"model": self.model,
"messages": full_history,
"temperature": completion_request.temperature,
"tools": completion_request.tools.into_iter().map(ToolDefinition::from).collect::<Vec<_>>(),
"tool_choice": "auto",
})
};

// only include temperature if it exists
// because some models don't support temperature
let request = if let Some(temperature) = completion_request.temperature {
json_utils::merge(
request,
json!({
"temperature": temperature,
}),
)
} else {
request
};

let response = self
.client
.post("/chat/completions")
Expand Down