52 lines
1.0 KiB
Python
52 lines
1.0 KiB
Python
# Agenten Plattform
|
|
#
|
|
# (c) 2024 Magnus Bender
|
|
# Institute of Humanities-Centered Artificial Intelligence (CHAI)
|
|
# Universitaet Hamburg
|
|
# https://www.chai.uni-hamburg.de/~bender
|
|
#
|
|
# source code released under the terms of GNU Public License Version 3
|
|
# https://www.gnu.org/licenses/gpl-3.0.txt
|
|
|
|
# TEST ONLY
|
|
|
|
from ums.utils import AgentMessage, RiddleData, RiddleDataType, RiddleSolution
|
|
|
|
from typing import Union
|
|
|
|
from fastapi import FastAPI
|
|
|
|
app = FastAPI()
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"Hello": "World"}
|
|
|
|
@app.get("/test")
|
|
def huhu():
|
|
ex = AgentMessage(
|
|
id="ex1",
|
|
riddle={
|
|
"context":"Example 1",
|
|
"question":"Get the name of the person."
|
|
},
|
|
data=[
|
|
RiddleData(
|
|
type=RiddleDataType.TEXT,
|
|
file_plain="./cv.txt"
|
|
)
|
|
]
|
|
)
|
|
ex.status.extract.required = False
|
|
|
|
ex.solution = RiddleSolution(
|
|
solution="Otto",
|
|
explanation="Written in line 6 after 'Name:'"
|
|
)
|
|
|
|
return ex
|
|
|
|
|
|
@app.get("/items/{item_id}")
|
|
def read_item(item_id: int, q: Union[str, None] = None):
|
|
return {"item_id": item_id, "q": q} |