feat: support LLM jinja2 template prompt (#3968)
Co-authored-by: Joel <iamjoel007@gmail.com>
This commit is contained in:
parent
897e07f639
commit
8578ee0864
8 changed files with 325 additions and 41 deletions
17
api/core/helper/code_executor/jinja2_formatter.py
Normal file
17
api/core/helper/code_executor/jinja2_formatter.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from core.helper.code_executor.code_executor import CodeExecutor
|
||||
|
||||
|
||||
class Jinja2Formatter:
|
||||
@classmethod
|
||||
def format(cls, template: str, inputs: str) -> str:
|
||||
"""
|
||||
Format template
|
||||
:param template: template
|
||||
:param inputs: inputs
|
||||
:return:
|
||||
"""
|
||||
result = CodeExecutor.execute_workflow_code_template(
|
||||
language='jinja2', code=template, inputs=inputs
|
||||
)
|
||||
|
||||
return result['result']
|
||||
Loading…
Add table
Add a link
Reference in a new issue