-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
Core: Added partial functionality to PipelinePromptTemplate #28377
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok. Quickly discussing with team to see what we want to do with PipelinePromptTemplate because it's not that intuitive of an abstraction, and it might make sense to just implement as a RunnableSequence of RunnableAssigns instead...
i.e. I think this does the same thing from my understanding:
keys_and_prompts: list[tuple[str, PromptTemplate]] = ...
chain = RunnablePassthrough()
for key, prompt in keys_and_prompts:
chain = chain | RunnablePassthrough.assign(key, prompt)
chain = chain | lambda x: x[keys_and_prompts[-1][0]]
Sounds good, I wasn't sure if this complied with how PipelinePromptTemplate is 'supposed' to be used but I thought it made sense as a functionality given that the PromptTemplate class implements this function (and PipelinePromptTemplate used a list of these PromptTemplates for its functionality) but I do see how it makes sense through your code. Thanks for taking a look at the code, let me know what you and the team decide! |
Are you using it personally? If so could you check if the code snippet solves your use case? |
No I'm not, I'm just trying to fix the issue #27868 |
got it. I can respond there, and I'll close this because it introduces a new bug, where |
Thank you! |
Description: Added extra logic in the PipelinePromptTemplate to support partial assignments primarily by overriding the partial method from BasePromptTemplate
Issue: Fixes issue #27868
Dependencies: No dependencies required or new dependencies added
Add tests
Added test in test_pipeline_prompt.py to check for this case.
Lint and test: Done