llama-stack-mirror/tests/unit/providers
Matthew Farrellee 968fc132d3
fix(openai-compat): restrict developer/assistant/system/tool messages to text-only content (#2932)
**What:**
- Added OpenAIChatCompletionTextOnlyMessageContent type for text-only
content validation
- Modified OpenAISystemMessageParam, OpenAIAssistantMessageParam,
OpenAIDeveloperMessageParam, and OpenAIToolMessageParam to use text-only
content type instead of mixed content
- OpenAIUserMessageParam unchanged - still accepts both text and images
- Updated OpenAPI spec files to reflect text-only content restrictions
in schemas

closes #2894 

**Why:**
- Enforces OpenAI API compatibility by restricting image content to user
messages only
- Prevents API misuse where images might be sent in message types that
don't support them
- Aligns with OpenAI's actual API behavior where only user messages can
contain multimodal content
- Improves type safety and validation at the API boundary

**Test plan:**
- Added comprehensive parametrized tests covering all 5 OpenAI message
types
- Tests verify text string acceptance for all message types
- Tests verify text list acceptance for all message types
- Tests verify image rejection for system/assistant/developer/tool
messages (ValidationError expected)
- Tests verify user messages still accept images (backward compatibility
maintained)
2025-07-28 10:36:34 -07:00
..
agent fix: remove @pytest.mark.asyncio from test_get_raw_document_text.py (#2840) 2025-07-21 09:14:34 -07:00
agents chore: default to pytest asyncio-mode=auto (#2730) 2025-07-11 13:00:24 -07:00
inference feat(openai): add configurable base_url support with OPENAI_BASE_URL env var (#2919) 2025-07-28 10:16:02 -07:00
nvidia chore(test): migrate unit tests from unittest to pytest nvidia test safety (#2793) 2025-07-24 09:41:07 -07:00
utils fix(openai-compat): restrict developer/assistant/system/tool messages to text-only content (#2932) 2025-07-28 10:36:34 -07:00
vector_io chore: Fix chroma unit tests (#2896) 2025-07-25 10:12:14 -04:00
test_configs.py feat(api): don't return a payload on file delete (#1640) 2025-03-25 17:12:36 -07:00