Checked other resources
Package
langchain-openai
Description
Azure OpenAI adds a top-level content_filters array to every Responses API result (non-streaming, and on the response.completed event when streaming). Microsoft documents it as an Azure extension to read from response.model_extra:
https://learn.microsoft.com/azure/foundry/openai/how-to/responses
The array is also the only signal that the content filters did not run. In that case the request "still completes without content filtering", and the result carries an error object inside content_filter_results (Scenario 6 in https://learn.microsoft.com/azure/ai-foundry/openai/concepts/content-filter; schema in azure-rest-api-specs, specification/ai-foundry/data-plane/Foundry/src/openai/responses/models.tsp).
_construct_lc_result_from_responses_api builds response_metadata from a fixed key list, so content_filters is dropped on both invoke and stream. With ChatOpenAI(base_url="https://<resource>.openai.azure.com/openai/v1/", use_responses_api=True) an application cannot follow Microsoft's "verify content filter execution" guidance. AzureChatOpenAI already surfaces content_filter_results for Chat Completions; the Responses path has no equivalent.
Proposed fix
Add "content_filters" to the key list in _construct_lc_result_from_responses_api. Both paths go through that function, so it is a one-line change plus a unit test for each path. I have it ready and would like to be assigned.
Reproduction
from openai.types.responses import Response
from langchain_openai.chat_models.base import _construct_lc_result_from_responses_api
response = Response.model_validate({
"id": "resp_1", "created_at": 0, "model": "gpt-5.4-mini", "object": "response",
"parallel_tool_calls": True, "tools": [], "tool_choice": "auto", "output": [],
"content_filters": [{"source_type": "prompt", "blocked": False,
"content_filter_results": {"error": {"code": 1, "message": "The contents are not filtered"}}}],
})
metadata = _construct_lc_result_from_responses_api(response).generations[0].message.response_metadata
assert "content_filters" in metadata # fails today
Checked other resources
content_filterswith the Responses API.master(884d2d6) and in langchain-openai 1.6.7.Package
langchain-openai
Description
Azure OpenAI adds a top-level
content_filtersarray to every Responses API result (non-streaming, and on theresponse.completedevent when streaming). Microsoft documents it as an Azure extension to read fromresponse.model_extra:https://learn.microsoft.com/azure/foundry/openai/how-to/responses
The array is also the only signal that the content filters did not run. In that case the request "still completes without content filtering", and the result carries an
errorobject insidecontent_filter_results(Scenario 6 in https://learn.microsoft.com/azure/ai-foundry/openai/concepts/content-filter; schema inazure-rest-api-specs,specification/ai-foundry/data-plane/Foundry/src/openai/responses/models.tsp)._construct_lc_result_from_responses_apibuildsresponse_metadatafrom a fixed key list, socontent_filtersis dropped on bothinvokeandstream. WithChatOpenAI(base_url="https://<resource>.openai.azure.com/openai/v1/", use_responses_api=True)an application cannot follow Microsoft's "verify content filter execution" guidance.AzureChatOpenAIalready surfacescontent_filter_resultsfor Chat Completions; the Responses path has no equivalent.Proposed fix
Add
"content_filters"to the key list in_construct_lc_result_from_responses_api. Both paths go through that function, so it is a one-line change plus a unit test for each path. I have it ready and would like to be assigned.Reproduction