Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
bc9d42a
1
Parent(s): fb0a09c
fix: update tool input/output types to use smolagents allowed types
Browse files
app.py
CHANGED
|
@@ -157,7 +157,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 157 |
class CalculateMinPriceTool(Tool):
|
| 158 |
name = "calculate_min_price"
|
| 159 |
description = "Calculate the minimum price from a list of prices"
|
| 160 |
-
inputs = {'prices': {'type': '
|
| 161 |
output_type = "string"
|
| 162 |
|
| 163 |
def forward(self, prices: list[float]) -> str:
|
|
@@ -168,7 +168,7 @@ class ExtractPriceFromSnippetTool(Tool):
|
|
| 168 |
name = "extract_price_from_snippet"
|
| 169 |
description = "Extract prices from a text snippet"
|
| 170 |
inputs = {'snippet': {'type': 'string', 'description': 'Text containing prices'}}
|
| 171 |
-
output_type = "
|
| 172 |
|
| 173 |
def forward(self, snippet: str) -> list[str]:
|
| 174 |
price_pattern = r'\$\d+(?:,\d{3})*(?:\.\d{2})?|\d+(?:,\d{3})*(?:\.\d{2})?\s*(USD|EUR|GBP|INR|AUD|CAD)?'
|
|
|
|
| 157 |
class CalculateMinPriceTool(Tool):
|
| 158 |
name = "calculate_min_price"
|
| 159 |
description = "Calculate the minimum price from a list of prices"
|
| 160 |
+
inputs = {'prices': {'type': 'array', 'description': 'List of product prices (numbers)'}}
|
| 161 |
output_type = "string"
|
| 162 |
|
| 163 |
def forward(self, prices: list[float]) -> str:
|
|
|
|
| 168 |
name = "extract_price_from_snippet"
|
| 169 |
description = "Extract prices from a text snippet"
|
| 170 |
inputs = {'snippet': {'type': 'string', 'description': 'Text containing prices'}}
|
| 171 |
+
output_type = "array"
|
| 172 |
|
| 173 |
def forward(self, snippet: str) -> list[str]:
|
| 174 |
price_pattern = r'\$\d+(?:,\d{3})*(?:\.\d{2})?|\d+(?:,\d{3})*(?:\.\d{2})?\s*(USD|EUR|GBP|INR|AUD|CAD)?'
|