|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from typing import Dict, List, Union, Optional |
| 6 | +from datetime import datetime |
| 7 | +from typing_extensions import Literal |
| 8 | + |
| 9 | +from ..scores import Scores |
| 10 | +from ..._compat import PYDANTIC_V2 |
| 11 | +from ..._models import BaseModel |
| 12 | + |
| 13 | +__all__ = ["Collection", "Document", "DocumentEvent", "DocumentSection"] |
| 14 | + |
| 15 | + |
| 16 | +class DocumentEvent(BaseModel): |
| 17 | + message: str |
| 18 | + |
| 19 | + type: Literal["error", "warning", "info"] |
| 20 | + |
| 21 | + time: Optional[datetime] = None |
| 22 | + |
| 23 | + |
| 24 | +class DocumentSection(BaseModel): |
| 25 | + document_id: int |
| 26 | + |
| 27 | + text: str |
| 28 | + """Summary of the section""" |
| 29 | + |
| 30 | + id: Optional[int] = None |
| 31 | + |
| 32 | + content: Optional[str] = None |
| 33 | + |
| 34 | + elements: Optional[List[object]] = None |
| 35 | + |
| 36 | + embedding_e5_large: Optional[List[float]] = None |
| 37 | + |
| 38 | + embedding_ts: Optional[str] = None |
| 39 | + |
| 40 | + metadata: Optional[Dict[str, object]] = None |
| 41 | + |
| 42 | + scores: Optional[Scores] = None |
| 43 | + |
| 44 | + |
| 45 | +class Document(BaseModel): |
| 46 | + collection_id: int |
| 47 | + |
| 48 | + data: Union[List[object], object] |
| 49 | + """Structured representation of the document""" |
| 50 | + |
| 51 | + summary: str |
| 52 | + """Summary of the document""" |
| 53 | + |
| 54 | + id: Optional[int] = None |
| 55 | + |
| 56 | + collection: Optional[str] = None |
| 57 | + |
| 58 | + created_at: Optional[datetime] = None |
| 59 | + |
| 60 | + events: Optional[List[DocumentEvent]] = None |
| 61 | + |
| 62 | + ingested_at: Optional[datetime] = None |
| 63 | + |
| 64 | + metadata: Optional[Dict[str, object]] = None |
| 65 | + |
| 66 | + resource_id: Optional[str] = None |
| 67 | + """Along with service, uniquely identifies the source document""" |
| 68 | + |
| 69 | + sections: Optional[List[DocumentSection]] = None |
| 70 | + |
| 71 | + sections_count: Optional[int] = None |
| 72 | + |
| 73 | + source: Optional[Literal["generic", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]] = None |
| 74 | + |
| 75 | + status: Optional[Literal["pending", "processing", "completed", "failed"]] = None |
| 76 | + |
| 77 | + title: Optional[str] = None |
| 78 | + |
| 79 | + type: Optional[ |
| 80 | + Literal[ |
| 81 | + "generic", |
| 82 | + "markdown", |
| 83 | + "chat", |
| 84 | + "email", |
| 85 | + "transcript", |
| 86 | + "legal", |
| 87 | + "website", |
| 88 | + "image", |
| 89 | + "pdf", |
| 90 | + "audio", |
| 91 | + "spreadsheet", |
| 92 | + "archive", |
| 93 | + "book", |
| 94 | + "video", |
| 95 | + "code", |
| 96 | + "calendar", |
| 97 | + "json", |
| 98 | + "presentation", |
| 99 | + "unsupported", |
| 100 | + "person", |
| 101 | + "company", |
| 102 | + "crm_contact", |
| 103 | + ] |
| 104 | + ] = None |
| 105 | + |
| 106 | + |
| 107 | +class Collection(BaseModel): |
| 108 | + app_id: int |
| 109 | + |
| 110 | + name: str |
| 111 | + |
| 112 | + id: Optional[int] = None |
| 113 | + |
| 114 | + app: Optional["App"] = None |
| 115 | + """Apps Base Schema.""" |
| 116 | + |
| 117 | + created_at: Optional[datetime] = None |
| 118 | + |
| 119 | + documents: Optional[List[Document]] = None |
| 120 | + |
| 121 | + documents_count: Optional[int] = None |
| 122 | + |
| 123 | + owner: Optional[str] = None |
| 124 | + |
| 125 | + |
| 126 | +from .app import App |
| 127 | + |
| 128 | +if PYDANTIC_V2: |
| 129 | + Collection.model_rebuild() |
| 130 | + Document.model_rebuild() |
| 131 | + DocumentEvent.model_rebuild() |
| 132 | + DocumentSection.model_rebuild() |
| 133 | +else: |
| 134 | + Collection.update_forward_refs() # type: ignore |
| 135 | + Document.update_forward_refs() # type: ignore |
| 136 | + DocumentEvent.update_forward_refs() # type: ignore |
| 137 | + DocumentSection.update_forward_refs() # type: ignore |
0 commit comments