diff --git a/src/Directory.Build.props b/src/Directory.Build.props index dd9f6fd..b900ed4 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,6 @@ - 2.9.1 + 2.9.2 enable enable 12 diff --git a/src/OpenAI.ChatGpt/Models/ChatCompletion/ChatCompletionModels.cs b/src/OpenAI.ChatGpt/Models/ChatCompletion/ChatCompletionModels.cs index 820a701..6c0feb6 100644 --- a/src/OpenAI.ChatGpt/Models/ChatCompletion/ChatCompletionModels.cs +++ b/src/OpenAI.ChatGpt/Models/ChatCompletion/ChatCompletionModels.cs @@ -19,7 +19,12 @@ public static class ChatCompletionModels public const string Default = Gpt3_5_Turbo; /// - /// IMPORTANT: This model is available only by request. Link for joining waitlist: https://openai.com/waitlist/gpt-4-api + /// Preview of the newest GPT-4 Turbo model. + /// + public const string Gpt4Turbo = "gpt-4-1106-preview"; + + /// + /// IMPORTANT: This model is available only by special coditions. https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4 /// More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat. /// Will be updated with OpenAI's latest model iteration 2 weeks after it is released. /// This model has a maximum token limit of 8,192. @@ -64,6 +69,8 @@ public static class ChatCompletionModels /// The model was trained with data up to September 2021. /// public const string Gpt3_5_Turbo = "gpt-3.5-turbo"; + + public const string Gpt3_5_Turbo_1106 = "gpt-3.5-turbo-1106"; /// /// Same capabilities as the standard gpt-3.5-turbo model but with 4 times the context. @@ -119,11 +126,13 @@ public static class ChatCompletionModels /// private static readonly Dictionary MaxTokensLimits = new() { + { Gpt4Turbo, 4096 }, { Gpt4, 8192 }, { Gpt4_0613, 8192 }, { Gpt4_32k, 32_768 }, { Gpt4_32k_0613, 32_768 }, { Gpt3_5_Turbo, 4096 }, + { Gpt3_5_Turbo_1106, 16385 }, { Gpt3_5_Turbo_16k, 16_384 }, { Gpt3_5_Turbo_0613, 4096 }, { Gpt3_5_Turbo_16k_0613, 16_384 }, diff --git a/tests/OpenAI.ChatGpt.IntegrationTests/OpenAiClientTests/OpenAiClient_GetStructuredResponse.cs b/tests/OpenAI.ChatGpt.IntegrationTests/OpenAiClientTests/OpenAiClient_GetStructuredResponse.cs index 86cb4bc..98ffd14 100644 --- a/tests/OpenAI.ChatGpt.IntegrationTests/OpenAiClientTests/OpenAiClient_GetStructuredResponse.cs +++ b/tests/OpenAI.ChatGpt.IntegrationTests/OpenAiClientTests/OpenAiClient_GetStructuredResponse.cs @@ -12,7 +12,7 @@ public async void Get_simple_structured_response_from_ChatGPT() var message = Dialog.StartAsSystem("What did user input?") .ThenUser("My name is John, my age is 30, my email is john@gmail.com"); - var response = await _client.GetStructuredResponse(message); + var response = await _client.GetStructuredResponse(message, model: ChatCompletionModels.Gpt4Turbo); response.Should().NotBeNull(); response.Name.Should().Be("John"); response.Age.Should().Be(30); @@ -26,7 +26,7 @@ public async void Get_structured_response_with_ARRAY_from_ChatGPT() .StartAsSystem("What did user input?") .ThenUser("My name is John, my age is 30, my email is john@gmail.com. " + "I want to buy 2 apple and 3 orange."); - var response = await _client.GetStructuredResponse(message); + var response = await _client.GetStructuredResponse(message, model: ChatCompletionModels.Gpt4Turbo); response.Should().NotBeNull(); response.UserInfo.Should().NotBeNull(); response.UserInfo!.Name.Should().Be("John"); @@ -46,7 +46,7 @@ public async void Get_structured_response_with_ENUM_from_ChatGPT() var message = Dialog .StartAsSystem("What did user input?") .ThenUser("Мой любимый цвет - красный"); - var response = await _client.GetStructuredResponse(message); + var response = await _client.GetStructuredResponse(message, model: ChatCompletionModels.Gpt4Turbo); response.Should().NotBeNull(); response.Color.Should().Be(Thing.Colors.Red); } @@ -57,7 +57,7 @@ public async void Get_structured_response_with_extra_data_from_ChatGPT() var message = Dialog .StartAsSystem("Return requested data.") .ThenUser("I need info about Almaty city"); - var response = await _client.GetStructuredResponse(message); + var response = await _client.GetStructuredResponse(message, model: ChatCompletionModels.Gpt4Turbo); response.Should().NotBeNull(); response.Name.Should().Be("Almaty"); response.Country.Should().Be("Kazakhstan");