diff --git a/README.md b/README.md index 820a252..56024ea 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,12 @@ builder.Services.AddChatGpt(options => - _ResourceName_: the name of your Azure OpenAI Resource (required). - _ApiKey_: Azure OpenAI provides two methods for authentication. You can use either API Keys or Azure Active Directory (required). - _ApiVersion_: the version of the API to use (optional). Allowed values: - - 2022-12-01 - 2023-05-15 - 2023-06-01-preview + - 2023-10-01-preview - 2024-02-15-preview - - 2024-03-01-preview (default) + - 2024-03-01-preview + - 2024-04-01-preview (default) - 2024-02-01 - _AuthenticationType_: it specifies if the key is an actual API Key or an [Azure Active Directory token](https://learn.microsoft.com/azure/cognitive-services/openai/how-to/managed-identity) (optional, default: "ApiKey"). @@ -74,8 +75,8 @@ Currently available models are: - gpt-3.5-turbo-16k, - gpt-4, - gpt-4-32k -- gpt-4-turbo-preview -- gpt-4-vision-preview +- gpt-4-turbo +- gpt-4o They have fixed names, available in the [OpenAIChatGptModels.cs file](https://github.com/marcominerva/ChatGptNet/blob/master/src/ChatGptNet/Models/OpenAIChatGptModels.cs). @@ -510,7 +511,7 @@ var functionResponse = await GetWeatherAsync(functionCall.Arguments); await chatGptClient.AddToolResponseAsync(conversationId, functionCall, functionResponse); ``` -Newer models like _gpt-4-1106-preview_ support a more general approach to functions, the **Tool calling**. When you send a request, you can specify a list of tools the model may call. Currently, only functions are supported, but in future release other types of tools will be available. +Newer models like _gpt-4-turbo_ support a more general approach to functions, the **Tool calling**. When you send a request, you can specify a list of tools the model may call. Currently, only functions are supported, but in future release other types of tools will be available. To use Tool calling instead of direct Function calling, you need to set the _ToolChoice_ and _Tools_ properties in the **ChatGptToolParameters** object (instead of _FunctionCall_ and _Function_, as in previous example): diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels.md b/docs/ChatGptNet.Models/OpenAIChatGptModels.md index 7ac7eb0..9fb5731 100644 --- a/docs/ChatGptNet.Models/OpenAIChatGptModels.md +++ b/docs/ChatGptNet.Models/OpenAIChatGptModels.md @@ -13,9 +13,9 @@ public static class OpenAIChatGptModels | const [Gpt35_Turbo](OpenAIChatGptModels/Gpt35_Turbo.md) | GPT-3.5 model can understand and generate natural language or code and it is optimized for chat. | | const [Gpt35_Turbo_16k](OpenAIChatGptModels/Gpt35_Turbo_16k.md) | A model with the same capabilities as the standard [`Gpt35_Turbo`](./OpenAIChatGptModels/Gpt35_Turbo.md) model but with 4 times the token limit of [`Gpt35_Turbo`](./OpenAIChatGptModels/Gpt35_Turbo.md). | | const [Gpt4](OpenAIChatGptModels/Gpt4.md) | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy than any of our previous models, thanks to its broader general knowledge and advanced reasoning capabilities. is optimized for chat but works well for traditional completions tasks. | -| const [Gpt4Vision_Preview](OpenAIChatGptModels/Gpt4Vision_Preview.md) | Ability to understand images, in addition to all other GPT-4 Turbo capabilties. | | const [Gpt4_32k](OpenAIChatGptModels/Gpt4_32k.md) | A model with the same capabilities as the base [`Gpt4`](./OpenAIChatGptModels/Gpt4.md) model but with 4 times the token limit of [`Gpt4`](./OpenAIChatGptModels/Gpt4.md). | -| const [Gpt4_Turbo_Preview](OpenAIChatGptModels/Gpt4_Turbo_Preview.md) | The latest GPT-4 model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. | +| const [Gpt4_o](OpenAIChatGptModels/Gpt4_o.md) | The most advanced, multimodal flagship model that’s cheaper and faster than [`Gpt4_Turbo`](./OpenAIChatGptModels/Gpt4_Turbo.md). | +| const [Gpt4_Turbo](OpenAIChatGptModels/Gpt4_Turbo.md) | The latest GPT-4 model with vision capabilities and improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. | ## Remarks diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4.md index 217d2c5..a1d8bb6 100644 --- a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4.md +++ b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4.md @@ -8,7 +8,7 @@ public const string Gpt4; ## Remarks -This model supports 8.192 tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) for more information. +This model supports 8.192 tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4) for more information. ## See Also diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4Vision_Preview.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4Vision_Preview.md deleted file mode 100644 index 3cf708f..0000000 --- a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4Vision_Preview.md +++ /dev/null @@ -1,19 +0,0 @@ -# OpenAIChatGptModels.Gpt4Vision_Preview field - -Ability to understand images, in addition to all other GPT-4 Turbo capabilties. - -```csharp -public const string Gpt4Vision_Preview; -``` - -## Remarks - -This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. This preview model is not yet suited for production traffic. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) for more information. - -## See Also - -* field [Gpt4](./Gpt4.md) -* class [OpenAIChatGptModels](../OpenAIChatGptModels.md) -* namespace [ChatGptNet.Models](../../ChatGptNet.md) - - diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_32k.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_32k.md index 47cc3f4..76fc09a 100644 --- a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_32k.md +++ b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_32k.md @@ -8,7 +8,7 @@ public const string Gpt4_32k; ## Remarks -This model supports 32.768 tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) for more information. +This model supports 32.768 tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4) for more information. ## See Also diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo.md new file mode 100644 index 0000000..46c615c --- /dev/null +++ b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo.md @@ -0,0 +1,19 @@ +# OpenAIChatGptModels.Gpt4_Turbo field + +The latest GPT-4 model with vision capabilities and improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. + +```csharp +public const string Gpt4_Turbo; +``` + +## Remarks + +This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4) for more information. + +## See Also + +* field [Gpt4](./Gpt4.md) +* class [OpenAIChatGptModels](../OpenAIChatGptModels.md) +* namespace [ChatGptNet.Models](../../ChatGptNet.md) + + diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo_Preview.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo_Preview.md deleted file mode 100644 index 25b03a0..0000000 --- a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo_Preview.md +++ /dev/null @@ -1,19 +0,0 @@ -# OpenAIChatGptModels.Gpt4_Turbo_Preview field - -The latest GPT-4 model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. - -```csharp -public const string Gpt4_Turbo_Preview; -``` - -## Remarks - -This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. This preview model is not yet suited for production traffic. See [GPT-4](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) for more information. - -## See Also - -* field [Gpt4](./Gpt4.md) -* class [OpenAIChatGptModels](../OpenAIChatGptModels.md) -* namespace [ChatGptNet.Models](../../ChatGptNet.md) - - diff --git a/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_o.md b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_o.md new file mode 100644 index 0000000..82b0acb --- /dev/null +++ b/docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_o.md @@ -0,0 +1,19 @@ +# OpenAIChatGptModels.Gpt4_o field + +The most advanced, multimodal flagship model that’s cheaper and faster than [`Gpt4_Turbo`](./Gpt4_Turbo.md). + +```csharp +public const string Gpt4_o; +``` + +## Remarks + +This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. See [GPT-4](https://platform.openai.com/docs/models/gpt-4o) for more information. + +## See Also + +* field [Gpt4_Turbo](./Gpt4_Turbo.md) +* class [OpenAIChatGptModels](../OpenAIChatGptModels.md) +* namespace [ChatGptNet.Models](../../ChatGptNet.md) + + diff --git a/docs/ChatGptNet/ChatGptOptionsBuilderExtensions/UseAzure.md b/docs/ChatGptNet/ChatGptOptionsBuilderExtensions/UseAzure.md index 9b65583..aacd116 100644 --- a/docs/ChatGptNet/ChatGptOptionsBuilderExtensions/UseAzure.md +++ b/docs/ChatGptNet/ChatGptOptionsBuilderExtensions/UseAzure.md @@ -4,7 +4,7 @@ Configures Azure OpenAI Service settings. ```csharp public static ChatGptOptionsBuilder UseAzure(this ChatGptOptionsBuilder builder, - string resourceName, string apiKey, string apiVersion = "2024-03-01-preview", + string resourceName, string apiKey, string apiVersion = "2024-04-01-preview", AzureAuthenticationType authenticationType = AzureAuthenticationType.ApiKey) ``` diff --git a/samples/ChatGptApi/ChatGptApi.csproj b/samples/ChatGptApi/ChatGptApi.csproj index 0245b20..4eaec32 100644 --- a/samples/ChatGptApi/ChatGptApi.csproj +++ b/samples/ChatGptApi/ChatGptApi.csproj @@ -7,11 +7,11 @@ - - - - - + + + + + diff --git a/samples/ChatGptApi/appsettings.json b/samples/ChatGptApi/appsettings.json index fd813b4..3c0afcc 100644 --- a/samples/ChatGptApi/appsettings.json +++ b/samples/ChatGptApi/appsettings.json @@ -4,7 +4,7 @@ "ApiKey": "", // Required //"Organization": "", // Optional, used only by OpenAI "ResourceName": "", // Required when using Azure OpenAI Service - "ApiVersion": "2024-03-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-03-01-preview) + "ApiVersion": "2024-04-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-04-01-preview) "AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory "DefaultModel": "my-model", diff --git a/samples/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj b/samples/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj index 2d66213..611c80c 100644 --- a/samples/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj +++ b/samples/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/samples/ChatGptConsole/ChatGptConsole.csproj b/samples/ChatGptConsole/ChatGptConsole.csproj index 0dccab8..7f72f3f 100644 --- a/samples/ChatGptConsole/ChatGptConsole.csproj +++ b/samples/ChatGptConsole/ChatGptConsole.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/ChatGptConsole/appsettings.json b/samples/ChatGptConsole/appsettings.json index 9c1bf36..2fb4aad 100644 --- a/samples/ChatGptConsole/appsettings.json +++ b/samples/ChatGptConsole/appsettings.json @@ -4,7 +4,7 @@ "ApiKey": "", // Required //"Organization": "", // Optional, used only by OpenAI "ResourceName": "", // Required when using Azure OpenAI Service - "ApiVersion": "2024-03-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-03-01-preview) + "ApiVersion": "2024-04-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-04-01-preview) "AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory "DefaultModel": "my-model", diff --git a/samples/ChatGptFunctionCallingConsole/ChatGptFunctionCallingConsole.csproj b/samples/ChatGptFunctionCallingConsole/ChatGptFunctionCallingConsole.csproj index 6b2ab31..205ffd8 100644 --- a/samples/ChatGptFunctionCallingConsole/ChatGptFunctionCallingConsole.csproj +++ b/samples/ChatGptFunctionCallingConsole/ChatGptFunctionCallingConsole.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/ChatGptFunctionCallingConsole/appsettings.json b/samples/ChatGptFunctionCallingConsole/appsettings.json index 677cb24..37d9b84 100644 --- a/samples/ChatGptFunctionCallingConsole/appsettings.json +++ b/samples/ChatGptFunctionCallingConsole/appsettings.json @@ -4,7 +4,7 @@ "ApiKey": "", // Required //"Organization": "", // Optional, used only by OpenAI "ResourceName": "", // Required when using Azure OpenAI Service - "ApiVersion": "2024-03-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-03-01-preview) + "ApiVersion": "2024-04-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-04-01-preview) "AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory "DefaultModel": "my-model", diff --git a/samples/ChatGptStreamConsole/ChatGptStreamConsole.csproj b/samples/ChatGptStreamConsole/ChatGptStreamConsole.csproj index 042e760..66be1c8 100644 --- a/samples/ChatGptStreamConsole/ChatGptStreamConsole.csproj +++ b/samples/ChatGptStreamConsole/ChatGptStreamConsole.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/ChatGptStreamConsole/appsettings.json b/samples/ChatGptStreamConsole/appsettings.json index c9ed3d1..0ac1de6 100644 --- a/samples/ChatGptStreamConsole/appsettings.json +++ b/samples/ChatGptStreamConsole/appsettings.json @@ -4,7 +4,7 @@ "ApiKey": "", // Required //"Organization": "", // Optional, used only by OpenAI "ResourceName": "", // Required when using Azure OpenAI Service - "ApiVersion": "2024-03-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-03-01-preview) + "ApiVersion": "2024-04-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-04-01-preview) "AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory "DefaultModel": "my-model", diff --git a/src/ChatGptNet/Models/OpenAIChatGptModels.cs b/src/ChatGptNet/Models/OpenAIChatGptModels.cs index eaccce6..25cec6f 100644 --- a/src/ChatGptNet/Models/OpenAIChatGptModels.cs +++ b/src/ChatGptNet/Models/OpenAIChatGptModels.cs @@ -33,7 +33,7 @@ public static class OpenAIChatGptModels /// GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy than any of our previous models, thanks to its broader general knowledge and advanced reasoning capabilities. is optimized for chat but works well for traditional completions tasks. /// /// - /// This model supports 8.192 tokens. See GPT-4 for more information. + /// This model supports 8.192 tokens. See GPT-4 for more information. /// /// public const string Gpt4 = "gpt-4"; @@ -42,28 +42,28 @@ public static class OpenAIChatGptModels /// A model with the same capabilities as the base model but with 4 times the token limit of . /// /// - /// This model supports 32.768 tokens. See GPT-4 for more information. + /// This model supports 32.768 tokens. See GPT-4 for more information. /// /// public const string Gpt4_32k = "gpt-4-32k"; /// - /// The latest GPT-4 model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. + /// The latest GPT-4 model with vision capabilities and improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. /// /// - /// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. This preview model is not yet suited for production traffic. - /// See GPT-4 for more information. + /// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. + /// See GPT-4 for more information. /// /// - public const string Gpt4_Turbo_Preview = "gpt-4-turbo-preview"; + public const string Gpt4_Turbo = "gpt-4-turbo"; /// - /// Ability to understand images, in addition to all other GPT-4 Turbo capabilties. + /// The most advanced, multimodal flagship model that’s cheaper and faster than . /// /// - /// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. This preview model is not yet suited for production traffic. - /// See GPT-4 for more information. + /// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens. + /// See GPT-4 for more information. /// - /// - public const string Gpt4Vision_Preview = "gpt-4-vision-preview"; + /// + public const string Gpt4_o = "gpt-4o"; } \ No newline at end of file diff --git a/src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs b/src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs index 2ffa79a..4202003 100644 --- a/src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs +++ b/src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs @@ -10,7 +10,7 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration /// /// The default API version for Azure OpenAI service. /// - public const string DefaultApiVersion = "2024-03-01-preview"; + public const string DefaultApiVersion = "2024-04-01-preview"; /// /// Gets or sets the name of the Azure OpenAI Resource. @@ -18,16 +18,12 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration public string? ResourceName { get; set; } /// - /// Gets or sets the API version of the Azure OpenAI service (Default: 2024-03-01-preview). + /// Gets or sets the API version of the Azure OpenAI service (Default: 2024-04-01-preview). /// /// /// Currently supported versions are: /// /// - /// 2022-12-01 - /// Swagger spec - /// - /// /// 2023-05-15 /// Swagger spec /// @@ -35,6 +31,10 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration /// 2023-06-01-preview /// Swagger spec /// + /// + /// 2023-10-01-preview + /// Swagger spec + /// /// /// 2024-02-15-preview /// Swagger spec @@ -44,6 +44,10 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration /// Swagger spec /// /// + /// 2024-04-01-preview + /// Swagger spec + /// + /// /// 2023-02-01 /// Swagger spec ///