Jinja Template#217
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 20 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #217 +/- ##
==========================================
- Coverage 98.80% 98.51% -0.28%
==========================================
Files 12 12
Lines 1907 1939 +32
Branches 184 189 +5
==========================================
+ Hits 1884 1910 +26
- Misses 5 7 +2
- Partials 18 22 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Two notices:
|
sadrasabouri
left a comment
There was a problem hiding this comment.
Great job! I have minor suggestions on tests.
| def test_render_jinja8(): | ||
| template = PromptTemplate( | ||
| content="{{ greeting }}, {{ name }}!", | ||
| custom_map={"greeting": "Hello"}, | ||
| engine=TemplateEngine.JINJA, | ||
| ) | ||
| assert template.render( | ||
| {"name": "Bob"} | ||
| ) == "Hello, Bob!" | ||
|
|
||
|
|
||
| def test_render_jinja9(): | ||
| template = PromptTemplate( | ||
| content="{{ greeting }}, {{ name }}!", | ||
| custom_map={"greeting": "Hello"}, | ||
| engine=TemplateEngine.JINJA, | ||
| ) | ||
| assert template.render( | ||
| {"greeting": "Hi", "name": "Bob"} | ||
| ) == "Hi, Bob!" |
There was a problem hiding this comment.
these two tests cover the same thing as the first two tests (language). I suggest removing them.
| def test_render_jinja11(): | ||
| template = PromptTemplate( | ||
| content="{{ missing_variable }}", | ||
| engine=TemplateEngine.JINJA, | ||
| ) | ||
| with pytest.raises(MemorRenderError, match="Template and context are incompatible."): | ||
| template.render({}) |
There was a problem hiding this comment.
same for this. I suggest removing this test too.
There was a problem hiding this comment.
This one is a bit different
Reference Issues/PRs
What does this implement/fix? Explain your changes
PromptTemplateclassupdate_enginemethod addedPromptTemplateclassengineproperty addedengineparameter added toPromptTemplateclassREADME.mdupdatedAny other comments?