chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from .add import add
|
||||
|
||||
tools = {
|
||||
add["name"] : add
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
from .schema import AddInputModel
|
||||
|
||||
async def add_handler(args) -> float:
|
||||
try:
|
||||
# Validate input using Pydantic model
|
||||
input_model = AddInputModel(**args)
|
||||
except Exception as e:
|
||||
raise ValueError(f"Invalid input: {str(e)}")
|
||||
|
||||
# TODO: add Pydantic, so we can create an AddInputModel and validate args
|
||||
|
||||
"""Handler function for the add tool."""
|
||||
return float(input_model.a) + float(input_model.b)
|
||||
|
||||
add = {
|
||||
"name": "add",
|
||||
"description": "Adds two numbers",
|
||||
"input_schema": AddInputModel,
|
||||
"handler": add_handler
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
class AddInputModel(BaseModel):
|
||||
a: float
|
||||
b: float
|
||||
Reference in New Issue
Block a user