Implement AI orchestration wedding demo

This commit is contained in:
pelpanagiotis
2026-06-27 13:50:11 +03:00
commit 55d4fe95b4
67 changed files with 4736 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
from app.ai.tool_generator import OpenAPIToolGenerator
def test_generates_tools_from_openapi_spec():
spec = {
"paths": {
"/tasks": {
"post": {
"operationId": "create_task",
"summary": "Create task",
"requestBody": {
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/TaskCreate"}
}
}
},
}
}
},
"components": {
"schemas": {
"TaskCreate": {
"type": "object",
"required": ["title"],
"properties": {"title": {"type": "string"}},
}
}
},
}
tools = OpenAPIToolGenerator(spec).generate()
assert tools[0].name == "create_task"
assert tools[0].required == ["title"]
assert tools[0].path == "/tasks"
def test_generates_path_params_for_patch_tools():
spec = {
"paths": {
"/reservations/{reservation_id}": {
"patch": {
"operationId": "update_reservation",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {"status": {"type": "string"}},
}
}
}
},
}
}
}
}
tools = OpenAPIToolGenerator(spec).generate()
assert tools[0].path_params == ["reservation_id"]
assert "reservation_id" in tools[0].schema["required"]