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

unstructured: add missing from_dict method #532

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

anakin87
Copy link
Member

@anakin87 anakin87 commented Mar 4, 2024

from_dict method is missing but it is necessary to properly deserialize the API key.
For example, this fails:

import os
from haystack import default_from_dict
from haystack_integrations.components.converters.unstructured import UnstructuredFileConverter

os.environ["UNSTRUCTURED_API_KEY"] = "test"
conv = UnstructuredFileConverter()

ser_converter = conv.to_dict()

new_conv = default_from_dict(UnstructuredFileConverter, ser_converter)

error:

api_key_value = api_key.resolve_value() if api_key else None
AttributeError: 'dict' object has no attribute 'resolve_value'

I added the missing from_dict method and a related test.

@github-actions github-actions bot added integration:unstructured-fileconverter type:documentation Improvements or additions to documentation labels Mar 4, 2024
@anakin87 anakin87 marked this pull request as ready for review March 4, 2024 15:06
@anakin87 anakin87 requested a review from a team as a code owner March 4, 2024 15:06
@anakin87 anakin87 requested review from masci and davidsbatista and removed request for a team and masci March 4, 2024 15:06
@anakin87 anakin87 merged commit d45cf7c into main Mar 4, 2024
8 checks passed
@anakin87 anakin87 deleted the unstructured-from-dict branch March 4, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:unstructured-fileconverter type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants