Skip to content

Commit d964a0b

Browse files
committed
Response type handling for O1 models
1 parent 210406a commit d964a0b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

openai-core/src/main/scala/io/cequence/openaiscala/service/adapter/ChatCompletionSettingsConversions.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package io.cequence.openaiscala.service.adapter
22

3-
import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings
3+
import io.cequence.openaiscala.domain.response.ResponseFormat
4+
import io.cequence.openaiscala.domain.settings.{
5+
ChatCompletionResponseFormatType,
6+
CreateChatCompletionSettings
7+
}
48
import org.slf4j.LoggerFactory
59

610
object ChatCompletionSettingsConversions {
@@ -76,6 +80,16 @@ object ChatCompletionSettingsConversions {
7680
"O1 models don't support frequency penalty values other than the default of 0, converting to 0."
7781
),
7882
warning = true
83+
),
84+
// frequency_penalty
85+
FieldConversionDef(
86+
settings =>
87+
settings.response_format_type.isDefined && settings.response_format_type.get != ChatCompletionResponseFormatType.text,
88+
_.copy(response_format_type = None),
89+
Some(
90+
"O1 models don't support json object/schema response format, converting to None."
91+
),
92+
warning = true
7993
)
8094
)
8195

0 commit comments

Comments
 (0)