Problem/Motivation
Streamed chat responses are not being recorded in the AI log.
The doIterate() method does not pass raw response data to createStreamedChatMessage(), resulting in empty output in logs.
Additionally, the iterator is missing: token usage tracking, finish reason tracking & tool calls passthrough
Steps to reproduce
1. Configure Mistral API key at /admin/config/ai/providers/mistral
2. Enable ai_logging module with response logging enabled
3. Go to /admin/config/ai/explorers → Chat
4. Enable streaming option
5. Send a message
6. Check /admin/config/ai/logging/collection
7. Result: Log entry has empty or minimal response data
Proposed resolution
Update MistralChatMessageIterator::doIterate() to properly pass all parameters to createStreamedChatMessage().
See also how OpenAiChatMessageIterator handles streaming.
Issue fork ai_provider_mistral-3571505
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
petar_basic commentedThe iterator was missing raw response data, tool calls, token usage tracking, and finish reason - now aligned with how OpenAI provider handles it.
Also extracted the responseToArray() into a trait to avoid duplication between the provider and iterator classes.
Comment #4
petar_basic commentedComment #5
fagoThx, code looks good. I'm giving this a test-run!
Comment #6
fagoI had to create https://www.drupal.org/project/ai/issues/3571925#comment-16457948 for being able to test it. But now, it works and see items logged correctly!
Comment #7
fagoMoved it into the merge train.
Comment #9
fago