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

Serialization issues with LLMEvaluator and child classes #7768

Closed
anakin87 opened this issue May 30, 2024 · 0 comments · Fixed by #7818
Closed

Serialization issues with LLMEvaluator and child classes #7768

anakin87 opened this issue May 30, 2024 · 0 comments · Fixed by #7818
Assignees
Labels
P1 High priority, add to the next sprint type:bug Something isn't working

Comments

@anakin87
Copy link
Member

I'm encountering issues with serializing LLMEvaluator and child classes (ContextRelevanceEvaluator, FaithfulnessEvaluator).

To Reproduce

from haystack import Pipeline
from haystack.components.evaluators import FaithfulnessEvaluator

pipeline = Pipeline()
pipeline.add_component("ev", FaithfulnessEvaluator())

pipeline.dumps()
Error message
Traceback (most recent call last):
  File "ev.py", line 7, in 
    pipeline.dumps()
  File "/home/anakin87/apps/haystack/haystack/core/pipeline/base.py", line 202, in dumps
    return marshaller.marshal(self.to_dict())
  File "/home/anakin87/apps/haystack/haystack/marshal/yaml.py", line 13, in marshal
    return yaml.dump(dict_)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/__init__.py", line 253, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/__init__.py", line 241, in dump_all
    dumper.represent(data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 27, in represent
    node = self.represent_data(data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 199, in represent_list
    return self.represent_sequence('tag:yaml.org,2002:seq', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 92, in represent_sequence
    node_item = self.represent_data(item)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 286, in represent_tuple
    return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 92, in represent_sequence
    node_item = self.represent_data(item)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 52, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 346, in represent_object
    return self.represent_sequence(tag+function_name, args)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 92, in represent_sequence
    node_item = self.represent_data(item)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 52, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/home/anakin87/apps/haystack/.hatch/haystack-ai/lib/python3.8/site-packages/yaml/representer.py", line 331, in represent_object
    if function.__name__ == '__newobj__':
AttributeError: 'str' object has no attribute '__name__'

Additional context
I encountered several problems, discussed a bit with Massi.

System:

  • Haystack version (commit or version number): 2.1.2
@anakin87 anakin87 added the type:bug Something isn't working label May 30, 2024
@masci masci added the P1 High priority, add to the next sprint label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority, add to the next sprint type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants