Skip to content

[Bot] Update tasks specs #1583

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
30 changes: 6 additions & 24 deletions packages/tasks/src/tasks/chat-completion/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,35 +136,17 @@ export interface ChatCompletionInputFunctionDefinition {
[property: string]: unknown;
}
export interface ChatCompletionInputGrammarType {
json_schema?: ChatCompletionInputJSONSchemaConfig;
type: ChatCompletionInputGrammarTypeType;
[property: string]: unknown;
}
export interface ChatCompletionInputJSONSchemaConfig {
/**
* A description of what the response format is for, used by the model to determine how to
* respond in the format.
*/
description?: string;
/**
* The name of the response format.
*/
name: string;
/**
* The schema for the response format, described as a JSON Schema object. Learn how to build
* JSON schemas [here](https://json-schema.org/).
*/
schema?: {
[key: string]: unknown;
};
/**
* Whether to enable strict schema adherence when generating the output. If set to true, the
* model will always follow the exact schema defined in the `schema` field.
* A string that represents a [JSON Schema](https://json-schema.org/).
*
* JSON Schema is a declarative language that allows to annotate JSON documents
* with types and descriptions.
*/
strict?: boolean;
value: unknown;
[property: string]: unknown;
}
export type ChatCompletionInputGrammarTypeType = "text" | "json_schema" | "json_object";
export type ChatCompletionInputGrammarTypeType = "json" | "regex" | "json_schema";
export interface ChatCompletionInputStreamOptions {
/**
* If set, an additional chunk will be streamed before the data: [DONE] message. The usage
Expand Down
92 changes: 39 additions & 53 deletions packages/tasks/src/tasks/chat-completion/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,75 +291,61 @@
"ChatCompletionInputGrammarType": {
"oneOf": [
{
"$ref": "#/$defs/ChatCompletionInputResponseFormatText"
"type": "object",
"required": ["type", "value"],
"properties": {
"type": {
"type": "string",
"enum": ["json"]
},
"value": {
"description": "A string that represents a [JSON Schema](https://json-schema.org/).\n\nJSON Schema is a declarative language that allows to annotate JSON documents\nwith types and descriptions."
}
}
},
{
"$ref": "#/$defs/ChatCompletionInputResponseFormatJSONSchema"
"type": "object",
"required": ["type", "value"],
"properties": {
"type": {
"type": "string",
"enum": ["regex"]
},
"value": {
"type": "string"
}
}
},
{
"$ref": "#/$defs/ChatCompletionInputResponseFormatJSONObject"
"type": "object",
"required": ["type", "value"],
"properties": {
"type": {
"type": "string",
"enum": ["json_schema"]
},
"value": {
"$ref": "#/$defs/ChatCompletionInputJsonSchemaConfig"
}
}
}
],
"title": "ChatCompletionInputGrammarType"
},
"ChatCompletionInputResponseFormatText": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"enum": ["text"]
}
},
"title": "ChatCompletionInputResponseFormatText"
},
"ChatCompletionInputResponseFormatJSONSchema": {
"type": "object",
"required": ["type", "json_schema"],
"properties": {
"type": {
"type": "string",
"enum": ["json_schema"]
},
"json_schema": {
"$ref": "#/$defs/ChatCompletionInputJsonSchemaConfig"
}
},
"title": "ChatCompletionInputResponseFormatJSONSchema"
},
"ChatCompletionInputResponseFormatJSONObject": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"enum": ["json_object"]
}
"discriminator": {
"propertyName": "type"
},
"title": "ChatCompletionInputResponseFormatJSONObject"
"title": "ChatCompletionInputGrammarType"
},
"ChatCompletionInputJsonSchemaConfig": {
"type": "object",
"required": ["name"],
"required": ["schema"],
"properties": {
"name": {
"type": "string",
"description": "The name of the response format."
},
"description": {
"type": "string",
"description": "A description of what the response format is for, used by the model to determine how to respond in the format.",
"description": "Optional name identifier for the schema",
"nullable": true
},
"schema": {
"type": "object",
"description": "The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas [here](https://json-schema.org/).",
"nullable": true
},
"strict": {
"type": "boolean",
"description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field.",
"nullable": true
"description": "The actual JSON schema definition"
}
},
"title": "ChatCompletionInputJsonSchemaConfig"
Expand Down
Loading