-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.py
More file actions
70 lines (58 loc) · 1.72 KB
/
Copy pathmain.py
File metadata and controls
70 lines (58 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from fastapi import FastAPI
from pydantic import BaseModel
from typing import List
# Types
class Argument(BaseModel):
id: str
text: str
class RetrievalResponse(BaseModel):
arguments: List[Argument]
class SystemResponse(BaseModel):
utterance: str
response: RetrievalResponse
class UserTurn(BaseModel):
utterance: str
systemResponse: SystemResponse
class Simulation(BaseModel):
userTurns: List[UserTurn]
class Request(BaseModel):
simulation: Simulation
userTurnIndex: int | None = None
app = FastAPI()
# Endpoints, one for each dimension
@app.post("/quantity")
async def respond(request: Request):
if request.userTurnIndex == None:
# overall conversation evaluation not part of this task
return { "score": None }
# return a score below 0.5 for "no" and above for "yes"
return {
"score": 1
}
@app.post("/quality")
async def respond(request: Request):
if request.userTurnIndex == None:
# overall conversation evaluation not part of this task
return { "score": None }
# return a score below 0.5 for "no" and above for "yes"
return {
"score": 1
}
@app.post("/relation")
async def respond(request: Request):
if request.userTurnIndex == None:
# overall conversation evaluation not part of this task
return { "score": None }
# return a score below 0.5 for "no" and above for "yes"
return {
"score": 1
}
@app.post("/manner")
async def respond(request: Request):
if request.userTurnIndex == None:
# overall conversation evaluation not part of this task
return { "score": None }
# return a score below 0.5 for "no" and above for "yes"
return {
"score": 1
}