Skip to content

FunctionInvokingChatClient doesn't validate parent span correctly #7223

Description

@TaoChenOSU

Description

The FunctionInvokingChatClient is supposed to only create an orchestrate_tools span if the current span is not an invoke_agent span.

However, the check here: https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs#L1115 will never return true because the display name of the current span, even when it's an invoke_agent, will have a postfix, something like "invoke_agent demo_app". The correct implementation should check if the display name starts with OpenTelemetryConsts.GenAI.InvokeAgentName instead of equality.

Reproduction Steps

Run Agent Framework sample: https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/GettingStarted/AgentOpenTelemetry

Expected behavior

The ochestrate_tools span should not be present.

Actual behavior

The ochestrate_tools span is present.

Image

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-aiMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions