File size: 393 Bytes
50aa44f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import Literal

from pydantic import BaseModel


class PositionInput(BaseModel):
    position_text: str
    length: int
    offset: int


class EntityInput(BaseModel):
    entity_id: int
    entity_text: str
    entity_type: Literal["company", "location"]
    positions: list[PositionInput]


class SampleInput(BaseModel):
    id: int
    text: str
    entities: list[EntityInput]