mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Some Ollama models (like Olmo, Nemotron-3-nano) don't properly respect system messages, causing them to ignore tool-format instructions. This fix modifies _format_messages_for_provider() to merge system message content into the first user message for Ollama models, ensuring the instructions are visible to the model. Changes: - Accumulate all system messages and merge into first user message - Handle edge cases: system-only messages, system then assistant - Preserve conversation history after system message merge - Add comprehensive tests for all scenarios Fixes #4117 Co-Authored-By: João <joao@crewai.com>
35 KiB
35 KiB