vercel / modelfusion

The TypeScript library for building AI applications.
https://modelfusion.dev
MIT License
1.01k stars 76 forks source link

can't connect to https://api.openai.com:443/v1/audio/transcriptions #259

Closed nobillowseagit closed 5 months ago

nobillowseagit commented 5 months ago

✓ Ready in 2.5s ✓ Compiled / in 1001ms (2347 modules) ⚠ Fast Refresh had to perform a full reload due to a runtime error. ✓ Compiled /api/transcribe in 1313ms (1088 modules) ApiCallError: Cannot connect to API: Connect Timeout Error at postToApi (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/core/api/postToApi.js:164:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async OpenAITranscriptionModel.doTranscribe (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/model-provider/openai/OpenAITranscriptionModel.js:54:29) at async generateResponse (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/model-function/generate-transcription/generateTranscription.js:9:28) at async runSafe (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/util/runSafe.js:3:35) at async executeStandardCall (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/model-function/executeStandardCall.js:42:20) at async generateTranscription (file:///D:/works/ai/agent/modelfusion/examples/voice-recording-next-js/node_modules/modelfusion/model-function/generate-transcription/generateTranscription.js:3:26) at async handler (webpack-internal:///(api)/./src/pages/api/transcribe.ts:58:31) { url: 'https://api.openai.com:443/v1/audio/transcriptions', requestBodyValues: { model: 'whisper-1', prompt: undefined, response_format: { type: 'verbose_json', handler: [AsyncFunction (anonymous)] }, temperature: undefined, language: undefined }, statusCode: undefined, responseBody: undefined, cause: ConnectTimeoutError: Connect Timeout Error at onConnectTimeout (D:\works\ai\agent\modelfusion\examples\voice-recording-next-js\node_modules\next\dist\compiled\undici\index.js:1:92227) at D:\works\ai\agent\modelfusion\examples\voice-recording-next-js\node_modules\next\dist\compiled\undici\index.js:1:91719 at Immediate._onImmediate (D:\works\ai\agent\modelfusion\examples\voice-recording-next-js\node_modules\next\dist\compiled\undici\index.js:1:92098) at process.processImmediate (node:internal/timers:478:21) { code: 'UND_ERR_CONNECT_TIMEOUT' }, isRetryable: true, data: undefined

lgrammel commented 5 months ago

I have just double checked and running the OpenAI transcription example works for me:

~/repositories/modelfusion/examples/basic main ⇡1 *1 ?1 ··················································································································· 11s 23:36:05
❯ pnpm tsx src/model-provider/openai/openai-generate-transcription-example.ts
Hey, this is just a test.

It looks like you cannnot connect to the openai server. Can you access the OpenAI API independent of ModelFusion?

nobillowseagit commented 5 months ago

It's curious~ Using command line curl, api is working normally, but this example can not run.

lgrammel commented 5 months ago

Did you try the example in examples/basic ( pnpm tsx src/model-provider/openai/openai-generate-transcription-example.ts)?

I'll check out the next js app example later today

lgrammel commented 5 months ago

Reworked the transcription in the new next.js example: https://github.com/lgrammel/modelfusion/tree/main/examples/nextjs

Closing this issue for now. Please re-open if you run into the same issue with the new example