Skip to content

Commit 6aca26d

Browse files
committed
New OpenAI models: gpt 4.1, gpt 4.1 mini, gpt 4.1 nano
1 parent 2b4dfce commit 6aca26d

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

openai-core/src/main/scala/io/cequence/openaiscala/domain/ModelId.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,20 @@ object ModelId {
199199
// 128k context, knowledge cutoff is Oct 2023
200200
val gpt_4_5_preview_2025_02_27 = "gpt-4.5-preview-2025-02-27"
201201

202+
// GPT 4.1
203+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
204+
val gpt_4_1 = "gpt-4.1"
205+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
206+
val gpt_4_1_2025_04_14 = "gpt-4.1-2025-04-14"
207+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
208+
val gpt_4_1_mini = "gpt-4.1-mini"
209+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
210+
val gpt_4_1_mini_2025_04_14 = "gpt-4.1-mini-2025-04-14"
211+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
212+
val gpt_4_1_nano = "gpt-4.1-nano"
213+
// 1,047,576 context window, 32,768 max output tokens, Jun 01, 2024 knowledge cutoff
214+
val gpt_4_1_nano_2025_04_14 = "gpt-4.1-nano-2025-04-14"
215+
202216
// GPT-4
203217
// web search
204218
val gpt_4o_search_preview = "gpt-4o-search-preview"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ object OpenAIChatCompletionExtra {
181181
}
182182

183183
private val defaultModelsSupportingJsonSchema = Seq(
184+
ModelId.gpt_4_1,
185+
ModelId.gpt_4_1_2025_04_14,
186+
ModelId.gpt_4_1_mini,
187+
ModelId.gpt_4_1_mini_2025_04_14,
188+
ModelId.gpt_4_1_nano,
189+
ModelId.gpt_4_1_nano_2025_04_14,
184190
ModelId.gpt_4_5_preview,
185191
ModelId.gpt_4_5_preview_2025_02_27,
186192
ModelId.gpt_4o,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait OpenAIServiceConsts {
1818
object DefaultSettings {
1919

2020
val CreateJsonCompletion = CreateCompletionSettings(
21-
model = ModelId.gpt_4o_2024_08_06,
21+
model = ModelId.gpt_4_1,
2222
temperature = Some(0.0),
2323
max_tokens = Some(4000)
2424
)
@@ -49,12 +49,12 @@ trait OpenAIServiceConsts {
4949
)
5050

5151
val CreateChatFunCompletion = CreateChatCompletionSettings(
52-
model = ModelId.gpt_4o_mini,
52+
model = ModelId.gpt_4_1,
5353
max_tokens = Some(4000)
5454
)
5555

5656
val CreateChatToolCompletion = CreateChatCompletionSettings(
57-
model = ModelId.gpt_4o_mini,
57+
model = ModelId.gpt_4_1,
5858
max_tokens = Some(4000)
5959
)
6060

openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletion.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object CreateChatCompletion extends Example {
1717
.createChatCompletion(
1818
messages = messages,
1919
settings = CreateChatCompletionSettings(
20-
model = ModelId.gpt_4_5_preview,
20+
model = ModelId.gpt_4_1,
2121
temperature = Some(0),
2222
max_tokens = Some(4000),
2323
service_tier = Some(ServiceTier.auto),
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import play.api.libs.json.{JsObject, Json}
1111

1212
import scala.concurrent.Future
1313

14-
object CreateChatCompletionJsonWithO3Mini
14+
object CreateChatCompletionJsonAdapter
1515
extends Example
1616
with TestFixtures
1717
with OpenAIServiceConsts {
@@ -26,7 +26,7 @@ object CreateChatCompletionJsonWithO3Mini
2626
.createChatCompletionWithJSON[JsObject](
2727
messages = messages,
2828
settings = CreateChatCompletionSettings(
29-
model = ModelId.o3_mini,
29+
model = ModelId.gpt_4_1,
3030
max_tokens = Some(5000),
3131
response_format_type = Some(ChatCompletionResponseFormatType.json_schema),
3232
jsonSchema = Some(capitalsSchemaDef1)

0 commit comments

Comments
 (0)