Skip to content

Commit 59508ca

Browse files
.Net: Update azure.ai.openai to beta 13 (#4861)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent bf2932c commit 59508ca

3 files changed

Lines changed: 3 additions & 13 deletions

File tree

‎dotnet/Directory.Packages.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageVersion Include="Azure.AI.OpenAI" Version="1.0.0-beta.12" />
8+
<PackageVersion Include="Azure.AI.OpenAI" Version="1.0.0-beta.13" />
99
<PackageVersion Include="Azure.Identity" Version="1.10.4" />
1010
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.2.0" />
1111
<PackageVersion Include="Azure.Search.Documents" Version="11.5.1" />

‎dotnet/src/Connectors/Connectors.OpenAI/AzureSdk/ClientCore.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ private static ChatRequestMessage GetRequestMessage(ChatMessageContent message)
914914
name.ValueKind == JsonValueKind.String &&
915915
arguments.ValueKind == JsonValueKind.String)
916916
{
917-
ftcs.Add(OpenAIFunctionToolCall.CreateChatCompletionsFunctionToolCall(id.GetString()!, name.GetString()!, arguments.GetString()!));
917+
ftcs.Add(new ChatCompletionsFunctionToolCall(id.GetString()!, name.GetString()!, arguments.GetString()!));
918918
}
919919
}
920920
tools = ftcs;

‎dotnet/src/Connectors/Connectors.OpenAI/AzureSdk/OpenAIFunctionToolCall.cs‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Diagnostics;
6-
using System.Reflection;
76
using System.Text;
87
using System.Text.Json;
98
using Azure.AI.OpenAI;
@@ -159,7 +158,7 @@ internal static ChatCompletionsFunctionToolCall[] ConvertToolCallUpdatesToChatCo
159158
functionNamesByIndex?.TryGetValue(toolCallIndexAndId.Key, out functionName);
160159
functionArgumentBuildersByIndex?.TryGetValue(toolCallIndexAndId.Key, out functionArguments);
161160

162-
toolCalls[i] = CreateChatCompletionsFunctionToolCall(toolCallIndexAndId.Value, functionName ?? string.Empty, functionArguments?.ToString() ?? string.Empty);
161+
toolCalls[i] = new ChatCompletionsFunctionToolCall(toolCallIndexAndId.Value, functionName ?? string.Empty, functionArguments?.ToString() ?? string.Empty);
163162
i++;
164163
}
165164

@@ -168,13 +167,4 @@ internal static ChatCompletionsFunctionToolCall[] ConvertToolCallUpdatesToChatCo
168167

169168
return toolCalls;
170169
}
171-
172-
// TODO: Remove this temporary hack once the Azure SDK has been updated to set `base.Type = "function"` in the ChatCompletionsFunctionToolCall ctor
173-
internal static ChatCompletionsFunctionToolCall CreateChatCompletionsFunctionToolCall(string id, string name, string arguments)
174-
{
175-
var c = new ChatCompletionsFunctionToolCall(id, name, arguments);
176-
s_type?.SetValue(c, "function");
177-
return c;
178-
}
179-
private static readonly PropertyInfo? s_type = typeof(ChatCompletionsToolCall).GetProperty("Type", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
180170
}

0 commit comments

Comments
 (0)