open-webui / pipelines

Pipelines: Versatile, UI-Agnostic OpenAI-Compatible Plugin Framework
MIT License
1.03k stars 321 forks source link

langfuse_filter_pipeline.py 'str' object has no attribute 'get' #267

Closed sao-coding closed 2 months ago

sao-coding commented 2 months ago

langfuse_filter_pipeline.py is error

'str' object has no attribute 'get'

image image image

baguilartech commented 2 months ago

This is a workaround, I have a self-hosted LangFuse instance and was running into the same error in the UI and in my docker container.

I uploaded this .py to open-webui and replaced it in the pipelines container folder as well: https://github.com/karaketir16/openwebui-langfuse/blob/master/example/langfuse_filter_pipeline.py

image

marcklingen commented 2 months ago

-- langfuse maintainer here

This is not an issue that we see across integrations, happy to help with resolution of this issue.

rossm-mf commented 2 months ago

I got the same issue with latest pipelines using the v1.3 found here https://raw.githubusercontent.com/open-webui/pipelines/refs/heads/main/examples/filters/langfuse_filter_pipeline.py

it seems that the workaround is aiming at older version of the filter v1.1 https://raw.githubusercontent.com/karaketir16/openwebui-langfuse/refs/heads/master/example/langfuse_filter_pipeline.py

what ever was posted on the main repo as example then is not properly working with the latest langfuse

rossm-mf commented 2 months ago

I looked around and it seems to be this line info = assistant_message.get("info", {})

the assistant message has not attribut info. only a string on message

marcklingen commented 2 months ago

I looked around and it seems to be this line info = assistant_message.get("info", {})

the assistant message has not attribut info. only a string on message

working on a fix right now, will raise a PR once done

marcklingen commented 2 months ago

@sao-coding can you check whether this issue is fixed with the latest version of the example?

rossm-mf commented 2 months ago

I can confirm on my side already that it's fixed

langfuse 2.71 with openwebui 0.3.29

marcklingen commented 2 months ago

awesome, glad that it works again. this was on me, broke this with my latest edit to the example. Now the token counts should be tracked correctly to support cost tracking in Langfuse for openwebui usage