|
8 | 8 |
|
9 | 9 | __all__ = [ |
10 | 10 | "ChatCompletionMessage", |
| 11 | + "Annotation", |
| 12 | + "AnnotationDocumentCitation", |
| 13 | + "AnnotationFunctionCitation", |
11 | 14 | "ExecutedTool", |
12 | 15 | "ExecutedToolBrowserResult", |
13 | 16 | "ExecutedToolCodeResult", |
|
19 | 22 | ] |
20 | 23 |
|
21 | 24 |
|
| 25 | +class AnnotationDocumentCitation(BaseModel): |
| 26 | + document_id: str |
| 27 | + """ |
| 28 | + The ID of the document being cited, corresponding to a document provided in the |
| 29 | + request. |
| 30 | + """ |
| 31 | + |
| 32 | + end_index: int |
| 33 | + """The character index in the message content where this citation ends.""" |
| 34 | + |
| 35 | + start_index: int |
| 36 | + """The character index in the message content where this citation begins.""" |
| 37 | + |
| 38 | + |
| 39 | +class AnnotationFunctionCitation(BaseModel): |
| 40 | + end_index: int |
| 41 | + """The character index in the message content where this citation ends.""" |
| 42 | + |
| 43 | + start_index: int |
| 44 | + """The character index in the message content where this citation begins.""" |
| 45 | + |
| 46 | + tool_call_id: str |
| 47 | + """ |
| 48 | + The ID of the tool call being cited, corresponding to a tool call made during |
| 49 | + the conversation. |
| 50 | + """ |
| 51 | + |
| 52 | + |
| 53 | +class Annotation(BaseModel): |
| 54 | + type: Literal["document_citation", "function_citation"] |
| 55 | + """The type of annotation.""" |
| 56 | + |
| 57 | + document_citation: Optional[AnnotationDocumentCitation] = None |
| 58 | + """A citation referencing a specific document that was provided in the request.""" |
| 59 | + |
| 60 | + function_citation: Optional[AnnotationFunctionCitation] = None |
| 61 | + """A citation referencing the result of a function or tool call.""" |
| 62 | + |
| 63 | + |
22 | 64 | class ExecutedToolBrowserResult(BaseModel): |
23 | 65 | title: str |
24 | 66 | """The title of the browser window""" |
@@ -189,6 +231,12 @@ class ChatCompletionMessage(BaseModel): |
189 | 231 | role: Literal["assistant"] |
190 | 232 | """The role of the author of this message.""" |
191 | 233 |
|
| 234 | + annotations: Optional[List[Annotation]] = None |
| 235 | + """ |
| 236 | + A list of annotations providing citations and references for the content in the |
| 237 | + message. |
| 238 | + """ |
| 239 | + |
192 | 240 | executed_tools: Optional[List[ExecutedTool]] = None |
193 | 241 | """ |
194 | 242 | A list of tools that were executed during the chat completion for compound AI |
|
0 commit comments