add schema type register

This commit is contained in:
Xi Yan 2025-01-14 18:08:30 -08:00
parent 89e3f81520
commit 4f3fd22dd4
3 changed files with 114 additions and 59 deletions

View file

@ -4228,47 +4228,53 @@
"ContentDelta": { "ContentDelta": {
"oneOf": [ "oneOf": [
{ {
"type": "object", "$ref": "#/components/schemas/TextDelta"
"properties": {
"type": {
"type": "string",
"const": "text",
"default": "text"
},
"text": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"text"
]
}, },
{ {
"type": "object", "$ref": "#/components/schemas/ImageDelta"
"properties": {
"type": {
"type": "string",
"const": "image",
"default": "image"
},
"data": {
"type": "string",
"contentEncoding": "base64"
}
},
"additionalProperties": false,
"required": [
"type",
"data"
]
}, },
{ {
"$ref": "#/components/schemas/ToolCallDelta" "$ref": "#/components/schemas/ToolCallDelta"
} }
] ]
}, },
"ImageDelta": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "image",
"default": "image"
},
"data": {
"type": "string",
"contentEncoding": "base64"
}
},
"additionalProperties": false,
"required": [
"type",
"data"
]
},
"TextDelta": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text",
"default": "text"
},
"text": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"text"
]
},
"TokenLogProbs": { "TokenLogProbs": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -7261,6 +7267,9 @@
"shuffle": { "shuffle": {
"type": "boolean" "type": "boolean"
}, },
"data_format": {
"$ref": "#/components/schemas/DatasetFormat"
},
"validation_dataset_id": { "validation_dataset_id": {
"type": "string" "type": "string"
}, },
@ -7277,7 +7286,15 @@
"required": [ "required": [
"dataset_id", "dataset_id",
"batch_size", "batch_size",
"shuffle" "shuffle",
"data_format"
]
},
"DatasetFormat": {
"type": "string",
"enum": [
"instruct",
"dialog"
] ]
}, },
"EfficiencyConfig": { "EfficiencyConfig": {
@ -8827,6 +8844,10 @@
"name": "Dataset", "name": "Dataset",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Dataset\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/Dataset\" />"
}, },
{
"name": "DatasetFormat",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DatasetFormat\" />"
},
{ {
"name": "DatasetIO" "name": "DatasetIO"
}, },
@ -8895,6 +8916,10 @@
"name": "ImageContentItem", "name": "ImageContentItem",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ImageContentItem\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/ImageContentItem\" />"
}, },
{
"name": "ImageDelta",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ImageDelta\" />"
},
{ {
"name": "Inference" "name": "Inference"
}, },
@ -9243,6 +9268,10 @@
"name": "TextContentItem", "name": "TextContentItem",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/TextContentItem\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/TextContentItem\" />"
}, },
{
"name": "TextDelta",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/TextDelta\" />"
},
{ {
"name": "TokenLogProbs", "name": "TokenLogProbs",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/TokenLogProbs\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/TokenLogProbs\" />"
@ -9444,6 +9473,7 @@
"DPOAlignmentConfig", "DPOAlignmentConfig",
"DataConfig", "DataConfig",
"Dataset", "Dataset",
"DatasetFormat",
"DeleteAgentsRequest", "DeleteAgentsRequest",
"DeleteAgentsSessionRequest", "DeleteAgentsSessionRequest",
"EfficiencyConfig", "EfficiencyConfig",
@ -9458,6 +9488,7 @@
"GraphMemoryBankParams", "GraphMemoryBankParams",
"HealthInfo", "HealthInfo",
"ImageContentItem", "ImageContentItem",
"ImageDelta",
"InferenceStep", "InferenceStep",
"InsertDocumentsRequest", "InsertDocumentsRequest",
"InterleavedContent", "InterleavedContent",
@ -9536,6 +9567,7 @@
"SyntheticDataGenerationResponse", "SyntheticDataGenerationResponse",
"SystemMessage", "SystemMessage",
"TextContentItem", "TextContentItem",
"TextDelta",
"TokenLogProbs", "TokenLogProbs",
"Tool", "Tool",
"ToolCall", "ToolCall",

View file

@ -570,31 +570,8 @@ components:
type: object type: object
ContentDelta: ContentDelta:
oneOf: oneOf:
- additionalProperties: false - $ref: '#/components/schemas/TextDelta'
properties: - $ref: '#/components/schemas/ImageDelta'
text:
type: string
type:
const: text
default: text
type: string
required:
- type
- text
type: object
- additionalProperties: false
properties:
data:
contentEncoding: base64
type: string
type:
const: image
default: image
type: string
required:
- type
- data
type: object
- $ref: '#/components/schemas/ToolCallDelta' - $ref: '#/components/schemas/ToolCallDelta'
CreateAgentRequest: CreateAgentRequest:
additionalProperties: false additionalProperties: false
@ -680,6 +657,8 @@ components:
properties: properties:
batch_size: batch_size:
type: integer type: integer
data_format:
$ref: '#/components/schemas/DatasetFormat'
dataset_id: dataset_id:
type: string type: string
packed: packed:
@ -696,6 +675,7 @@ components:
- dataset_id - dataset_id
- batch_size - batch_size
- shuffle - shuffle
- data_format
type: object type: object
Dataset: Dataset:
additionalProperties: false additionalProperties: false
@ -735,6 +715,11 @@ components:
- url - url
- metadata - metadata
type: object type: object
DatasetFormat:
enum:
- instruct
- dialog
type: string
DeleteAgentsRequest: DeleteAgentsRequest:
additionalProperties: false additionalProperties: false
properties: properties:
@ -960,6 +945,20 @@ components:
required: required:
- type - type
type: object type: object
ImageDelta:
additionalProperties: false
properties:
data:
contentEncoding: base64
type: string
type:
const: image
default: image
type: string
required:
- type
- data
type: object
InferenceStep: InferenceStep:
additionalProperties: false additionalProperties: false
properties: properties:
@ -2588,6 +2587,19 @@ components:
- type - type
- text - text
type: object type: object
TextDelta:
additionalProperties: false
properties:
text:
type: string
type:
const: text
default: text
type: string
required:
- type
- text
type: object
TokenLogProbs: TokenLogProbs:
additionalProperties: false additionalProperties: false
properties: properties:
@ -5548,6 +5560,8 @@ tags:
name: DataConfig name: DataConfig
- description: <SchemaDefinition schemaRef="#/components/schemas/Dataset" /> - description: <SchemaDefinition schemaRef="#/components/schemas/Dataset" />
name: Dataset name: Dataset
- description: <SchemaDefinition schemaRef="#/components/schemas/DatasetFormat" />
name: DatasetFormat
- name: DatasetIO - name: DatasetIO
- name: Datasets - name: Datasets
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteAgentsRequest" - description: <SchemaDefinition schemaRef="#/components/schemas/DeleteAgentsRequest"
@ -5592,6 +5606,8 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/ImageContentItem" - description: <SchemaDefinition schemaRef="#/components/schemas/ImageContentItem"
/> />
name: ImageContentItem name: ImageContentItem
- description: <SchemaDefinition schemaRef="#/components/schemas/ImageDelta" />
name: ImageDelta
- name: Inference - name: Inference
- description: <SchemaDefinition schemaRef="#/components/schemas/InferenceStep" /> - description: <SchemaDefinition schemaRef="#/components/schemas/InferenceStep" />
name: InferenceStep name: InferenceStep
@ -5824,6 +5840,8 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/TextContentItem" - description: <SchemaDefinition schemaRef="#/components/schemas/TextContentItem"
/> />
name: TextContentItem name: TextContentItem
- description: <SchemaDefinition schemaRef="#/components/schemas/TextDelta" />
name: TextDelta
- description: <SchemaDefinition schemaRef="#/components/schemas/TokenLogProbs" /> - description: <SchemaDefinition schemaRef="#/components/schemas/TokenLogProbs" />
name: TokenLogProbs name: TokenLogProbs
- description: <SchemaDefinition schemaRef="#/components/schemas/Tool" /> - description: <SchemaDefinition schemaRef="#/components/schemas/Tool" />
@ -5978,6 +5996,7 @@ x-tagGroups:
- DPOAlignmentConfig - DPOAlignmentConfig
- DataConfig - DataConfig
- Dataset - Dataset
- DatasetFormat
- DeleteAgentsRequest - DeleteAgentsRequest
- DeleteAgentsSessionRequest - DeleteAgentsSessionRequest
- EfficiencyConfig - EfficiencyConfig
@ -5992,6 +6011,7 @@ x-tagGroups:
- GraphMemoryBankParams - GraphMemoryBankParams
- HealthInfo - HealthInfo
- ImageContentItem - ImageContentItem
- ImageDelta
- InferenceStep - InferenceStep
- InsertDocumentsRequest - InsertDocumentsRequest
- InterleavedContent - InterleavedContent
@ -6070,6 +6090,7 @@ x-tagGroups:
- SyntheticDataGenerationResponse - SyntheticDataGenerationResponse
- SystemMessage - SystemMessage
- TextContentItem - TextContentItem
- TextDelta
- TokenLogProbs - TokenLogProbs
- Tool - Tool
- ToolCall - ToolCall

View file

@ -64,11 +64,13 @@ InterleavedContent = register_schema(
) )
@json_schema_type
class TextDelta(BaseModel): class TextDelta(BaseModel):
type: Literal["text"] = "text" type: Literal["text"] = "text"
text: str text: str
@json_schema_type
class ImageDelta(BaseModel): class ImageDelta(BaseModel):
type: Literal["image"] = "image" type: Literal["image"] = "image"
data: bytes data: bytes