-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Description
The workers-ai-provider
package doesn't handle the response API for the new GPT OSS models.
- When passing the
input
andinstructions
parameters needed for these models, the following error is returned:
Example code:
const aiResponse = await generateText({
model: workersAi('@cf/openai/gpt-oss-20b'),
input: message,
instructions: 'You are a helpful assistant',
});
Error:
✘ [ERROR] Error in conversation: InvalidPromptError [AI_InvalidPromptError]: Invalid prompt: prompt or messages must be defined
at standardizePrompt
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/prompt/standardize-prompt.ts:23:11)
at generateText
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/generate-text/generate-text.ts:265:31)
at workersAiAiSdk
(file:///Users/harshil/projects/voice-assistant-worker/src/index.ts:59:28)
at SiriAssistant.handleConversation
(file:///Users/harshil/projects/voice-assistant-worker/src/index.ts:144:32)
at async SiriAssistant._tryCatch
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/agents/src/index.ts:805:14)
at async SiriAssistant.fetch
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/partyserver/src/index.ts:308:16)
{
cause: undefined,
prompt: { system: undefined, prompt: undefined, messages:
undefined },
Symbol(vercel.ai.error): true,
Symbol(vercel.ai.error.AI_InvalidPromptError): true
}
- If passing messages and/or prompt (as per the error message), a new error is thrown.
Example code:
const aiResponse = await generateText({
model: workersAi('@cf/openai/gpt-oss-20b'),
messages: [{ role: 'user', content: message }],
});
Error:
✘ [ERROR] Error in conversation: InferenceUpstreamError [AiError]: 5006: Error: oneOf at '/' not met, 0 matches: required properties at '/' are 'input', required properties at '/' are 'requests'
at Ai._parseError (cloudflare-internal:ai-api:212:24)
at async Ai.run (cloudflare-internal:ai-api:190:19)
at async WorkersAIChatLanguageModel.doGenerate
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/workers-ai-provider/src/workersai-chat-language-model.ts:145:18)
at async fn
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/generate-text/generate-text.ts:382:32)
at null.<anonymous> (async
file:///Users/harshil/projects/voice-assistant-worker/.wrangler/tmp/dev-Q4WtKi/index.js:50184:22)
at async _retryWithExponentialBackoff
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/util/retry-with-exponential-backoff.ts:96:12)
at async fn
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/generate-text/generate-text.ts:338:34)
at null.<anonymous> (async
file:///Users/harshil/projects/voice-assistant-worker/.wrangler/tmp/dev-Q4WtKi/index.js:50184:22)
at async generateText
(file:///Users/harshil/projects/voice-assistant-worker/node_modules/ai/src/generate-text/generate-text.ts:274:12)
at async workersAiAiSdk
(file:///Users/harshil/projects/voice-assistant-worker/src/index.ts:59:22)
Metadata
Metadata
Assignees
Labels
No labels