Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Limit template scope with Agents, closes #1080

davidmezzettifbce87b9eeca
diff --git a/src/python/txtai/agent/base.py b/src/python/txtai/agent/base.py
index 31412957..23463db9 100644
--- a/src/python/txtai/agent/base.py
+++ b/src/python/txtai/agent/base.py
@@ -6,7 +6,7 @@ import os
from collections import deque
-from jinja2 import Template
+from jinja2.sandbox import SandboxedEnvironment
from .factory import ProcessFactory
@@ -50,7 +50,7 @@ class Agent:
self.window = memory
# Create template
- self.template = Template(
+ self.template = SandboxedEnvironment().from_string(
template
if template
else """{{ text }}