| 1 |
from typing import Union, Optional |
| 2 |
from typing_extensions import Literal, Annotated, TypeAlias |
| 3 |
|
| 4 |
from .._models import BaseModel, UnionDiscriminator |
| 5 |
from .citations_config import CitationsConfig |
| 6 |
from .base64_pdf_source import Base64PDFSource |
| 7 |
from .plain_text_source import PlainTextSource |
| 8 |
|
| 9 |
__all__ = ["DocumentBlock", "Source"] |
| 10 |
|
| 11 |
Source: TypeAlias = Annotated[Union[Base64PDFSource, PlainTextSource], UnionDiscriminator("type")] |
| 12 |
|
| 13 |
|
| 14 |
class DocumentBlock(BaseModel): |
| 15 |
citations: Optional[CitationsConfig] = None |
| 16 |
"""Citation configuration for the document""" |
| 17 |
|
| 18 |
source: Source |
| 19 |
|
| 20 |
title: Optional[str] = None |
| 21 |
"""The title of the document""" |
| 22 |
|
| 23 |
type: Literal["document"] |