File size: 775 Bytes
86e971c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Optional
from uuid import uuid4

from pydantic import BaseModel, Field, HttpUrl


class NewItem(BaseModel):
    """A new item to be inserted into the feed"""

    id: str = Field(
        description="A unique ID for the content item. You can generate this.",
        default_factory=uuid4,
    )
    url: HttpUrl = Field(description="The publicly-accessible URL of the content item.")


class RankingResponse(BaseModel):
    """A response to a ranking request"""

    ranked_ids: list[str] = Field(
        description="The IDs of the content items, in the order they should be displayed."
    )
    new_items: Optional[list[NewItem]] = Field(
        description="New publicly-accessible items to be inserted into the feed.",
        default=None,
    )