Updated the api spec to include COT object

This commit is contained in:
Yukt Mitash 2025-03-10 14:31:06 -07:00
parent 0b8cb830b9
commit 5388d212bc
3 changed files with 60 additions and 2 deletions

View file

@ -3706,6 +3706,28 @@
],
"title": "AppendRowsRequest"
},
"ChainOfThoughtContentItem": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "chainOfThought",
"default": "chainOfThought",
"description": "Discriminator type of the content item. Always \"ChainOfThought\""
},
"text": {
"type": "string",
"description": "Chain of Thought content"
}
},
"additionalProperties": false,
"required": [
"type",
"text"
],
"title": "ChainOfThoughtContentItem",
"description": "A Chain of Thought content item"
},
"CompletionMessage": {
"type": "object",
"properties": {
@ -3861,13 +3883,17 @@
},
{
"$ref": "#/components/schemas/TextContentItem"
},
{
"$ref": "#/components/schemas/ChainOfThoughtContentItem"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"image": "#/components/schemas/ImageContentItem",
"text": "#/components/schemas/TextContentItem"
"text": "#/components/schemas/TextContentItem",
"chainOfThought": "#/components/schemas/ChainOfThoughtContentItem"
}
}
},

View file

@ -2518,6 +2518,24 @@ components:
- dataset_id
- rows
title: AppendRowsRequest
ChainOfThoughtContentItem:
type: object
properties:
type:
type: string
const: chainOfThought
default: chainOfThought
description: >-
Discriminator type of the content item. Always "ChainOfThought"
text:
type: string
description: Chain of Thought content
additionalProperties: false
required:
- type
- text
title: ChainOfThoughtContentItem
description: A Chain of Thought content item
CompletionMessage:
type: object
properties:
@ -2637,11 +2655,13 @@ components:
oneOf:
- $ref: '#/components/schemas/ImageContentItem'
- $ref: '#/components/schemas/TextContentItem'
- $ref: '#/components/schemas/ChainOfThoughtContentItem'
discriminator:
propertyName: type
mapping:
image: '#/components/schemas/ImageContentItem'
text: '#/components/schemas/TextContentItem'
chainOfThought: '#/components/schemas/ChainOfThoughtContentItem'
JsonSchemaResponseFormat:
type: object
properties:

View file

@ -50,6 +50,18 @@ class ImageContentItem(BaseModel):
image: _URLOrData
@json_schema_type
class ChainOfThoughtContentItem(BaseModel):
"""A Chain of Thought content item
:param type: Discriminator type of the content item. Always "ChainOfThought"
:param text: Chain of Thought content
"""
type: Literal["chainOfThought"] = "chainOfThought"
text: str
@json_schema_type
class TextContentItem(BaseModel):
"""A text content item
@ -65,7 +77,7 @@ class TextContentItem(BaseModel):
# other modalities can be added here
InterleavedContentItem = register_schema(
Annotated[
Union[ImageContentItem, TextContentItem],
Union[ImageContentItem, TextContentItem, ChainOfThoughtContentItem],
Field(discriminator="type"),
],
name="InterleavedContentItem",