mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Re-enable Declarative Integration Tests (#1080)
* Investigate * Next * Update initialization * Should be ok * Agent definition dx * Link agent definitions * Link agent definitions * Path resolution #2 * Fix path resolution * Another pass * Another * Better * One more * Whoopsie * Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/AgentFactory.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Namespace * Cleanup * Temp config for pipeline * Another temp workaround * Test config: Bing Grounding Tool * Update template * Next pass * Ok now * Cleanup * Test note --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+9
-6
@@ -16,15 +16,17 @@ internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowA
|
||||
{
|
||||
throw new DeclarativeActionException($"Conversation identifier must be defined: {this.Id}");
|
||||
}
|
||||
ChatMessage newMessage = new(ChatRole.<#= FormatEnum(this.Model.Role, RoleMap) #>, [.. this.GetContentAsync(context).ToEnumerable()]) { AdditionalProperties = this.GetMetadata() };
|
||||
ChatMessage newMessage = new(ChatRole.<#= FormatEnum(this.Model.Role, RoleMap) #>, await this.GetContentAsync(context).ConfigureAwait(false)) { AdditionalProperties = this.GetMetadata() };
|
||||
await agentProvider.CreateMessageAsync(conversationId, newMessage, cancellationToken).ConfigureAwait(false);<#
|
||||
AssignVariable(this.Message, "newMessage");
|
||||
#>
|
||||
return default;
|
||||
}
|
||||
|
||||
private async IAsyncEnumerable<AIContent> GetContentAsync(IWorkflowContext context)
|
||||
{<#
|
||||
private async ValueTask<IList<AIContent>> GetContentAsync(IWorkflowContext context)
|
||||
{
|
||||
List<AIContent> content = [];
|
||||
<#
|
||||
int index = 0;
|
||||
foreach (AddConversationMessageContent content in this.Model.Content)
|
||||
{
|
||||
@@ -33,17 +35,18 @@ internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowA
|
||||
AgentMessageContentType contentType = content.Type.Value;
|
||||
if (contentType == AgentMessageContentType.ImageUrl)
|
||||
{#>
|
||||
yield return new UriContent(contentValue, "image/*");<#
|
||||
content.Add(UriContent(contentValue<#= index #>, "image/*"));<#
|
||||
}
|
||||
else if (contentType == AgentMessageContentType.ImageFile)
|
||||
{#>
|
||||
yield return new HostedFileContent(contentValue);<#
|
||||
content.Add(new HostedFileContent(contentValue<#= index #>));<#
|
||||
}
|
||||
else
|
||||
{#>
|
||||
yield return new TextContent(contentValue<#= index #>);<#
|
||||
content.Add(new TextContent(contentValue<#= index #>));<#
|
||||
}
|
||||
}#>
|
||||
return content;
|
||||
}
|
||||
|
||||
private AdditionalPropertiesDictionary? GetMetadata()
|
||||
|
||||
Reference in New Issue
Block a user