Skip to content

Conversation

@eshwarprasadS
Copy link
Contributor

Fixes #490

Problem

We changed from using simple python string templates to jinja templates, but missed a few places (ConditionalLLMBlock) to account for this change, which went unnoticed due to missing test coverage for this.

The Solution

  • Addresses the problem (change from .format() to .render(), treating the input to _format_prompt() as a jinja Template
  • Adds two unit tests test_format_prompt_with_jinja_templates and test_format_prompt_without_selector that test the behavior of Template.render() based on the inputs. These tests will fail if there are parts of the code that call to _format_prompt() with a python string argument.

Signed-off-by: eshwarprasadS <eshwarprasad.s01@gmail.com>
@mergify mergify bot added testing Relates to testing ci-failure labels Jan 21, 2025
Signed-off-by: eshwarprasadS <eshwarprasad.s01@gmail.com>
@mergify mergify bot removed the ci-failure label Jan 21, 2025
Copy link
Contributor

@bbrowning bbrowning left a comment

Choose a reason for hiding this comment

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

The added code comments help clarify what _format_prompt is doing, and I appreciate you testing all branches of the logic with the multiple test cases. Thanks for the thorough and quick fix here!

@mergify mergify bot added the one-approval label Jan 22, 2025
Copy link
Member

@aakankshaduggal aakankshaduggal left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @eshwarprasadS

@mergify mergify bot merged commit 4134575 into instructlab:main Jan 22, 2025
22 checks passed
@mergify mergify bot removed the one-approval label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConditionalLLMBlock not working with Jinja templates

3 participants