Skip to content

Commit ebdc1e6

Browse files
authored
Add support for stream_options (#161)
2 parents ffe9b12 + 8df90d3 commit ebdc1e6

File tree

17 files changed

+95
-71
lines changed

17 files changed

+95
-71
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ builder.Services.AddChatGpt(options =>
6161
- 2024-04-01-preview
6262
- 2024-05-01-preview
6363
- 2024-02-01
64-
- 2024-06-01 (default)
64+
- 2024-06-01
65+
- 2024-07-01-preview (default)
6566
- _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").
6667

6768
### DefaultModel and DefaultEmbeddingModel

samples/ChatGptApi/ChatGptApi.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
11-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
12-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
13-
<PackageReference Include="TinyHelpers.AspNetCore" Version="3.1.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
11+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.0" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
13+
<PackageReference Include="TinyHelpers.AspNetCore" Version="3.1.9" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

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-06-01", // Optional, used only by Azure OpenAI Service (default: 2024-06-01)
7+
"ApiVersion": "2024-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-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/ChatGptBlazor.Wasm/ChatGptBlazor.Wasm.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Markdig" Version="0.37.0" />
12-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.7" />
13-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.7" PrivateAssets="all" />
14-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
13+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
14+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

samples/ChatGptConsole/ChatGptConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
12+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

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-06-01", // Optional, used only by Azure OpenAI Service (default: 2024-06-01)
7+
"ApiVersion": "2024-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-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/ChatGptFunctionCallingConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
12+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

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-06-01", // Optional, used only by Azure OpenAI Service (default: 2024-06-01)
7+
"ApiVersion": "2024-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-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/ChatGptStreamConsole/ChatGptStreamConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
12+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
{
2-
"ChatGPT": {
3-
"Provider": "OpenAI", // Optional. Allowed values: OpenAI (default) or Azure
4-
"ApiKey": "", // Required
5-
//"Organization": "", // Optional, used only by OpenAI
6-
"ResourceName": "", // Required when using Azure OpenAI Service
7-
"ApiVersion": "2024-06-01", // Optional, used only by Azure OpenAI Service (default: 2024-06-01)
8-
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
9-
10-
"DefaultModel": "my-model",
11-
"DefaultEmbeddingModel": "text-embedding-ada-002", // Optional, set it if you want to use embeddings
12-
"MessageLimit": 20,
13-
"MessageExpiration": "00:30:00",
14-
"ThrowExceptionOnError": true // Optional, default: true
15-
//"User": "UserName",
16-
//"DefaultParameters": {
17-
// "Temperature": 0.8,
18-
// "TopP": 1,
19-
// "MaxTokens": 500,
20-
// "PresencePenalty": 0,
21-
// "FrequencyPenalty": 0,
22-
// "ResponseFormat": { "Type": "text" }, // Allowed values for Type: text (default) or json_object
23-
// "Seed": 42 // Optional (any integer value)
24-
//},
25-
//"DefaultEmbeddingParameters": {
26-
// "Dimensions": 1536
27-
//}
28-
},
29-
"Logging": {
30-
"LogLevel": {
31-
"Default": "Error",
32-
"Microsoft": "Warning"
33-
}
34-
}
35-
}
1+
{
2+
"ChatGPT": {
3+
"Provider": "OpenAI", // Optional. Allowed values: OpenAI (default) or Azure
4+
"ApiKey": "", // Required
5+
//"Organization": "", // Optional, used only by OpenAI
6+
"ResourceName": "", // Required when using Azure OpenAI Service
7+
"ApiVersion": "2024-07-01-preview", // Optional, used only by Azure OpenAI Service (default: 2024-07-01-preview)
8+
"AuthenticationType": "ApiKey", // Optional, used only by Azure OpenAI Service. Allowed values: ApiKey (default) or ActiveDirectory
9+
10+
"DefaultModel": "my-model",
11+
"DefaultEmbeddingModel": "text-embedding-ada-002", // Optional, set it if you want to use embeddings
12+
"MessageLimit": 20,
13+
"MessageExpiration": "00:30:00",
14+
"ThrowExceptionOnError": true // Optional, default: true
15+
//"User": "UserName",
16+
//"DefaultParameters": {
17+
// "Temperature": 0.8,
18+
// "TopP": 1,
19+
// "MaxTokens": 500,
20+
// "PresencePenalty": 0,
21+
// "FrequencyPenalty": 0,
22+
// "ResponseFormat": { "Type": "text" }, // Allowed values for Type: text (default) or json_object
23+
// "Seed": 42 // Optional (any integer value)
24+
//},
25+
//"DefaultEmbeddingParameters": {
26+
// "Dimensions": 1536
27+
//}
28+
},
29+
"Logging": {
30+
"LogLevel": {
31+
"Default": "Error",
32+
"Microsoft": "Warning"
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)