Merge pull request #2468 from pipecat-ai/mb/fix-mistral-docs-errors

Fix Mistral docstrings build errors
This commit is contained in:
Mark Backman
2025-08-19 12:22:26 -07:00
committed by GitHub

View File

@@ -95,17 +95,20 @@ class MistralLLMService(OpenAILLMService):
Mistral and OpenAI have different function call detection patterns: Mistral and OpenAI have different function call detection patterns:
OpenAI (Stream-based detection): OpenAI (Stream-based detection):
- Detects function calls only from streaming chunks as the LLM generates them - Detects function calls only from streaming chunks as the LLM generates them
- Second LLM completion doesn't re-detect existing tool_calls in message history - Second LLM completion doesn't re-detect existing tool_calls in message history
- Function calls execute exactly once - Function calls execute exactly once
Mistral (Message-based detection): Mistral (Message-based detection):
- Detects function calls from the complete message history on each completion - Detects function calls from the complete message history on each completion
- Second LLM completion with the response re-detects the same tool_calls from - Second LLM completion with the response re-detects the same tool_calls from
previous messages previous messages
- Without filtering, function calls would execute twice - Without filtering, function calls would execute twice
This method prevents duplicate execution by: This method prevents duplicate execution by:
1. Checking message history for existing tool result messages 1. Checking message history for existing tool result messages
2. Filtering out function calls that already have corresponding results 2. Filtering out function calls that already have corresponding results
3. Only executing function calls that haven't been completed yet 3. Only executing function calls that haven't been completed yet