llama-stack-mirror/tests/integration/responses
Shabana Baig 72ea95e2e0
fix: Fix max_tool_calls for openai provider and add integration tests for the max_tool_calls feat (#4190)
# Problem

OpenAI gpt-4 returned an error when built-in and mcp calls were skipped
due to max_tool_calls parameter. Following is from the server log:
```
RuntimeError: OpenAI response failed: Error code: 400 - {'error': {'message': "An assistant message with       
'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids  
did not have response messages: call_Yi9V1QNpN73dJCAgP2Arcjej", 'type': 'invalid_request_error', 'param':      
'messages', 'code': None}}
```

# What does this PR do?

- Fixes error returned by openai/gpt when calls were skipped due to
max_tool_calls. We now return a tool message that explicitly mentions
that the call is skipped.
- Adds integration tests as a follow-up to
PR#[4062](https://github.com/llamastack/llama-stack/pull/4062)

<!-- If resolving an issue, uncomment and update the line below -->
Part 2 for issue
#[3563](https://github.com/llamastack/llama-stack/issues/3563)

## Test Plan
<!-- Describe the tests you ran to verify your changes with result
summaries. *Provide clear instructions so the plan can be easily
re-executed.* -->

- Added integration tests
- Added new recordings

---------

Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-11-19 10:27:56 -08:00
..
fixtures fix(tests): add OpenAI client connection cleanup to prevent CI hangs (#4119) 2025-11-12 12:17:13 -05:00
recordings fix: Fix max_tool_calls for openai provider and add integration tests for the max_tool_calls feat (#4190) 2025-11-19 10:27:56 -08:00
__init__.py feat(tests): introduce a test "suite" concept to encompass dirs, options (#3339) 2025-09-05 13:58:49 -07:00
conftest.py feat(tests): enable MCP tests in server mode (#4146) 2025-11-13 07:23:23 -08:00
helpers.py feat(responses)!: improve responses + conversations implementations (#3810) 2025-10-15 09:36:11 -07:00
streaming_assertions.py feat(responses)!: add in_progress, failed, content part events (#3765) 2025-10-10 07:27:34 -07:00
test_basic_responses.py feat(tests): enable MCP tests in server mode (#4146) 2025-11-13 07:23:23 -08:00
test_conversation_responses.py fix: MCP authorization parameter implementation (#4052) 2025-11-14 08:54:42 -08:00
test_file_search.py feat(tests): enable MCP tests in server mode (#4146) 2025-11-13 07:23:23 -08:00
test_mcp_authentication.py fix: MCP authorization parameter implementation (#4052) 2025-11-14 08:54:42 -08:00
test_tool_responses.py fix: Fix max_tool_calls for openai provider and add integration tests for the max_tool_calls feat (#4190) 2025-11-19 10:27:56 -08:00