mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Address bug when agent rawrepresentation is a MEAI type and returns it with null RawRep (#1054)
This commit is contained in:
@@ -85,7 +85,7 @@ Console.WriteLine("""
|
||||
""");
|
||||
|
||||
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT environment variable is not set.");
|
||||
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
|
||||
var deploymentName = System.Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
|
||||
|
||||
// Log application startup
|
||||
appLogger.LogInformation("OpenTelemetry Aspire Demo application started");
|
||||
|
||||
@@ -85,7 +85,7 @@ public sealed class OpenTelemetryAgent : DelegatingAIAgent, IDisposable
|
||||
|
||||
var response = await this._otelClient.GetResponseAsync(messages, co, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return (AgentRunResponse)response.RawRepresentation!;
|
||||
return response.RawRepresentation as AgentRunResponse ?? new AgentRunResponse(response);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -96,7 +96,7 @@ public sealed class OpenTelemetryAgent : DelegatingAIAgent, IDisposable
|
||||
|
||||
await foreach (var update in this._otelClient.GetStreamingResponseAsync(messages, co, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
yield return (AgentRunResponseUpdate)update.RawRepresentation!;
|
||||
yield return update.RawRepresentation as AgentRunResponseUpdate ?? new AgentRunResponseUpdate(update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections;
|
||||
using SystemEnvironment = System.Environment;
|
||||
|
||||
namespace SampleHelpers;
|
||||
|
||||
internal static class SampleEnvironment
|
||||
{
|
||||
public static string? GetEnvironmentVariable(string key)
|
||||
|
||||
Reference in New Issue
Block a user