Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
d688122
1
Parent(s): 26cf521
fix: use proper tool objects in template validation
Browse files
app.py
CHANGED
|
@@ -87,6 +87,11 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 87 |
|
| 88 |
logger.debug("Starting template validation...")
|
| 89 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
# Validate templates
|
| 91 |
for key, value in prompt_templates.items():
|
| 92 |
if isinstance(value, dict):
|
|
@@ -105,7 +110,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 105 |
# Create a template with the task variable
|
| 106 |
template = Template(template_str, undefined=StrictUndefined)
|
| 107 |
rendered = template.render(
|
| 108 |
-
tools=
|
| 109 |
task="test",
|
| 110 |
name="test",
|
| 111 |
final_answer="test",
|
|
@@ -130,7 +135,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 130 |
# Create a template with the task variable
|
| 131 |
template = Template(template_str, undefined=StrictUndefined)
|
| 132 |
rendered = template.render(
|
| 133 |
-
tools=
|
| 134 |
task="test",
|
| 135 |
name="test",
|
| 136 |
final_answer="test",
|
|
|
|
| 87 |
|
| 88 |
logger.debug("Starting template validation...")
|
| 89 |
try:
|
| 90 |
+
# Create test tools for validation
|
| 91 |
+
test_tools = [
|
| 92 |
+
type('Tool', (), {'name': 'test_tool', 'description': 'A test tool'})()
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
# Validate templates
|
| 96 |
for key, value in prompt_templates.items():
|
| 97 |
if isinstance(value, dict):
|
|
|
|
| 110 |
# Create a template with the task variable
|
| 111 |
template = Template(template_str, undefined=StrictUndefined)
|
| 112 |
rendered = template.render(
|
| 113 |
+
tools=test_tools,
|
| 114 |
task="test",
|
| 115 |
name="test",
|
| 116 |
final_answer="test",
|
|
|
|
| 135 |
# Create a template with the task variable
|
| 136 |
template = Template(template_str, undefined=StrictUndefined)
|
| 137 |
rendered = template.render(
|
| 138 |
+
tools=test_tools,
|
| 139 |
task="test",
|
| 140 |
name="test",
|
| 141 |
final_answer="test",
|