Spaces:
Runtime error
Runtime error
Scott Cogan
commited on
Commit
·
885e6d3
1
Parent(s):
82c778f
fix: create proper Tool instance for template validation
Browse files
app.py
CHANGED
|
@@ -88,8 +88,16 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 88 |
logger.debug("Starting template validation...")
|
| 89 |
try:
|
| 90 |
# Create test tools for validation
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
# Validate templates
|
| 95 |
for key, value in prompt_templates.items():
|
|
@@ -109,7 +117,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 109 |
# Create a template with the task variable
|
| 110 |
template = Template(template_str, undefined=StrictUndefined)
|
| 111 |
rendered = template.render(
|
| 112 |
-
tools=test_tools, # Pass
|
| 113 |
task="test",
|
| 114 |
name="test",
|
| 115 |
final_answer="test",
|
|
@@ -134,7 +142,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 134 |
# Create a template with the task variable
|
| 135 |
template = Template(template_str, undefined=StrictUndefined)
|
| 136 |
rendered = template.render(
|
| 137 |
-
tools=test_tools, # Pass
|
| 138 |
task="test",
|
| 139 |
name="test",
|
| 140 |
final_answer="test",
|
|
|
|
| 88 |
logger.debug("Starting template validation...")
|
| 89 |
try:
|
| 90 |
# Create test tools for validation
|
| 91 |
+
class TestTool(Tool):
|
| 92 |
+
name = "test_tool"
|
| 93 |
+
description = "A test tool"
|
| 94 |
+
inputs = {'input': {'type': 'string', 'description': 'Test input'}}
|
| 95 |
+
output_type = "string"
|
| 96 |
+
|
| 97 |
+
def forward(self, input: str) -> str:
|
| 98 |
+
return "test output"
|
| 99 |
+
|
| 100 |
+
test_tools = [TestTool()] # Create a list of tools
|
| 101 |
|
| 102 |
# Validate templates
|
| 103 |
for key, value in prompt_templates.items():
|
|
|
|
| 117 |
# Create a template with the task variable
|
| 118 |
template = Template(template_str, undefined=StrictUndefined)
|
| 119 |
rendered = template.render(
|
| 120 |
+
tools=test_tools, # Pass list of tools
|
| 121 |
task="test",
|
| 122 |
name="test",
|
| 123 |
final_answer="test",
|
|
|
|
| 142 |
# Create a template with the task variable
|
| 143 |
template = Template(template_str, undefined=StrictUndefined)
|
| 144 |
rendered = template.render(
|
| 145 |
+
tools=test_tools, # Pass list of tools
|
| 146 |
task="test",
|
| 147 |
name="test",
|
| 148 |
final_answer="test",
|