From 7c860c90cf3e4a741cfc2b0e13697b08cba25860 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sat, 20 Apr 2024 12:52:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20v0.3.3=20-=20fix=20jinja?= =?UTF-8?q?=20format=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- src/funcchain/backend/prompt.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index edbcd7c..c178876 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "funcchain" -version = "0.3.2" +version = "0.3.3" description = "🔖 write prompts as python functions" authors = [{ name = "Shroominic", email = "contact@shroominic.com" }] dependencies = [ diff --git a/src/funcchain/backend/prompt.py b/src/funcchain/backend/prompt.py index 4cb2131..fbf624e 100644 --- a/src/funcchain/backend/prompt.py +++ b/src/funcchain/backend/prompt.py @@ -23,6 +23,9 @@ def create_instruction_prompt( ) -> "HumanImageMessagePromptTemplate": template_format = _determine_format(instruction) + if template_format == "jinja2" and "\n{format_instructions}" in instruction: + instruction = instruction.replace("\n{format_instructions}", "\n{{ format_instructions }}") + required_f_str_vars = _extract_template_vars(instruction, template_format) _filter_fstring_vars(input_kwargs)