diff --git a/packages/tasks/scripts/inference-tgi-import.ts b/packages/tasks/scripts/inference-tgi-import.ts index 49be3b1e9..cbac5fddb 100644 --- a/packages/tasks/scripts/inference-tgi-import.ts +++ b/packages/tasks/scripts/inference-tgi-import.ts @@ -47,7 +47,7 @@ async function _extractAndAdapt(task: string, mainComponentName: string, type: " // e.g. TextGeneration const camelName = toCamelCase(task); // e.g. TextGenerationInput - const camelFullName = camelName + toCamelCase(type); + let camelFullName = camelName + toCamelCase(type); const mainComponent = components[mainComponentName]; const filteredComponents: Record = {}; @@ -66,7 +66,9 @@ async function _extractAndAdapt(task: string, mainComponentName: string, type: " } // Add reference to components to export (and scan it too) - const newRef = camelFullName + ref.replace(camelName, ""); + let newRef = camelFullName + ref.replace(camelName, ""); + // remove duplicated InputInput or OutputOutput in naming + newRef = newRef.replace("InputInput", "Input").replace("OutputOutput", "Output"); if (!filteredComponents[newRef]) { components[ref]["title"] = newRef; // Rename title to avoid conflicts filteredComponents[newRef] = components[ref]; diff --git a/packages/tasks/src/tasks/chat-completion/inference.ts b/packages/tasks/src/tasks/chat-completion/inference.ts index fa5127dd4..febaffc8f 100644 --- a/packages/tasks/src/tasks/chat-completion/inference.ts +++ b/packages/tasks/src/tasks/chat-completion/inference.ts @@ -200,7 +200,7 @@ export interface ChatCompletionOutputComplete { finish_reason: string; index: number; logprobs?: ChatCompletionOutputLogprobs; - message: ChatCompletionOutputOutputMessage; + message: ChatCompletionOutputMessage; [property: string]: unknown; } @@ -222,7 +222,7 @@ export interface ChatCompletionOutputTopLogprob { [property: string]: unknown; } -export interface ChatCompletionOutputOutputMessage { +export interface ChatCompletionOutputMessage { content?: string; role: string; tool_calls?: ChatCompletionOutputToolCall[]; diff --git a/packages/tasks/src/tasks/chat-completion/spec/output.json b/packages/tasks/src/tasks/chat-completion/spec/output.json index a3ca487a3..ce808bf1b 100644 --- a/packages/tasks/src/tasks/chat-completion/spec/output.json +++ b/packages/tasks/src/tasks/chat-completion/spec/output.json @@ -54,7 +54,7 @@ "nullable": true }, "message": { - "$ref": "#/$defs/ChatCompletionOutputOutputMessage" + "$ref": "#/$defs/ChatCompletionOutputMessage" } }, "title": "ChatCompletionOutputComplete" @@ -106,7 +106,7 @@ }, "title": "ChatCompletionOutputTopLogprob" }, - "ChatCompletionOutputOutputMessage": { + "ChatCompletionOutputMessage": { "oneOf": [ { "$ref": "#/$defs/ChatCompletionOutputTextMessage" @@ -115,7 +115,7 @@ "$ref": "#/$defs/ChatCompletionOutputToolCallMessage" } ], - "title": "ChatCompletionOutputOutputMessage" + "title": "ChatCompletionOutputMessage" }, "ChatCompletionOutputTextMessage": { "type": "object", diff --git a/packages/tasks/src/tasks/index.ts b/packages/tasks/src/tasks/index.ts index 5a871a10e..6c8068680 100644 --- a/packages/tasks/src/tasks/index.ts +++ b/packages/tasks/src/tasks/index.ts @@ -47,7 +47,7 @@ export type { ChatCompletionInputMessage, ChatCompletionOutput, ChatCompletionOutputComplete, - ChatCompletionOutputOutputMessage, + ChatCompletionOutputMessage, ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta,