Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bot] Update tasks specs #1218

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions packages/tasks/src/tasks/chat-completion/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ export interface ChatCompletionInput {
[property: string]: unknown;
}
export interface ChatCompletionInputMessage {
content: ChatCompletionInputMessageContent;
content?: ChatCompletionInputMessageContent;
name?: string;
role: string;
tool_calls?: ChatCompletionInputToolCall[];
[property: string]: unknown;
}
export type ChatCompletionInputMessageContent = ChatCompletionInputMessageChunk[] | string;
Expand All @@ -122,6 +123,18 @@ export interface ChatCompletionInputURL {
[property: string]: unknown;
}
export type ChatCompletionInputMessageChunkType = "text" | "image_url";
export interface ChatCompletionInputToolCall {
function: ChatCompletionInputFunctionDefinition;
id: string;
type: string;
[property: string]: unknown;
}
export interface ChatCompletionInputFunctionDefinition {
arguments: unknown;
description?: string;
name: string;
[property: string]: unknown;
}
export interface ChatCompletionInputGrammarType {
type: ChatCompletionInputGrammarTypeType;
/**
Expand Down Expand Up @@ -170,12 +183,6 @@ export interface ChatCompletionInputTool {
type: string;
[property: string]: unknown;
}
export interface ChatCompletionInputFunctionDefinition {
arguments: unknown;
description?: string;
name: string;
[property: string]: unknown;
}
/**
* Chat Completion Output.
*
Expand Down Expand Up @@ -217,6 +224,7 @@ export interface ChatCompletionOutputTopLogprob {
export interface ChatCompletionOutputMessage {
content?: string;
role: string;
tool_call_id?: string;
tool_calls?: ChatCompletionOutputToolCall[];
[property: string]: unknown;
}
Expand Down Expand Up @@ -264,6 +272,7 @@ export interface ChatCompletionStreamOutputChoice {
export interface ChatCompletionStreamOutputDelta {
content?: string;
role: string;
tool_call_id?: string;
tool_calls?: ChatCompletionStreamOutputDeltaToolCall;
[property: string]: unknown;
}
Expand Down
104 changes: 75 additions & 29 deletions packages/tasks/src/tasks/chat-completion/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,54 @@
},
"$defs": {
"ChatCompletionInputMessage": {
"type": "object",
"required": ["role", "content"],
"properties": {
"content": {
"$ref": "#/$defs/ChatCompletionInputMessageContent"
},
"name": {
"type": "string",
"example": "\"David\"",
"nullable": true
"allOf": [
{
"$ref": "#/$defs/ChatCompletionInputMessageBody"
},
"role": {
"type": "string",
"example": "user"
{
"type": "object",
"required": ["role"],
"properties": {
"name": {
"type": "string",
"example": "\"David\"",
"nullable": true
},
"role": {
"type": "string",
"example": "user"
}
}
}
},
],
"title": "ChatCompletionInputMessage"
},
"ChatCompletionInputMessageBody": {
"oneOf": [
{
"type": "object",
"required": ["content"],
"properties": {
"content": {
"$ref": "#/$defs/ChatCompletionInputMessageContent"
}
}
},
{
"type": "object",
"required": ["tool_calls"],
"properties": {
"tool_calls": {
"type": "array",
"items": {
"$ref": "#/$defs/ChatCompletionInputToolCall"
}
}
}
}
],
"title": "ChatCompletionInputMessageBody"
},
"ChatCompletionInputMessageContent": {
"oneOf": [
{
Expand Down Expand Up @@ -227,6 +257,37 @@
},
"title": "ChatCompletionInputUrl"
},
"ChatCompletionInputToolCall": {
"type": "object",
"required": ["id", "type", "function"],
"properties": {
"function": {
"$ref": "#/$defs/ChatCompletionInputFunctionDefinition"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"title": "ChatCompletionInputToolCall"
},
"ChatCompletionInputFunctionDefinition": {
"type": "object",
"required": ["name", "arguments"],
"properties": {
"arguments": {},
"description": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"title": "ChatCompletionInputFunctionDefinition"
},
"ChatCompletionInputGrammarType": {
"oneOf": [
{
Expand Down Expand Up @@ -326,21 +387,6 @@
}
},
"title": "ChatCompletionInputTool"
},
"ChatCompletionInputFunctionDefinition": {
"type": "object",
"required": ["name", "arguments"],
"properties": {
"arguments": {},
"description": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"title": "ChatCompletionInputFunctionDefinition"
}
}
}
4 changes: 4 additions & 0 deletions packages/tasks/src/tasks/chat-completion/spec/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
"role": {
"type": "string",
"example": "user"
},
"tool_call_id": {
"type": "string",
"nullable": true
}
},
"title": "ChatCompletionOutputTextMessage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
"role": {
"type": "string",
"example": "user"
},
"tool_call_id": {
"type": "string",
"nullable": true
}
},
"title": "ChatCompletionStreamOutputTextMessage"
Expand Down