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

fix: PendingRequest refactor regressions #146

Merged
merged 3 commits into from
Jan 25, 2025

Conversation

ChrisB-TL
Copy link
Contributor

@ChrisB-TL ChrisB-TL commented Jan 23, 2025

Regression 1 - exception thrown if you use toRequest() more than once

If you run toRequest() on a PendingRequest before generate() - e.g. to inspect the request before running it - you trigger a promptOrMessage exception as it populates the messages property on the first run.

Fixed by manipulating a variable rather than the property.

Regression 2 - Text Generator not adding system prompt to first step

Previously, a system prompt would be included in the first step's messages array. This PR reinstates it.

Regression 3 - Structured Generator not adding system prompt or prompt to first step

Similar to above, but also applies to the user prompt.

@ChrisB-TL ChrisB-TL marked this pull request as draft January 23, 2025 20:03
@ChrisB-TL
Copy link
Contributor Author

ChrisB-TL commented Jan 23, 2025

I've noticed a couple of other regressions from the PendingRequest refactor, so I have expanded this PR to cover them also.

@ChrisB-TL ChrisB-TL changed the title [Fix] Exception running toRequest() more than once Fix PendingRequest refactor regressions Jan 23, 2025
@ChrisB-TL ChrisB-TL marked this pull request as ready for review January 23, 2025 20:21
@sixlive sixlive changed the title Fix PendingRequest refactor regressions fix: PendingRequest refactor regressions Jan 25, 2025
@sixlive sixlive self-requested a review January 25, 2025 15:43
Copy link
Contributor

@sixlive sixlive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!! That refactor has bit me a few times now but I think it was worth it!

@sixlive sixlive merged commit 0b9c843 into prism-php:main Jan 25, 2025
6 checks passed
@ChrisB-TL ChrisB-TL deleted the fix-to-request branch January 26, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants