-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Component names should be parsed into component serialization methods during pipeline serialization #7763
Comments
Unless I'm misunderstanding your problem, you use a |
Hello @shadeMe, thanks for your reply and sorry for the delay. My goal is to create a customized My ideal pattern for saving these prompts would be something like haystack/haystack/core/pipeline/base.py Lines 120 to 121 in 3db56d9
|
Is your feature request related to a problem? Please describe.
Hello, I was experimenting with pipeline serialization in one of my projects that includes multiple prompt builders and LLM calls. I decided to save these prompt templates in separate Jinja files along with the main pipeline YAML during the serialization process (to allow prompt template versioning without making significant changes to the pipeline YAML). However, I realized that the component has no way to identify its name in the pipeline during the serialization process. In my case, I have to generate random UUIDs for the templates, which negatively impacts readability (and it also hurts if serialization occurs more than once when testing). I also believe there should be a way for the components to obtain their names in the pipeline.
Expected behavior (for this particular problem):
Describe the solution you'd like
I haven't come up with a perfect solution yet. My initial thought is to introduce an optional parameter, like
component_name
, in the component'sto_dict()
method. However, this would be a breaking change as all components would need to update their method definitions even if they do not use the component name. A less invasive but somewhat hacky approach is to update the behavior ofhaystack.core.serialization.component_to_dict(obj)
, so it either checks the method definition ofcomponent.to_dict()
or simply calls another method to achieve the desired functionality. Both options seem a bit too hacky to me, and I am not sure if there is a better solution.Describe alternatives you've considered
I need to customize my PromptBuilder components anyway, so I think I could enforce a name parameter when initializing the instance. This is not ideal but still doable.
edited: fix grammar and improve overall writing
The text was updated successfully, but these errors were encountered: