Skip to content

Commit

Permalink
Update models and documentation (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcominerva authored May 17, 2024
2 parents 2aeff50 + 38db2e6 commit 8e5afa6
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 84 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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").

Expand All @@ -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).

Expand Down Expand Up @@ -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):

Expand Down
4 changes: 2 additions & 2 deletions docs/ChatGptNet.Models/OpenAIChatGptModels.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 0 additions & 19 deletions docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4Vision_Preview.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_32k.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo.md
Original file line number Diff line number Diff line change
@@ -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)

<!-- DO NOT EDIT: generated by xmldocmd for ChatGptNet.dll -->
19 changes: 0 additions & 19 deletions docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_Turbo_Preview.md

This file was deleted.

19 changes: 19 additions & 0 deletions docs/ChatGptNet.Models/OpenAIChatGptModels/Gpt4_o.md
Original file line number Diff line number Diff line change
@@ -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)

<!-- DO NOT EDIT: generated by xmldocmd for ChatGptNet.dll -->
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down
10 changes: 5 additions & 5 deletions samples/ChatGptApi/ChatGptApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="Polly.Extensions" Version="8.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="TinyHelpers.AspNetCore" Version="3.0.6" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.5.0" />
<PackageReference Include="Polly.Extensions" Version="8.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.1" />
<PackageReference Include="TinyHelpers.AspNetCore" Version="3.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/ChatGptApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions samples/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

<ItemGroup>
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="Polly.Extensions" Version="8.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.5.0" />
<PackageReference Include="Polly.Extensions" Version="8.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/ChatGptConsole/ChatGptConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="Polly.Extensions" Version="8.3.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.5.0" />
<PackageReference Include="Polly.Extensions" Version="8.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/ChatGptConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="Polly.Extensions" Version="8.3.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.5.0" />
<PackageReference Include="Polly.Extensions" Version="8.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/ChatGptFunctionCallingConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions samples/ChatGptStreamConsole/ChatGptStreamConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="Polly.Extensions" Version="8.3.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.5.0" />
<PackageReference Include="Polly.Extensions" Version="8.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/ChatGptStreamConsole/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 11 additions & 11 deletions src/ChatGptNet/Models/OpenAIChatGptModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
/// <remarks>
/// This model supports 8.192 tokens. See <see href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">GPT-4</see> for more information.
/// This model supports 8.192 tokens. See <see href="https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4">GPT-4</see> for more information.
/// </remarks>
/// <seealso cref="Gpt4_32k"/>
public const string Gpt4 = "gpt-4";
Expand All @@ -42,28 +42,28 @@ public static class OpenAIChatGptModels
/// A model with the same capabilities as the base <see cref="Gpt4"/> model but with 4 times the token limit of <see cref="Gpt4"/>.
/// </summary>
/// <remarks>
/// This model supports 32.768 tokens. See <see href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">GPT-4</see> for more information.
/// This model supports 32.768 tokens. See <see href="https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4">GPT-4</see> for more information.
/// </remarks>
/// <seealso cref="Gpt4"/>
public const string Gpt4_32k = "gpt-4-32k";

/// <summary>
/// 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.
/// </summary>
/// <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 <see href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">GPT-4</see> for more information.
/// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens.
/// See <see href="https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4">GPT-4</see> for more information.
/// </remarks>
/// <seealso cref="Gpt4"/>
public const string Gpt4_Turbo_Preview = "gpt-4-turbo-preview";
public const string Gpt4_Turbo = "gpt-4-turbo";

/// <summary>
/// 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 <see cref="Gpt4_Turbo"/>.
/// </summary>
/// <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 <see href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">GPT-4</see> for more information.
/// This model supports 128.000 tokens and returns a maximum of 4.096 outpout tokens.
/// See <see href="https://platform.openai.com/docs/models/gpt-4o">GPT-4</see> for more information.
/// </remarks>
/// <seealso cref="Gpt4"/>
public const string Gpt4Vision_Preview = "gpt-4-vision-preview";
/// <seealso cref="Gpt4_Turbo"/>
public const string Gpt4_o = "gpt-4o";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration
/// <summary>
/// The default API version for Azure OpenAI service.
/// </summary>
public const string DefaultApiVersion = "2024-03-01-preview";
public const string DefaultApiVersion = "2024-04-01-preview";

/// <summary>
/// Gets or sets the name of the Azure OpenAI Resource.
/// </summary>
public string? ResourceName { get; set; }

/// <summary>
/// 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).
/// </summary>
/// <remarks>
/// Currently supported versions are:
/// <list type = "bullet">
/// <item>
/// <term>2022-12-01</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2022-12-01/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2023-05-15</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2023-05-15/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2023-06-01-preview</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-06-01-preview/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2023-10-01-preview</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-10-01-preview/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2024-02-15-preview</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-02-15-preview/inference.json">Swagger spec</see></description>
Expand All @@ -44,6 +44,10 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-03-01-preview/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2024-04-01-preview</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-04-01-preview/inference.json">Swagger spec</see></description>
/// </item>
/// <item>
/// <term>2023-02-01</term>
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-02-01/inference.json">Swagger spec</see></description>
/// </item>
Expand Down

0 comments on commit 8e5afa6

Please sign in to comment.