Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.Contains('Azure.AI.Agents.Persistent'))">
<PackageReference Update="Microsoft.Extensions.AI.Abstractions" Version="9.10.1"/>
<PackageReference Update="Microsoft.Extensions.AI.Abstractions" Version="9.10.2"/>
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.Contains('Azure.Projects'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,59 @@ threadRun is not null &&
yield return ruUpdate;
break;

case RunStepDetailsUpdate details:
if (!string.IsNullOrEmpty(details.CodeInterpreterInput))
{
CodeInterpreterToolCallContent citcc = new()
{
CallId = details.ToolCallId,
Inputs = [new DataContent(Encoding.UTF8.GetBytes(details.CodeInterpreterInput), "text/x-python")],
RawRepresentation = details,
};

yield return new ChatResponseUpdate(ChatRole.Assistant, [citcc])
{
AuthorName = _agentId,
ConversationId = threadId,
MessageId = responseId,
RawRepresentation = update,
ResponseId = responseId,
};
}

if (details.CodeInterpreterOutputs is { Count: > 0 })
{
CodeInterpreterToolResultContent citrc = new()
{
CallId = details.ToolCallId,
RawRepresentation = details,
};

foreach (var output in details.CodeInterpreterOutputs)
{
switch (output)
{
case RunStepDeltaCodeInterpreterImageOutput imageOutput when imageOutput.Image?.FileId is string imageFileId && !string.IsNullOrWhiteSpace(imageFileId):
(citrc.Outputs ??= []).Add(new HostedFileContent(imageFileId) { MediaType = "image/*" });
break;

case RunStepDeltaCodeInterpreterLogOutput logOutput when logOutput.Logs is string logs && !string.IsNullOrEmpty(logs):
(citrc.Outputs ??= []).Add(new TextContent(logs));
break;
}
}

yield return new ChatResponseUpdate(ChatRole.Assistant, [citrc])
{
AuthorName = _agentId,
ConversationId = threadId,
MessageId = responseId,
RawRepresentation = update,
ResponseId = responseId,
};
}
break;

case MessageContentUpdate mcu:
ChatResponseUpdate textUpdate = new(mcu.Role == MessageRole.User ? ChatRole.User : ChatRole.Assistant, mcu.Text)
{
Expand Down
Loading