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

deserialize_callable is not working for local files #8647

Open
1 task done
LastRemote opened this issue Dec 17, 2024 · 2 comments · May be fixed by #8648
Open
1 task done

deserialize_callable is not working for local files #8647

LastRemote opened this issue Dec 17, 2024 · 2 comments · May be fixed by #8648
Labels
P2 Medium priority, add to the next sprint if no P1 available

Comments

@LastRemote
Copy link
Contributor

Describe the bug
deserialize_callable is not working for local files that are not included in sys.modules

Error message

haystack.core.errors.DeserializationError: Could not locate the module of the callable: app.components.c4610c22_3b58_47c2_ba7f_33923bdc662f

Expected behavior
deserialize_callable should respect local imports (from app.components.c4610c22_3b58_47c2_ba7f_33923bdc662f import my_function)

Additional context

To Reproduce
Deserialize a local function using deserialize_callable

FAQ Check

System:
Irrelevant

@LastRemote LastRemote linked a pull request Dec 17, 2024 that will close this issue
@anakin87
Copy link
Member

Hey!

Can you provide a simple example so that I can reproduce the problem?

@LastRemote
Copy link
Contributor Author

LastRemote commented Dec 17, 2024

Can you provide a simple example so that I can reproduce the problem?

@anakin87

mkdir temp
cd temp
echo "def foo(): return 0" >> example_callable.py
echo "from haystack.utils.callable_serialization import deserialize_callable; deserialize_callable('example_callable.foo')" >> test.py
python test.py

This would fail the deserialization (don't use IDEs since they take care of modules and PYTHONPATH automatically)

haystack.core.errors.DeserializationError: Could not locate the module of the callable: example_callable

@julian-risch julian-risch added the P2 Medium priority, add to the next sprint if no P1 available label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Medium priority, add to the next sprint if no P1 available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants