|
|
|
@ -84,36 +84,3 @@ class SummarizationRequest(BaseModel):
|
|
|
|
raise ValueError(f"text exceeds maximum length of {max_length}")
|
|
|
|
raise ValueError(f"text exceeds maximum length of {max_length}")
|
|
|
|
return v
|
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ==================== Response Models ====================
|
|
|
|
|
|
|
|
class EntityOutput(BaseModel):
|
|
|
|
|
|
|
|
entity: str
|
|
|
|
|
|
|
|
span: str
|
|
|
|
|
|
|
|
start: int
|
|
|
|
|
|
|
|
end: int
|
|
|
|
|
|
|
|
score: float
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RelationOutput(BaseModel):
|
|
|
|
|
|
|
|
source: EntityOutput
|
|
|
|
|
|
|
|
relation: str
|
|
|
|
|
|
|
|
target: EntityOutput
|
|
|
|
|
|
|
|
score: float
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SummaryOutput(BaseModel):
|
|
|
|
|
|
|
|
text: str
|
|
|
|
|
|
|
|
start: int
|
|
|
|
|
|
|
|
end: int
|
|
|
|
|
|
|
|
score: float
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ==================== Error Response Model ====================
|
|
|
|
|
|
|
|
class ErrorDetail(BaseModel):
|
|
|
|
|
|
|
|
code: str
|
|
|
|
|
|
|
|
message: str
|
|
|
|
|
|
|
|
details: Dict[str, Any] = Field(default_factory=dict)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
|
|
|
|
|
|
error: ErrorDetail
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|