Graphify / schemas.py
Game4all's picture
Add prompts for intent classification
dbbd5e7
raw
history blame
1.65 kB
from pydantic import BaseModel, Field
# ============================================= Entity + Relations extraction
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]
# ======================================================== Create search plan ==================
class CreateSearchPlanRequest(BaseModel):
query: str
class CreateSearchPlanResponse(BaseModel):
sub_queries: list[str] = Field(...,
description="A list of subqueries formulated as questions")
# ======================================================= Determine intent =========================
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]