Skip to content

Commit

Permalink
Update tasks specs (automated commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored and github-actions[bot] committed Nov 21, 2024
1 parent 21158d7 commit 3f9a70d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 27 deletions.
29 changes: 23 additions & 6 deletions packages/tasks/src/tasks/chat-completion/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export interface ChatCompletionInput {
* decreasing the model's likelihood to repeat the same line verbatim.
*/
frequency_penalty?: number;
/**
* A guideline to be used in the chat_template
*/
guideline?: string;
/**
* UNUSED
* Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON
Expand Down Expand Up @@ -79,7 +83,7 @@ export interface ChatCompletionInput {
* We generally recommend altering this or `top_p` but not both.
*/
temperature?: number;
tool_choice?: ChatCompletionInputTool;
tool_choice?: ChatCompletionInputToolChoice;
/**
* A prompt to be appended before the tools
*/
Expand All @@ -89,7 +93,7 @@ export interface ChatCompletionInput {
* Use this to provide a list of
* functions the model may generate JSON inputs for.
*/
tools?: ToolElement[];
tools?: ChatCompletionInputTool[];
/**
* An integer between 0 and 5 specifying the number of most likely tokens to return at each
* token position, each with
Expand Down Expand Up @@ -154,10 +158,23 @@ export interface ChatCompletionInputStreamOptions {
[property: string]: unknown;
}

export type ChatCompletionInputTool = ChatCompletionInputToolType | string;
/**
*
* <https://platform.openai.com/docs/guides/function-calling/configuring-function-calling-behavior-using-the-tool_choice-parameter>
*/
export type ChatCompletionInputToolChoice = ChatCompletionInputToolChoiceEnum | ChatCompletionInputToolChoiceObject;

/**
* Means the model can pick between generating a message or calling one or more tools.
*
* Means the model will not call any tool and instead generates a message.
*
* Means the model must call one or more tools.
*/
export type ChatCompletionInputToolChoiceEnum = "auto" | "none" | "required";

export interface ChatCompletionInputToolType {
function?: ChatCompletionInputFunctionName;
export interface ChatCompletionInputToolChoiceObject {
function: ChatCompletionInputFunctionName;
[property: string]: unknown;
}

Expand All @@ -166,7 +183,7 @@ export interface ChatCompletionInputFunctionName {
[property: string]: unknown;
}

export interface ToolElement {
export interface ChatCompletionInputTool {
function: ChatCompletionInputFunctionDefinition;
type: string;
[property: string]: unknown;
Expand Down
40 changes: 21 additions & 19 deletions packages/tasks/src/tasks/chat-completion/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
"example": "1.0",
"nullable": true
},
"guideline": {
"type": "string",
"description": "A guideline to be used in the chat_template",
"default": "null",
"example": "null",
"nullable": true
},
"logit_bias": {
"type": "array",
"items": {
Expand Down Expand Up @@ -114,6 +121,7 @@
"$ref": "#/$defs/ChatCompletionInputToolChoice"
}
],
"default": "auto",
"nullable": true
},
"tool_prompt": {
Expand Down Expand Up @@ -272,23 +280,21 @@
"title": "ChatCompletionInputStreamOptions"
},
"ChatCompletionInputToolChoice": {
"allOf": [
{
"$ref": "#/$defs/ChatCompletionInputToolType"
}
],
"nullable": true,
"title": "ChatCompletionInputToolChoice"
},
"ChatCompletionInputToolType": {
"oneOf": [
{
"type": "object",
"default": null,
"nullable": true
"type": "string",
"description": "Means the model can pick between generating a message or calling one or more tools.",
"enum": ["auto"]
},
{
"type": "string"
"type": "string",
"description": "Means the model will not call any tool and instead generates a message.",
"enum": ["none"]
},
{
"type": "string",
"description": "Means the model must call one or more tools.",
"enum": ["required"]
},
{
"type": "object",
Expand All @@ -298,14 +304,10 @@
"$ref": "#/$defs/ChatCompletionInputFunctionName"
}
}
},
{
"type": "object",
"default": null,
"nullable": true
}
],
"title": "ChatCompletionInputToolType"
"description": "<https://platform.openai.com/docs/guides/function-calling/configuring-function-calling-behavior-using-the-tool_choice-parameter>",
"title": "ChatCompletionInputToolChoice"
},
"ChatCompletionInputFunctionName": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion packages/tasks/src/tasks/feature-extraction/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface FeatureExtractionInput {
* The name of the prompt that should be used by for encoding. If not set, no prompt
* will be applied.
*
* Must be a key in the `Sentence Transformers` configuration `prompts` dictionary.
* Must be a key in the `sentence-transformers` configuration `prompts` dictionary.
*
* For example if ``prompt_name`` is "query" and the ``prompts`` is {"query": "query: ",
* ...},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"prompt_name": {
"type": "string",
"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.",
"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.",
"default": "null",
"example": "null",
"nullable": true
Expand Down

0 comments on commit 3f9a70d

Please sign in to comment.