Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ChatMessage' object has no attribute 'to_openai_format' #269

Closed
JunK4i opened this issue Sep 18, 2024 · 2 comments
Closed

Comments

@JunK4i
Copy link

JunK4i commented Sep 18, 2024

haystack_integrations\tracing\langfuse\tracer.py", line 54, in set_content_tag
messages = [m.to_openai_format() for m in value["messages"]]
^^^^^^^^^^^^^^^^^^
AttributeError: 'ChatMessage' object has no attribute 'to_openai_format'

Deprecated to_openai_format() is causing issues with tracer.py.
Need to update tracer.py from deprecated function to the new function

Deprecated function:
m.to_openai_format()

Update to:
from haystack.components.generators.openai_utils import _convert_message_to_openai_format
_convert_message_to_openai_format(m)

@JunK4i JunK4i changed the title Deprecated to_openai_format() is causing issues with tracer.py AttributeError: 'ChatMessage' object has no attribute 'to_openai_format' Sep 18, 2024
@julian-risch
Copy link
Member

Hello @JunK4i could you please check which version of the langfuse-haystack integration you are using?

We removed the usage of the deprecated ChatMessage.to_openai_format int he following PR a month ago: deepset-ai/haystack-core-integrations#1001 and since then released two new versions of the langfuse-haystack package https://pypi.org/project/langfuse-haystack/#history

@JunK4i
Copy link
Author

JunK4i commented Sep 20, 2024

Alright thanks!

@JunK4i JunK4i closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants