Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void GetOpenAIFunctionToolCallsReturnsCorrectList()
var content2 = new AzureOpenAIChatMessageContent(AuthorRole.User, "content", "model-id", []);

// Act
var actualToolCalls1 = content1.GetOpenAIFunctionToolCalls();
var actualToolCalls2 = content2.GetOpenAIFunctionToolCalls();
var actualToolCalls1 = content1.GetFunctionToolCalls();
var actualToolCalls2 = content2.GetFunctionToolCalls();

// Assert
Assert.Equal(2, actualToolCalls1.Count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ private static ChatMessageContentItemCollection CreateContentItems(IReadOnlyList
/// Retrieve the resulting function from the chat result.
/// </summary>
/// <returns>The <see cref="AzureOpenAIFunctionToolCall"/>, or null if no function was returned by the model.</returns>
public IReadOnlyList<AzureOpenAIFunctionToolCall> GetOpenAIFunctionToolCalls()
public IReadOnlyList<AzureOpenAIFunctionToolCall> GetFunctionToolCalls()
{
List<AzureOpenAIFunctionToolCall>? functionToolCallList = null;

foreach (var toolCall in this.ToolCalls)
{
if (toolCall is ChatToolCall functionToolCall)
if (toolCall.Kind == ChatToolCallKind.Function)
{
(functionToolCallList ??= []).Add(new AzureOpenAIFunctionToolCall(functionToolCall));
(functionToolCallList ??= []).Add(new AzureOpenAIFunctionToolCall(toolCall));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ public AzureOpenAIChatCompletionService(
/// Creates a new <see cref="AzureOpenAIChatCompletionService"/> client instance using the specified <see cref="OpenAIClient"/>.
/// </summary>
/// <param name="deploymentName">Azure OpenAI deployment name, see https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource</param>
/// <param name="openAIClient">Custom <see cref="OpenAIClient"/>.</param>
/// <param name="azureOpenAIClient">Custom <see cref="AzureOpenAIClient"/>.</param>
/// <param name="modelId">Azure OpenAI model id, see https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource</param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to use for logging. If null, no logging will be performed.</param>
public AzureOpenAIChatCompletionService(
string deploymentName,
AzureOpenAIClient openAIClient,
AzureOpenAIClient azureOpenAIClient,
string? modelId = null,
ILoggerFactory? loggerFactory = null)
{
this._core = new(deploymentName, openAIClient, loggerFactory?.CreateLogger(typeof(AzureOpenAIChatCompletionService)));
this._core = new(deploymentName, azureOpenAIClient, loggerFactory?.CreateLogger(typeof(AzureOpenAIChatCompletionService)));
this._core.AddAttribute(AIServiceExtensions.ModelIdKey, modelId);
}

Expand Down