diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 7ff9332fbec0..b58af11e54b2 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -10,7 +10,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/dotnet/samples/GettingStartedWithAgents/OpenAIAssistant/Step05_AssistantTool_Function.cs b/dotnet/samples/GettingStartedWithAgents/OpenAIAssistant/Step05_AssistantTool_Function.cs index 017c2d3c9877..a83741307cf2 100644 --- a/dotnet/samples/GettingStartedWithAgents/OpenAIAssistant/Step05_AssistantTool_Function.cs +++ b/dotnet/samples/GettingStartedWithAgents/OpenAIAssistant/Step05_AssistantTool_Function.cs @@ -28,10 +28,14 @@ public async Task UseSingleAssistantWithFunctionToolsAsync() new() { Name = HostName, - Instructions = HostInstructions, - Metadata = AssistantSampleMetadata, + Instructions = HostInstructions }; + foreach (var keyValuePair in AssistantSampleMetadata) + { + creationOptions.Metadata.Add(keyValuePair); + } + // In this sample the function tools are added to the assistant this is // important if you want to retrieve the assistant later and then dynamically check // what function tools it requires. diff --git a/dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs b/dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs index 9d2b01cda30f..b8a0a3778745 100644 --- a/dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs +++ b/dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs @@ -256,7 +256,7 @@ await functionProcessor.InvokeFunctionCallsAsync( int messageCount = 0; foreach (RunStep completedStep in completedStepsToProcess) { - if (completedStep.Type == RunStepType.ToolCalls) + if (completedStep.Kind == RunStepKind.ToolCall) { foreach (RunStepToolCall toolCall in completedStep.Details.ToolCalls) { @@ -264,15 +264,15 @@ await functionProcessor.InvokeFunctionCallsAsync( ChatMessageContent? content = null; // Process code-interpreter content - if (toolCall.ToolKind == RunStepToolCallKind.CodeInterpreter) + if (toolCall.Kind == RunStepToolCallKind.CodeInterpreter) { content = GenerateCodeInterpreterContent(agent.GetName(), toolCall.CodeInterpreterInput, completedStep); isVisible = true; } // Process function result content - else if (toolCall.ToolKind == RunStepToolCallKind.Function) + else if (toolCall.Kind == RunStepToolCallKind.Function) { - FunctionResultContent functionStep = functionSteps[toolCall.ToolCallId]; // Function step always captured on invocation + FunctionResultContent functionStep = functionSteps[toolCall.Id]; // Function step always captured on invocation content = GenerateFunctionResultContent(agent.GetName(), [functionStep], completedStep); } @@ -284,7 +284,7 @@ await functionProcessor.InvokeFunctionCallsAsync( } } } - else if (completedStep.Type == RunStepType.MessageCreation) + else if (completedStep.Kind == RunStepKind.CreatedMessage) { // Retrieve the message ThreadMessage? message = await RetrieveMessageAsync(client, threadId, completedStep.Details.CreatedMessageId, agent.PollingOptions.MessageSynchronizationDelay, cancellationToken).ConfigureAwait(false); @@ -506,7 +506,7 @@ await client.GetRunStepsAsync(run.ThreadId, run.Id, cancellationToken: cancellat { foreach (RunStepToolCall stepDetails in step.Details.ToolCalls) { - toolMap[stepDetails.ToolCallId] = step.Id; + toolMap[stepDetails.Id] = step.Id; } } @@ -564,14 +564,14 @@ await RetrieveMessageAsync( { foreach (RunStepToolCall toolCall in step.Details.ToolCalls) { - if (toolCall.ToolKind == RunStepToolCallKind.Function) + if (toolCall.Kind == RunStepToolCallKind.Function) { messages?.Add(GenerateFunctionResultContent(agent.GetName(), stepFunctionResults[step.Id], step)); stepFunctionResults.Remove(step.Id); break; } - if (toolCall.ToolKind == RunStepToolCallKind.CodeInterpreter) + if (toolCall.Kind == RunStepToolCallKind.CodeInterpreter) { messages?.Add(GenerateCodeInterpreterContent(agent.GetName(), toolCall.CodeInterpreterInput, step)); } @@ -761,13 +761,13 @@ private static ChatMessageContent GenerateCodeInterpreterContent(string agentNam private static IEnumerable ParseFunctionStep(OpenAIAssistantAgent agent, RunStep step) { - if (step.Status == RunStepStatus.InProgress && step.Type == RunStepType.ToolCalls) + if (step.Status == RunStepStatus.InProgress && step.Kind == RunStepKind.ToolCall) { foreach (RunStepToolCall toolCall in step.Details.ToolCalls) { (FunctionName nameParts, KernelArguments functionArguments) = ParseFunctionCall(toolCall.FunctionName, toolCall.FunctionArguments); - FunctionCallContent content = new(nameParts.Name, nameParts.PluginName, toolCall.ToolCallId, functionArguments); + FunctionCallContent content = new(nameParts.Name, nameParts.PluginName, toolCall.Id, functionArguments); yield return content; }