Files
litellm/tests
504c70f4e0 fix(responses-api): return finish_reason='tool_calls' when response.completed contains function_call items (#19745)
When using the Responses API (e.g., Azure gpt-5.1-codex-mini), the response.completed
event was always returning finish_reason='stop', even when the response contained
function_call items in its output. This caused agents like OpenCode to incorrectly
conclude the stream ended without tools to execute, breaking tool/function calling
workflows.

The fix inspects the response.output field in the response.completed event to determine
the correct finish_reason:
- 'tool_calls' when output contains function_call items
- 'stop' otherwise (text-only responses)

Added tests to verify:
- response.completed with function_call output returns finish_reason='tool_calls'
- response.completed with message-only output returns finish_reason='stop'
- response.completed with empty output returns finish_reason='stop' (backward compat)

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-02-16 09:19:57 -08:00
..
2026-02-14 12:59:15 -08:00
2026-01-20 18:37:56 +05:30
2026-02-14 12:28:18 -08:00
2026-01-11 08:00:31 -08:00
2026-01-31 19:08:07 -08:00
2026-01-22 10:50:23 -08:00
2026-01-02 17:38:52 +09:00
2026-01-22 15:21:44 -08:00
2026-02-05 09:40:21 +05:30

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.