Add support for OpenAI GPT-4.1 models (#28708)
Release Notes: - Add support for OpenAI GPT-4.1 via Copilot Chat and OpenAI API --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
parent
6db29eb90a
commit
84aa480344
4 changed files with 32 additions and 0 deletions
|
@ -33,6 +33,8 @@ pub enum Model {
|
||||||
Gpt4o,
|
Gpt4o,
|
||||||
#[serde(alias = "gpt-4", rename = "gpt-4")]
|
#[serde(alias = "gpt-4", rename = "gpt-4")]
|
||||||
Gpt4,
|
Gpt4,
|
||||||
|
#[serde(alias = "gpt-4.1", rename = "gpt-4.1")]
|
||||||
|
Gpt4_1,
|
||||||
#[serde(alias = "gpt-3.5-turbo", rename = "gpt-3.5-turbo")]
|
#[serde(alias = "gpt-3.5-turbo", rename = "gpt-3.5-turbo")]
|
||||||
Gpt3_5Turbo,
|
Gpt3_5Turbo,
|
||||||
#[serde(alias = "o1", rename = "o1")]
|
#[serde(alias = "o1", rename = "o1")]
|
||||||
|
@ -57,6 +59,7 @@ impl Model {
|
||||||
match self {
|
match self {
|
||||||
Self::Gpt4o
|
Self::Gpt4o
|
||||||
| Self::Gpt4
|
| Self::Gpt4
|
||||||
|
| Self::Gpt4_1
|
||||||
| Self::Gpt3_5Turbo
|
| Self::Gpt3_5Turbo
|
||||||
| Self::Claude3_5Sonnet
|
| Self::Claude3_5Sonnet
|
||||||
| Self::Claude3_7Sonnet
|
| Self::Claude3_7Sonnet
|
||||||
|
@ -69,6 +72,7 @@ impl Model {
|
||||||
match id {
|
match id {
|
||||||
"gpt-4o" => Ok(Self::Gpt4o),
|
"gpt-4o" => Ok(Self::Gpt4o),
|
||||||
"gpt-4" => Ok(Self::Gpt4),
|
"gpt-4" => Ok(Self::Gpt4),
|
||||||
|
"gpt-4.1" => Ok(Self::Gpt4_1),
|
||||||
"gpt-3.5-turbo" => Ok(Self::Gpt3_5Turbo),
|
"gpt-3.5-turbo" => Ok(Self::Gpt3_5Turbo),
|
||||||
"o1" => Ok(Self::O1),
|
"o1" => Ok(Self::O1),
|
||||||
"o3-mini" => Ok(Self::O3Mini),
|
"o3-mini" => Ok(Self::O3Mini),
|
||||||
|
@ -84,6 +88,7 @@ impl Model {
|
||||||
match self {
|
match self {
|
||||||
Self::Gpt3_5Turbo => "gpt-3.5-turbo",
|
Self::Gpt3_5Turbo => "gpt-3.5-turbo",
|
||||||
Self::Gpt4 => "gpt-4",
|
Self::Gpt4 => "gpt-4",
|
||||||
|
Self::Gpt4_1 => "gpt-4.1",
|
||||||
Self::Gpt4o => "gpt-4o",
|
Self::Gpt4o => "gpt-4o",
|
||||||
Self::O3Mini => "o3-mini",
|
Self::O3Mini => "o3-mini",
|
||||||
Self::O1 => "o1",
|
Self::O1 => "o1",
|
||||||
|
@ -98,6 +103,7 @@ impl Model {
|
||||||
match self {
|
match self {
|
||||||
Self::Gpt3_5Turbo => "GPT-3.5",
|
Self::Gpt3_5Turbo => "GPT-3.5",
|
||||||
Self::Gpt4 => "GPT-4",
|
Self::Gpt4 => "GPT-4",
|
||||||
|
Self::Gpt4_1 => "GPT-4.1",
|
||||||
Self::Gpt4o => "GPT-4o",
|
Self::Gpt4o => "GPT-4o",
|
||||||
Self::O3Mini => "o3-mini",
|
Self::O3Mini => "o3-mini",
|
||||||
Self::O1 => "o1",
|
Self::O1 => "o1",
|
||||||
|
@ -112,6 +118,7 @@ impl Model {
|
||||||
match self {
|
match self {
|
||||||
Self::Gpt4o => 64_000,
|
Self::Gpt4o => 64_000,
|
||||||
Self::Gpt4 => 32_768,
|
Self::Gpt4 => 32_768,
|
||||||
|
Self::Gpt4_1 => 1_047_576,
|
||||||
Self::Gpt3_5Turbo => 12_288,
|
Self::Gpt3_5Turbo => 12_288,
|
||||||
Self::O3Mini => 64_000,
|
Self::O3Mini => 64_000,
|
||||||
Self::O1 => 20_000,
|
Self::O1 => 20_000,
|
||||||
|
|
|
@ -83,6 +83,9 @@ impl CloudModel {
|
||||||
| open_ai::Model::FourTurbo
|
| open_ai::Model::FourTurbo
|
||||||
| open_ai::Model::FourOmni
|
| open_ai::Model::FourOmni
|
||||||
| open_ai::Model::FourOmniMini
|
| open_ai::Model::FourOmniMini
|
||||||
|
| open_ai::Model::FourPointOne
|
||||||
|
| open_ai::Model::FourPointOneMini
|
||||||
|
| open_ai::Model::FourPointOneNano
|
||||||
| open_ai::Model::O1Mini
|
| open_ai::Model::O1Mini
|
||||||
| open_ai::Model::O1Preview
|
| open_ai::Model::O1Preview
|
||||||
| open_ai::Model::O1
|
| open_ai::Model::O1
|
||||||
|
|
|
@ -215,6 +215,7 @@ impl LanguageModel for CopilotChatLanguageModel {
|
||||||
let model = match self.model {
|
let model = match self.model {
|
||||||
CopilotChatModel::Gpt4o => open_ai::Model::FourOmni,
|
CopilotChatModel::Gpt4o => open_ai::Model::FourOmni,
|
||||||
CopilotChatModel::Gpt4 => open_ai::Model::Four,
|
CopilotChatModel::Gpt4 => open_ai::Model::Four,
|
||||||
|
CopilotChatModel::Gpt4_1 => open_ai::Model::FourPointOne,
|
||||||
CopilotChatModel::Gpt3_5Turbo => open_ai::Model::ThreePointFiveTurbo,
|
CopilotChatModel::Gpt3_5Turbo => open_ai::Model::ThreePointFiveTurbo,
|
||||||
CopilotChatModel::O1 | CopilotChatModel::O3Mini => open_ai::Model::Four,
|
CopilotChatModel::O1 | CopilotChatModel::O3Mini => open_ai::Model::Four,
|
||||||
CopilotChatModel::Claude3_5Sonnet
|
CopilotChatModel::Claude3_5Sonnet
|
||||||
|
|
|
@ -71,6 +71,12 @@ pub enum Model {
|
||||||
FourOmni,
|
FourOmni,
|
||||||
#[serde(rename = "gpt-4o-mini", alias = "gpt-4o-mini")]
|
#[serde(rename = "gpt-4o-mini", alias = "gpt-4o-mini")]
|
||||||
FourOmniMini,
|
FourOmniMini,
|
||||||
|
#[serde(rename = "gpt-4.1", alias = "gpt-4.1")]
|
||||||
|
FourPointOne,
|
||||||
|
#[serde(rename = "gpt-4.1-mini", alias = "gpt-4.1-mini")]
|
||||||
|
FourPointOneMini,
|
||||||
|
#[serde(rename = "gpt-4.1-nano", alias = "gpt-4.1-nano")]
|
||||||
|
FourPointOneNano,
|
||||||
#[serde(rename = "o1", alias = "o1")]
|
#[serde(rename = "o1", alias = "o1")]
|
||||||
O1,
|
O1,
|
||||||
#[serde(rename = "o1-preview", alias = "o1-preview")]
|
#[serde(rename = "o1-preview", alias = "o1-preview")]
|
||||||
|
@ -99,6 +105,9 @@ impl Model {
|
||||||
"gpt-4-turbo-preview" => Ok(Self::FourTurbo),
|
"gpt-4-turbo-preview" => Ok(Self::FourTurbo),
|
||||||
"gpt-4o" => Ok(Self::FourOmni),
|
"gpt-4o" => Ok(Self::FourOmni),
|
||||||
"gpt-4o-mini" => Ok(Self::FourOmniMini),
|
"gpt-4o-mini" => Ok(Self::FourOmniMini),
|
||||||
|
"gpt-4.1" => Ok(Self::FourPointOne),
|
||||||
|
"gpt-4.1-mini" => Ok(Self::FourPointOneMini),
|
||||||
|
"gpt-4.1-nano" => Ok(Self::FourPointOneNano),
|
||||||
"o1" => Ok(Self::O1),
|
"o1" => Ok(Self::O1),
|
||||||
"o1-preview" => Ok(Self::O1Preview),
|
"o1-preview" => Ok(Self::O1Preview),
|
||||||
"o1-mini" => Ok(Self::O1Mini),
|
"o1-mini" => Ok(Self::O1Mini),
|
||||||
|
@ -114,6 +123,9 @@ impl Model {
|
||||||
Self::FourTurbo => "gpt-4-turbo",
|
Self::FourTurbo => "gpt-4-turbo",
|
||||||
Self::FourOmni => "gpt-4o",
|
Self::FourOmni => "gpt-4o",
|
||||||
Self::FourOmniMini => "gpt-4o-mini",
|
Self::FourOmniMini => "gpt-4o-mini",
|
||||||
|
Self::FourPointOne => "gpt-4.1",
|
||||||
|
Self::FourPointOneMini => "gpt-4.1-mini",
|
||||||
|
Self::FourPointOneNano => "gpt-4.1-nano",
|
||||||
Self::O1 => "o1",
|
Self::O1 => "o1",
|
||||||
Self::O1Preview => "o1-preview",
|
Self::O1Preview => "o1-preview",
|
||||||
Self::O1Mini => "o1-mini",
|
Self::O1Mini => "o1-mini",
|
||||||
|
@ -129,6 +141,9 @@ impl Model {
|
||||||
Self::FourTurbo => "gpt-4-turbo",
|
Self::FourTurbo => "gpt-4-turbo",
|
||||||
Self::FourOmni => "gpt-4o",
|
Self::FourOmni => "gpt-4o",
|
||||||
Self::FourOmniMini => "gpt-4o-mini",
|
Self::FourOmniMini => "gpt-4o-mini",
|
||||||
|
Self::FourPointOne => "gpt-4.1",
|
||||||
|
Self::FourPointOneMini => "gpt-4.1-mini",
|
||||||
|
Self::FourPointOneNano => "gpt-4.1-nano",
|
||||||
Self::O1 => "o1",
|
Self::O1 => "o1",
|
||||||
Self::O1Preview => "o1-preview",
|
Self::O1Preview => "o1-preview",
|
||||||
Self::O1Mini => "o1-mini",
|
Self::O1Mini => "o1-mini",
|
||||||
|
@ -146,6 +161,9 @@ impl Model {
|
||||||
Self::FourTurbo => 128_000,
|
Self::FourTurbo => 128_000,
|
||||||
Self::FourOmni => 128_000,
|
Self::FourOmni => 128_000,
|
||||||
Self::FourOmniMini => 128_000,
|
Self::FourOmniMini => 128_000,
|
||||||
|
Self::FourPointOne => 1_047_576,
|
||||||
|
Self::FourPointOneMini => 1_047_576,
|
||||||
|
Self::FourPointOneNano => 1_047_576,
|
||||||
Self::O1 => 200_000,
|
Self::O1 => 200_000,
|
||||||
Self::O1Preview => 128_000,
|
Self::O1Preview => 128_000,
|
||||||
Self::O1Mini => 128_000,
|
Self::O1Mini => 128_000,
|
||||||
|
@ -173,6 +191,9 @@ impl Model {
|
||||||
| Self::FourTurbo
|
| Self::FourTurbo
|
||||||
| Self::FourOmni
|
| Self::FourOmni
|
||||||
| Self::FourOmniMini
|
| Self::FourOmniMini
|
||||||
|
| Self::FourPointOne
|
||||||
|
| Self::FourPointOneMini
|
||||||
|
| Self::FourPointOneNano
|
||||||
| Self::O1
|
| Self::O1
|
||||||
| Self::O1Preview
|
| Self::O1Preview
|
||||||
| Self::O1Mini => true,
|
| Self::O1Mini => true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue