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

core: fix Image prompt template hardcoded template format #27495

Merged
merged 14 commits into from
Oct 21, 2024

Conversation

chunkanglu
Copy link
Contributor

Fixes #27411

Description: Adds template_format to the ImagePromptTemplate class and updates passing in the template_format parameter from ChatPromptTemplate instead of the hardcoded "f-string".
Also updated docs and typing related to template_format to be more up-to-date and specific.

Dependencies: None

Add tests and docs: Added unit tests to validate fix. Needed to update test_chat snapshot due to adding new attribute template_format in ImagePromptTemplate.

Copy link

vercel bot commented Oct 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 9:24pm

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Oct 20, 2024
Copy link
Contributor

@vbarda vbarda left a comment

Choose a reason for hiding this comment

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

looks good -- thanks for your contribution!

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Oct 21, 2024
@vbarda vbarda merged commit 380449a into langchain-ai:master Oct 21, 2024
74 checks passed
@chunkanglu chunkanglu deleted the jinja-image-prompt-template branch October 21, 2024 21:47
ccurme pushed a commit that referenced this pull request Oct 22, 2024
Fixes #27411 

**Description:** Adds `template_format` to the `ImagePromptTemplate`
class and updates passing in the `template_format` parameter from
ChatPromptTemplate instead of the hardcoded "f-string".
Also updated docs and typing related to `template_format` to be more
up-to-date and specific.

**Dependencies:** None

**Add tests and docs**: Added unit tests to validate fix. Needed to
update `test_chat` snapshot due to adding new attribute
`template_format` in `ImagePromptTemplate`.

---------

Co-authored-by: Vadym Barda <[email protected]>
@@ -1 +1,2 @@
jinja2>=3,<4
mustache>=0.1.4,<1
Copy link
Collaborator

Choose a reason for hiding this comment

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

why was this added? we vendor the implementation of mustache

Copy link
Collaborator

Choose a reason for hiding this comment

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

removing here #27629

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PR looks good. Use to confirm that a PR is ready for merging. size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Image prompt template does not respect template_format and assumes f-string
3 participants