Spaces:
Runtime error
Runtime error
Upload tool
Browse files- app.py +5 -0
- boolean_default_tool.py +14 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from smolagents import launch_gradio_demo
|
2 |
+
from boolean_default_tool import BooleanDefaultTool
|
3 |
+
|
4 |
+
tool = BooleanDefaultTool()
|
5 |
+
launch_gradio_demo(tool)
|
boolean_default_tool.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any, Optional
|
2 |
+
from smolagents.tools import Tool
|
3 |
+
|
4 |
+
class BooleanDefaultTool(Tool):
|
5 |
+
name = "boolean_default_tool"
|
6 |
+
description = "A tool with a boolean default parameter"
|
7 |
+
inputs = {'text': {'type': 'string', 'description': 'Input text'}, 'flag': {'type': 'boolean', 'description': 'Boolean flag with default value', 'nullable': True}}
|
8 |
+
output_type = "string"
|
9 |
+
|
10 |
+
def forward(self, text: str, flag: bool = False) -> str:
|
11 |
+
return f"Text: {text}, Flag: {flag}"
|
12 |
+
|
13 |
+
def __init__(self, *args, **kwargs):
|
14 |
+
self.is_initialized = False
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
smolagents
|