Skip to content

Commit

Permalink
🔧 Fix SendAsync method in ERNIEBotClient.cs (#104)
Browse files Browse the repository at this point in the history
- Changed the SendAsync method in ERNIEBotClient.cs to use the HttpCompletionOption.ResponseHeadersRead option for improved performance and efficiency.
  • Loading branch information
xbotter committed Mar 18, 2024
1 parent 0d48f3f commit 52fb7e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.28.240212.1" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.4.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.4.0" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.34.240313.1" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.6.2" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.6.2" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.4.0-alpha" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.4.0-alpha" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.6.2-alpha" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.6.2-alpha" />
<!-- Validation -->
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
<!-- Tests -->
Expand All @@ -23,7 +23,7 @@
<PackageVersion Include="System.Threading.RateLimiting" Version="8.0.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<!-- Misc -->
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
<LangVersion>11</LangVersion>
<IsPackable>false</IsPackable>
<NoWarn>SKEXP0003;SKEXP0052</NoWarn>
<NoWarn>SKEXP0001;SKEXP0003;SKEXP0050;SKEXP0052</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/custouch/semantic-kernel-ERNIE-Bot</PackageProjectUrl>
<RepositoryUrl>https://github.com/custouch/semantic-kernel-ERNIE-Bot</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>0.14.1</Version>
<Version>0.14.2</Version>
<PackageOutputPath>..\..\nupkgs</PackageOutputPath>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<NoWarn>SKEXP0001;SKEXP0002;SKEXP0052;SKEXP0003</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/ERNIE-Bot.SDK/ERNIEBotClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async IAsyncEnumerable<ChatResponse> ChatStreamAsync(ChatRequest request,

var webRequest = await CreateRequestAsync(HttpMethod.Post, Defaults.Endpoint(modelEndpoint), request, cancellationToken);

var response = await _client.SendAsync(webRequest, cancellationToken);
var response = await _client.SendAsync(webRequest, HttpCompletionOption.ResponseHeadersRead, cancellationToken);

await foreach (var item in ParseResponseStreamAsync(response, cancellationToken))
{
Expand Down

0 comments on commit 52fb7e4

Please sign in to comment.