Skip to content

Commit c330d28

Browse files
authored
Update default API version to 2024-10-21 (#166)
2 parents cbcd4cb + c241d3e commit c330d28

File tree

8 files changed

+28
-11
lines changed

8 files changed

+28
-11
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ builder.Services.AddChatGpt(options =>
6464
- 2024-06-01
6565
- 2024-07-01-preview
6666
- 2024-08-01-preview
67-
- 2024-09-01-preview (default)
67+
- 2024-09-01-preview
68+
- 2024-10-01-preview
69+
- 2024-10-21 (default)
6870
- _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").
6971

7072
### DefaultModel and DefaultEmbeddingModel
@@ -148,7 +150,7 @@ The configuration can be automatically read from [IConfiguration](https://learn.
148150
"ApiKey": "", // Required
149151
//"Organization": "", // Optional, used only by OpenAI
150152
"ResourceName": "", // Required when using Azure OpenAI Service
151-
"ApiVersion": "2024-09-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-09-01-preview)
153+
"ApiVersion": "2024-10-21", // Optional, used only by Azure OpenAI Service (default: 2024-10-21)
152154
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
153155
154156
"DefaultModel": "my-model",

samples/ChatGptApi/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ApiKey": "", // Required
55
//"Organization": "", // Optional, used only by OpenAI
66
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2024-09-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-09-01-preview)
7+
"ApiVersion": "2024-10-21", // Optional, used only by Azure OpenAI Service (default: 2024-10-21)
88
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "my-model",

samples/ChatGptConsole/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ApiKey": "", // Required
55
//"Organization": "", // Optional, used only by OpenAI
66
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2024-09-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-09-01-preview)
7+
"ApiVersion": "2024-10-21", // Optional, used only by Azure OpenAI Service (default: 2024-10-21)
88
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "my-model",

samples/ChatGptFunctionCallingConsole/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ApiKey": "", // Required
55
//"Organization": "", // Optional, used only by OpenAI
66
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2024-09-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-09-01-preview)
7+
"ApiVersion": "2024-10-21", // Optional, used only by Azure OpenAI Service (default: 2024-10-21)
88
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "my-model",

samples/ChatGptStreamConsole/Application.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using ChatGptNet;
2-
using ChatGptNet.Extensions;
32

43
namespace ChatGptStreamConsole;
54

@@ -44,7 +43,7 @@ public async Task ExecuteAsync()
4443

4544
await foreach (var response in responseStream)
4645
{
47-
Console.Write(response.GetContent());
46+
Console.Write(response);
4847
await Task.Delay(80);
4948
}
5049

samples/ChatGptStreamConsole/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ApiKey": "", // Required
55
//"Organization": "", // Optional, used only by OpenAI
66
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2024-09-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-09-01-preview)
7+
"ApiVersion": "2024-10-21", // Optional, used only by Azure OpenAI Service (default: 2024-10-21)
88
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "my-model",

src/ChatGptNet/Models/ChatGptResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Diagnostics.CodeAnalysis;
22
using System.Text.Json.Serialization;
3+
using ChatGptNet.Extensions;
34
using ChatGptNet.Models.Common;
45
using ChatGptNet.Models.Converters;
56

@@ -59,4 +60,11 @@ public class ChatGptResponse : Response
5960
/// <seealso cref="ChatGptChoice"/>
6061
/// <seealso cref="ChatGptChoice.IsFiltered"/>
6162
public bool IsContentFiltered => Choices.FirstOrDefault()?.IsFiltered ?? false;
63+
64+
/// <summary>
65+
/// Gets the content of the response.
66+
/// </summary>
67+
/// <returns>The content of the response.</returns>
68+
public override string? ToString()
69+
=> this.GetContent();
6270
}

src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration
1010
/// <summary>
1111
/// The default API version for Azure OpenAI service.
1212
/// </summary>
13-
public const string DefaultApiVersion = "2024-09-01-preview";
13+
public const string DefaultApiVersion = "2024-10-21";
1414

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

2020
/// <summary>
21-
/// Gets or sets the API version of the Azure OpenAI service (Default: 2024-09-01-preview).
21+
/// Gets or sets the API version of the Azure OpenAI service (Default: 2024-10-21).
2222
/// </summary>
2323
/// <remarks>
2424
/// Currently supported versions are:
@@ -71,7 +71,15 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration
7171
/// <term>2024-09-01-preview</term>
7272
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-09-01-preview/inference.json">Swagger spec</see></description>
7373
/// </item>
74-
/// </list>
74+
/// <item>
75+
/// <term>2024-10-01-preview</term>
76+
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-10-01-preview/inference.json">Swagger spec</see></description>
77+
/// </item>
78+
/// <item>
79+
/// <term>2024-10-21</term>
80+
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-10-21/inference.json">Swagger spec</see></description>
81+
/// </item>
82+
/// </list>
7583
/// </remarks>
7684
public string ApiVersion { get; set; } = DefaultApiVersion;
7785

0 commit comments

Comments
 (0)