Skip to content

Commit a9ccf8c

Browse files
authored
Update documentation for function calling on Azure OpenAI Service (#89)
2 parents 3fdded7 + 46a77e1 commit a9ccf8c

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Register ChatGPT service at application startup:
4646
- _ApiVersion_: the version of the API to use (optional). Allowed values:
4747
- 2023-03-15-preview
4848
- 2023-05-15
49-
- 2023-06-01-preview (default).
49+
- 2023-06-01-preview
50+
- 2023-07-01-preview (default)
5051
- _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").
5152

5253
### DefaultModel
@@ -116,7 +117,7 @@ The configuration can be automatically read from [IConfiguration](https://learn.
116117
"ApiKey": "", // Required
117118
//"Organization": "", // Optional, used only by OpenAI
118119
"ResourceName": "", // Required when using Azure OpenAI Service
119-
"ApiVersion": "2023-06-01-preview", // Optional, used only by Azure OpenAI Service. Allowed values: 2023-03-15-preview, 2023-05-15 or 2023-06-01-preview (default)
120+
"ApiVersion": "2023-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2023-07-01-preview)
120121
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
121122

122123
"DefaultModel": "my-model",
@@ -267,7 +268,14 @@ The _preserveSetup_ argument allows to decide whether mantain also the _system_
267268

268269
With function calling, we can describe functions and have the model intelligently choose to output a JSON object containing arguments to call those functions. This is a new way to more reliably connect GPT's capabilities with external tools and APIs.
269270

270-
**ChatGptNet** fully supports function calling by providing an overload of the **AskAsync** method that allows to specify function specifications. If this parameter is supplied, then the model will decide when it is appropiate to use one the functions. For example:
271+
> **Note**
272+
Currently, on Azure OpenAI Service, function calling is supported in the following models in API version `2023-07-01-preview`:
273+
>- gpt-35-turbo-0613
274+
>- gpt-35-turbo-16k-0613
275+
>- gpt-4-0613
276+
>- gpt-4-32k-0613
277+
278+
**ChatGptNet** fully supports function calling by providing an overload of the **AskAsync** method that allows to specify function definitions. If this parameter is supplied, then the model will decide when it is appropiate to use one the functions. For example:
271279

272280
var functions = new List<ChatGptFunction>
273281
{

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": "2023-06-01-preview", // Optional, used only by Azure OpenAI Service. Allowed values: 2023-03-15-preview, 2023-05-15 or 2023-06-01-preview (default)
7+
"ApiVersion": "2023-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2023-07-01-preview)
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": "2023-06-01-preview", // Optional, used only by Azure OpenAI Service. Allowed values: 2023-03-15-preview, 2023-05-15 or 2023-06-01-preview (default)
7+
"ApiVersion": "2023-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2023-07-01-preview)
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"ApiKey": "", // Required
55
//"Organization": "", // Optional, used only by OpenAI
66
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2023-06-01-preview", // Optional, used only by Azure OpenAI Service. Allowed values: 2023-03-15-preview, 2023-05-15 or 2023-06-01-preview (default)
8-
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values : ApiKey (default) or ActiveDirectory
7+
"ApiVersion": "2023-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2023-07-01-preview)
8+
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "gpt-3.5-turbo",
1111
"MessageLimit": 20,

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": "2023-06-01-preview", // Optional, used only by Azure OpenAI Service. Allowed values: 2023-03-15-preview, 2023-05-15 or 2023-06-01-preview (default)
7+
"ApiVersion": "2023-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2023-07-01-preview)
88
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values : ApiKey (default) or ActiveDirectory
99

1010
"DefaultModel": "my-model",

src/ChatGptNet/ServiceConfigurations/AzureChatGptServiceConfiguration.cs

Lines changed: 6 additions & 2 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 = "2023-06-01-preview";
13+
public const string DefaultApiVersion = "2023-07-01-preview";
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: 2023-06-01-preview).
21+
/// Gets or sets the API version of the Azure OpenAI service (Default: 2023-07-01-preview).
2222
/// </summary>
2323
/// <remarks>
2424
/// Currently supported versions are:
@@ -35,6 +35,10 @@ internal class AzureChatGptServiceConfiguration : ChatGptServiceConfiguration
3535
/// <term>2023-06-01-preview</term>
3636
/// <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>
3737
/// </item>
38+
/// <item>
39+
/// <term>2023-07-01-preview</term>
40+
/// <description><see href="https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-07-01-preview/generated.json">Swagger spec</see></description>
41+
/// </item>
3842
/// </list>
3943
/// </remarks>
4044
public string ApiVersion { get; set; } = DefaultApiVersion;

src/ChatGptNet/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "2.1",
3+
"version": "2.2",
44
"publicReleaseRefSpec": [
55
"^refs/heads/master$" // we release out of master
66
],

0 commit comments

Comments
 (0)