Component
Distro
Description
Opening the issue here, while it could be originating from a change on the Foundry Responses API too.
As opposed to the evidences shown in this feature #234
... my Azure Foundry Project endpoint reports the model-router name (eg "model-router-2025-11-18") in the "x-ms-served-model" header
instead of the model selected for the generation ("gpt-5.6-sol-2026-07-09"),
which is correctly reported as "model_name" in the response body metadata.
The served model from headers taking precedence, the most important information is lost.
Expected Behavior
Expected : the span attribute gen_ai.response.model should contain the model actually inferred ("gpt-5.6-sol-2026-07-09" in my case)
In any case, I think the fix should be upstream (Foundry or opentelemetry-python-genai),
and not a local workaround in the current project.
Option #1 : Revert Foundry API (ModelRouterControls=V1Preview) to its initial contract and report the model actually inferred through the "x-ms-served-model" header :
no change to the current codebase
no change to the upstream contribution open-telemetry/opentelemetry-python-genai#305
Option #2 : Capture the model name from the response body in the upstream https://github.com/open-telemetry/opentelemetry-python-genai/blob/main/instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py#L537
Steps to Reproduce
- Clone the repo
- export BASE_URL=https://myfoundry.services.ai.azure.com/api/projects/defaultproject
- export MODEL_NAME=my-model-router-deployment
- uv run --with langchain-openai python samples/langchain/sample_foundry_responses_api.py
Environment
[project]
name = "microsoft-opentelemetry"
version = "1.3.9"
Additional Context
No response
Component
Distro
Description
Opening the issue here, while it could be originating from a change on the Foundry Responses API too.
As opposed to the evidences shown in this feature #234
... my Azure Foundry Project endpoint reports the model-router name (eg "model-router-2025-11-18") in the "x-ms-served-model" header
instead of the model selected for the generation ("gpt-5.6-sol-2026-07-09"),
which is correctly reported as "model_name" in the response body metadata.
The served model from headers taking precedence, the most important information is lost.
Expected Behavior
Expected : the span attribute gen_ai.response.model should contain the model actually inferred ("gpt-5.6-sol-2026-07-09" in my case)
In any case, I think the fix should be upstream (Foundry or opentelemetry-python-genai),
and not a local workaround in the current project.
Option #1 : Revert Foundry API (ModelRouterControls=V1Preview) to its initial contract and report the model actually inferred through the "x-ms-served-model" header :
Option #2 : Capture the model name from the response body in the upstream https://github.com/open-telemetry/opentelemetry-python-genai/blob/main/instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py#L537
Steps to Reproduce
Environment
[project]
name = "microsoft-opentelemetry"
version = "1.3.9"
Additional Context
No response