Skip to content

Commit afdfb0b

Browse files
[Bot] Update tasks specs (#1030)
This PR updates the @huggingface/tasks specs. It has been generated by running: ```sh pnpm run inference-tgi-import pnpm run inference-tei-import pnpm run inference-codegen ``` This PR was automatically created by the [Tasks - Update specs workflow](https://github.com/huggingface/huggingface.js/blob/main/.github/update-specs.yml). Make sure the changes are correct before merging. Co-authored-by: Wauplin <[email protected]>
1 parent 0ebf911 commit afdfb0b

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed

packages/tasks/src/tasks/chat-completion/inference.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export interface ChatCompletionInput {
7979
* We generally recommend altering this or `top_p` but not both.
8080
*/
8181
temperature?: number;
82-
tool_choice?: ChatCompletionInputTool;
82+
tool_choice?: ChatCompletionInputToolChoice;
8383
/**
8484
* A prompt to be appended before the tools
8585
*/
@@ -89,7 +89,7 @@ export interface ChatCompletionInput {
8989
* Use this to provide a list of
9090
* functions the model may generate JSON inputs for.
9191
*/
92-
tools?: ToolElement[];
92+
tools?: ChatCompletionInputTool[];
9393
/**
9494
* An integer between 0 and 5 specifying the number of most likely tokens to return at each
9595
* token position, each with
@@ -154,10 +154,23 @@ export interface ChatCompletionInputStreamOptions {
154154
[property: string]: unknown;
155155
}
156156

157-
export type ChatCompletionInputTool = ChatCompletionInputToolType | string;
157+
/**
158+
*
159+
* <https://platform.openai.com/docs/guides/function-calling/configuring-function-calling-behavior-using-the-tool_choice-parameter>
160+
*/
161+
export type ChatCompletionInputToolChoice = ChatCompletionInputToolChoiceEnum | ChatCompletionInputToolChoiceObject;
162+
163+
/**
164+
* Means the model can pick between generating a message or calling one or more tools.
165+
*
166+
* Means the model will not call any tool and instead generates a message.
167+
*
168+
* Means the model must call one or more tools.
169+
*/
170+
export type ChatCompletionInputToolChoiceEnum = "auto" | "none" | "required";
158171

159-
export interface ChatCompletionInputToolType {
160-
function?: ChatCompletionInputFunctionName;
172+
export interface ChatCompletionInputToolChoiceObject {
173+
function: ChatCompletionInputFunctionName;
161174
[property: string]: unknown;
162175
}
163176

@@ -166,7 +179,7 @@ export interface ChatCompletionInputFunctionName {
166179
[property: string]: unknown;
167180
}
168181

169-
export interface ToolElement {
182+
export interface ChatCompletionInputTool {
170183
function: ChatCompletionInputFunctionDefinition;
171184
type: string;
172185
[property: string]: unknown;

packages/tasks/src/tasks/chat-completion/spec/input.json

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"$ref": "#/$defs/ChatCompletionInputToolChoice"
115115
}
116116
],
117+
"default": "auto",
117118
"nullable": true
118119
},
119120
"tool_prompt": {
@@ -272,23 +273,21 @@
272273
"title": "ChatCompletionInputStreamOptions"
273274
},
274275
"ChatCompletionInputToolChoice": {
275-
"allOf": [
276-
{
277-
"$ref": "#/$defs/ChatCompletionInputToolType"
278-
}
279-
],
280-
"nullable": true,
281-
"title": "ChatCompletionInputToolChoice"
282-
},
283-
"ChatCompletionInputToolType": {
284276
"oneOf": [
285277
{
286-
"type": "object",
287-
"default": null,
288-
"nullable": true
278+
"type": "string",
279+
"description": "Means the model can pick between generating a message or calling one or more tools.",
280+
"enum": ["auto"]
289281
},
290282
{
291-
"type": "string"
283+
"type": "string",
284+
"description": "Means the model will not call any tool and instead generates a message.",
285+
"enum": ["none"]
286+
},
287+
{
288+
"type": "string",
289+
"description": "Means the model must call one or more tools.",
290+
"enum": ["required"]
292291
},
293292
{
294293
"type": "object",
@@ -298,14 +297,10 @@
298297
"$ref": "#/$defs/ChatCompletionInputFunctionName"
299298
}
300299
}
301-
},
302-
{
303-
"type": "object",
304-
"default": null,
305-
"nullable": true
306300
}
307301
],
308-
"title": "ChatCompletionInputToolType"
302+
"description": "<https://platform.openai.com/docs/guides/function-calling/configuring-function-calling-behavior-using-the-tool_choice-parameter>",
303+
"title": "ChatCompletionInputToolChoice"
309304
},
310305
"ChatCompletionInputFunctionName": {
311306
"type": "object",

packages/tasks/src/tasks/feature-extraction/inference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface FeatureExtractionInput {
2323
* The name of the prompt that should be used by for encoding. If not set, no prompt
2424
* will be applied.
2525
*
26-
* Must be a key in the `Sentence Transformers` configuration `prompts` dictionary.
26+
* Must be a key in the `sentence-transformers` configuration `prompts` dictionary.
2727
*
2828
* For example if ``prompt_name`` is "query" and the ``prompts`` is {"query": "query: ",
2929
* ...},

packages/tasks/src/tasks/feature-extraction/spec/input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"prompt_name": {
1919
"type": "string",
20-
"description": "The name of the prompt that should be used by for encoding. If not set, no prompt\nwill be applied.\n\nMust be a key in the `Sentence Transformers` configuration `prompts` dictionary.\n\nFor example if ``prompt_name`` is \"query\" and the ``prompts`` is {\"query\": \"query: \", ...},\nthen the sentence \"What is the capital of France?\" will be encoded as\n\"query: What is the capital of France?\" because the prompt text will be prepended before\nany text to encode.",
20+
"description": "The name of the prompt that should be used by for encoding. If not set, no prompt\nwill be applied.\n\nMust be a key in the `sentence-transformers` configuration `prompts` dictionary.\n\nFor example if ``prompt_name`` is \"query\" and the ``prompts`` is {\"query\": \"query: \", ...},\nthen the sentence \"What is the capital of France?\" will be encoded as\n\"query: What is the capital of France?\" because the prompt text will be prepended before\nany text to encode.",
2121
"default": "null",
2222
"example": "null",
2323
"nullable": true

0 commit comments

Comments
 (0)