Skip to content

Commit

Permalink
.Net: Fix error for System.Memory.Data 6, upgrade packages dependenci…
Browse files Browse the repository at this point in the history
…es (#9454)

### Motivation and Context

This add a small fix when using SK with `System.Memory.Data 6.0.0`.

This bug happens when updating the `Azure.Core` to
[1.44.0](https://www.nuget.org/packages/Azure.Core/1.44.0) which
requires `System.Memory.Data` of 6 or above that introduce an error when
attempting to `.ToString()` on an empty `BinaryData` object.

- Fix #9313
  • Loading branch information
RogerBarreto authored Oct 29, 2024
1 parent 0b05ba1 commit 5defee5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageVersion Include="OpenAI" Version="[2.1.0-beta.1]" />
<PackageVersion Include="Azure.AI.ContentSafety" Version="1.0.0" />
<PackageVersion Include="Azure.AI.OpenAI" Version="[2.1.0-beta.1]" />
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Identity" Version="1.13.1" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageVersion Include="Azure.Search.Documents" Version="11.6.0" />
<PackageVersion Include="Handlebars.Net.Helpers" Version="2.4.6" />
Expand All @@ -34,7 +34,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.65.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.66.1" />
<PackageVersion Include="Microsoft.ML.OnnxRuntime" Version="1.19.2" />
<PackageVersion Include="FastBertTokenizer" Version="1.0.28" />
<PackageVersion Include="PdfPig" Version="0.1.9" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,14 @@ internal async IAsyncEnumerable<OpenAIStreamingChatMessageContent> GetStreamingC
continue;
}

string streamingArguments = (functionCallUpdate.FunctionArgumentsUpdate?.ToMemory().IsEmpty ?? true)
? string.Empty
: functionCallUpdate.FunctionArgumentsUpdate.ToString();

openAIStreamingChatMessageContent.Items.Add(new StreamingFunctionCallUpdateContent(
callId: functionCallUpdate.ToolCallId,
name: functionCallUpdate.FunctionName,
arguments: functionCallUpdate.FunctionArgumentsUpdate?.ToString(),
arguments: streamingArguments,
functionCallIndex: functionCallUpdate.Index));
}
}
Expand Down

0 comments on commit 5defee5

Please sign in to comment.