|
from pydantic import BaseModel, Field |
|
|
|
|
|
|
|
|
|
class ExtractEntitiesRequest(BaseModel): |
|
content: str |
|
|
|
|
|
class ExtractEntitiesResponse(BaseModel): |
|
entities: list[str] = Field(..., description="A list of entities") |
|
|
|
|
|
class ExtractedRelation(BaseModel): |
|
start: str = Field(..., description="The first entity in the relationship") |
|
to: str = Field(..., description="The second entity of the relationship") |
|
tag: str = Field(..., description="A tag describing the relationship", examples=[ |
|
"related_to", "born_in", "made", "created"]) |
|
description: str = Field(..., |
|
description="A detailled description of the relationship") |
|
|
|
|
|
class ExtractedRelationsResponse(BaseModel): |
|
relations: list[ExtractedRelation] |
|
|
|
|
|
|
|
|
|
class CreateSearchPlanRequest(BaseModel): |
|
query: str |
|
|
|
|
|
class CreateSearchPlanResponse(BaseModel): |
|
sub_queries: list[str] = Field(..., |
|
description="A list of subqueries formulated as questions") |
|
|
|
|
|
|
|
|
|
class Intent(BaseModel): |
|
target_entity: str = Field( |
|
..., description="One of the entities required to fulfil the user intent") |
|
target_relations: list[str] = Field( |
|
..., description="A list of one or multiple types of relations required to fulfil the user intent") |
|
|
|
|
|
class ExtractedIntentReponse(BaseModel): |
|
intents: list[Intent] |
|
|