diff --git a/langfuse/model.py b/langfuse/model.py index 42e8fe844..b6a81b32f 100644 --- a/langfuse/model.py +++ b/langfuse/model.py @@ -76,7 +76,8 @@ def _get_langchain_prompt_string(content: str): return re.sub(r"\{\{(.*?)\}\}", r"{\g<1>}", content) @staticmethod - def _compile_template_string(content: str, **kwargs) -> str: + def _compile_template_string(*args, **kwargs) -> str: + content = args[0] opening = "{{" closing = "}}" diff --git a/tests/test_prompt_compilation.py b/tests/test_prompt_compilation.py index d26b72835..c8b532157 100644 --- a/tests/test_prompt_compilation.py +++ b/tests/test_prompt_compilation.py @@ -169,3 +169,13 @@ def test_unescaped_JSON_variable_value(): ) def test_various_templates(template, kwargs, expected): assert BasePromptClient._compile_template_string(template, **kwargs) == expected + + +def test_content_var(): + template = "Hello, {{content}}!" + expected = "Hello, Thomas!" + + assert ( + BasePromptClient._compile_template_string(template, content="Thomas") + == expected + )