Problem/Motivation

When using streaming output with the Mistral provider, AI Logging never receives the response because PostStreamingResponseEvent is not dispatched.

Steps to reproduce

1. Install ai_provider_mistral 1.1.0-beta1 and ai_logging
2. Configure Mistral as the default chat provider
3. Enable "Log AI responses" in AI Logging settings
4. Use any AI feature that uses streaming (e.g., AI CKEditor with streaming enabled)
5. Check AI Logs at /admin/reports/ai-logging

Proposed resolution

Change MistralChatMessageIterator to implement doIterate() instead of overriding getIterator()

CommentFileSizeAuthor
#3 3568827-streaming-fix.patch1.09 KBpetar_basic
Command icon 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

petar_basic created an issue. See original summary.

petar_basic’s picture

StatusFileSize
new1.09 KB

Added a fix where I implemented/overrode the doIterate function instead of getIterator of the StreamedChatMessageIterator - as documented in the function.

Now the reconstructChatOutput, triggerEvent and any callbacks are properly/triggered called when getIterator is called.

petar_basic’s picture

Assigned: petar_basic » Unassigned
Status: Active » Needs review
fago’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

makes sense. let's also add an integration test to verify this is working?

petar_basic’s picture

Status: Needs work » Needs review

Added the test.

fago’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

fago’s picture

Issue tags: -Needs tests

Thx, merged!

petar_basic’s picture

Version: 1.1.0-beta1 » 1.1.0-beta2
Status: Fixed » Reviewed & tested by the community

@fago It seems you missed to merge the MR. It had a merge block so I updated the branch with latest changes, so it is mergable now.

  • fago committed 952d3a67 on 1.1.x authored by petar_basic
    fix: #3568827 Fix iterating and logging streamed responses.
    
    By:...
fago’s picture

Status: Reviewed & tested by the community » Fixed

thank you, seems like I had mixed up issues. merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.