Skip to content

fix: use max_completion_tokens for OpenAI #101

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object Param {
case object model extends Param
case object prompt extends Param
case object suffix extends Param
@Deprecated
case object max_tokens extends Param
case object temperature extends Param
case object top_p extends Param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ trait ChatCompletionBodyMaker {
case _ => Some(settingsFinal.stop)
}
},
Param.max_tokens -> settingsFinal.max_tokens,
Param.max_completion_tokens -> settingsFinal.max_tokens,
Param.presence_penalty -> settingsFinal.presence_penalty,
Param.frequency_penalty -> settingsFinal.frequency_penalty,
Param.logit_bias -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ object ModelId {
val canary_tts = "canary-tts"
val canary_whisper = "canary-whisper"

val gpt_5 = "gpt-5"
val gpt_5_2025_08_07 = "gpt-5-2025-08-07"
val gpt_5_nano = "gpt-5-nano"
val gpt_5_mini = "gpt-5-mini"
val gpt_5_mini_2025_08_07 = "gpt-5-mini-2025-08-07"

val gpt_4o_mini_transcribe = "gpt-4o-mini-transcribe"
val gpt_4o_mini_audio_preview = "gpt-4o-mini-audio-preview"
val gpt_4o_mini_vision_preview = "gpt-4o-mini-vision-preview"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ object ChatCompletionSettingsConversions {
}

private val oBaseConversions = Seq(
// max tokens
FieldConversionDef(
_.max_tokens.isDefined,
settings =>
settings.copy(
max_tokens = None,
extra_params =
settings.extra_params + ("max_completion_tokens" -> settings.max_tokens.get)
),
Some("O models don't support max_tokens, converting to max_completion_tokens")
),
// temperature
FieldConversionDef(
settings => settings.temperature.isDefined && settings.temperature.get != 1,
Expand Down