microsoft/autogen · error · ValueError
function_call is deprecated and is not supported by this mod
Error message
function_call is deprecated and is not supported by this model client.
What it means
Thrown by OpenAIChatCompletionClient while parsing a completion response when the returned choice.message.function_call is not None. OpenAI's legacy function_call field predates the tool_calls API and this client only supports the modern tool-calling protocol, so any legacy function call in a response is rejected rather than silently mis-parsed.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py:743
if self._resolved_model is not None:
if self._resolved_model != result.model:
warnings.warn(
f"Resolved model mismatch: {self._resolved_model} != {result.model}. "
"Model mapping in autogen_ext.models.openai may be incorrect. "
f"Set the model to {result.model} to enhance token/cost estimation and suppress this warning.",
stacklevel=2,
)
# Limited to a single choice currently.
choice: Union[ParsedChoice[Any], ParsedChoice[BaseModel], Choice] = result.choices[0]
# Detect whether it is a function call or not.
# We don't rely on choice.finish_reason as it is not always accurate, depending on the API used.
content: Union[str, List[FunctionCall]]
thought: str | None = None
if choice.message.function_call is not None:
raise ValueError("function_call is deprecated and is not supported by this model client.")
elif choice.message.tool_calls is not None and len(choice.message.tool_calls) > 0:
if choice.finish_reason != "tool_calls":
warnings.warn(
f"Finish reason mismatch: {choice.finish_reason} != tool_calls "
"when tool_calls are present. Finish reason may not be accurate. "
"This may be due to the API used that is not returning the correct finish reason.",
stacklevel=2,
)
if choice.message.content is not None and choice.message.content != "":
# Put the content in the thought field.
thought = choice.message.content
# NOTE: If OAI response type changes, this will need to be updated
content = []
for tool_call in choice.message.tool_calls:
if not isinstance(tool_call.function.arguments, str):
warnings.warn(
f"Tool call function arguments field is not a string: {tool_call.function.arguments}."
"This is unexpected and may due to the API used not returning the correct type. "View on GitHub (pinned to 027ecf0a37)
Solutions
- Point the client at an API version/endpoint that returns tool_calls instead of function_call
- Update the compatible server/proxy (vLLM, LiteLLM, etc.) to a version that emits the modern tool_calls format
- If using Azure, set a recent api_version in the client config
- As a last resort for legacy endpoints, avoid passing tools so the model never emits function calls
Example fix
# before client = AzureOpenAIChatCompletionClient(azure_endpoint=..., api_version="2023-07-01-preview", ...) # after client = AzureOpenAIChatCompletionClient(azure_endpoint=..., api_version="2024-06-01", ...)
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = await client.create(messages, tools=tools)
except ValueError as e:
if "function_call is deprecated" in str(e):
raise RuntimeError(
"endpoint returns legacy function_call; upgrade the gateway/api_version"
) from e
raise Prevention
- Pin modern api_versions for Azure clients and keep compatible gateways updated
- Integration-test one tool-call round-trip against each new endpoint before rollout
- Prefer endpoints that emit tool_calls; treat legacy function_call as a hard incompatibility
When it happens
Trigger: The chat completion API (or a compatible endpoint) returns a response using the deprecated function_call field instead of tool_calls. Common with OpenAI-compatible proxies/fine-tunes that emulate the old API, or when a fine-tuned model emits legacy function-call format.
Common situations: Using an OpenAI-compatible gateway (vLLM, older LiteLLM, local servers) that maps tool calls to the legacy function_call response shape; older fine-tuned models trained on the legacy function API; Azure deployments pinned to old API versions.
Related errors
- Function calls are not supported in this context
- Please set OPENAI_API_KEY environment variable.
- Please set OPENAI_API_KEY environment variable.
- Parameter name cannot be null
- param.ParameterType cannot be null
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/0fbb0ebd7d7840e8.
Report an issue: GitHub.