AI logging is expecting a different object:
Error: Object of class Drupal\ai\OperationType\Chat\OpenAiTypeStreamedChatMessageIterator could not be converted to string in Drupal\langfuse_ai_logging\EventSubscriber\LangFuseAiLoggingSubscriber->completeGeneration() (line 401 of /var/www/html/docroot/modules/contrib/langfuse/modules/langfuse_ai_logging/src/EventSubscriber/LangFuseAiLoggingSubscriber.php).

Issue fork langfuse-3548793

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:

  • main Comparechanges, plain diff MR !1

Comments

nielsaers created an issue. See original summary.

  • nikro committed 5901b605 on main
    [#3548793] fix: make sure streaming works
    
nikro’s picture

Assigned: Unassigned » nielsaers
Status: Needs work » Needs review

Alright, after digging a bit, I realized that all my tests were NON-STREAMING and your bumped into the streaming use-case. I doesn't depend on my original assumptions that it's related to ai.module v1.2.x - but it's simply related to streaming.

Apparently the PostGeneration hook is called even for streaming events, but the contents are empty (as they are normally constructed in a later phase). Solution was to identify that we're actually using a streamed case, and bail early, and use a different event (with already properly prepared response) to track it.

I nuked (or tried nuking) 1.2.x branch, committed changes straight into the main branch.

@Niels, please pull (main, not this issue-branch), recheck - see if it works as expected.

nikro’s picture

Status: Needs review » Fixed

We talked via slack - things seem to be fine now, closing this issue.

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.