Lewis

Results 139 comments of Lewis

I will make changes but you don't have to pass the config object. It defaults to text parsing and is just there for overrides.

For sure. Right now the pattern is still: ```ts const { messages } = await req.json() const response = await openai.createChatCompletion({ model: 'gpt-4', stream: true, messages }) const stream =...

The simplest it could possibly be would be to write a `withOpenAIChat()` hook, so this would be the same behavior: ```ts // api/chat.ts export const runtime = "edge" export default...

The issue is basically this: Serverless providers restrict the number of files that can be open at once, and if you clone a repo with a directory that contains many...

1. Set `BUN_VERSION` to `1.1.29` (or > 1.1.19) in env vars for your Pages project 2. Ensure **Encrypt** is set so it is added to `process.env` Cloudflare Pages will install...

Please use Vercel's AI SDK. This library was written before it existed and is no longer really maintained except for our own projects. https://vercel.com/blog/introducing-the-vercel-ai-sdk

cc @azu, in case familiar with Jest ESM interop

You have to install node-fetch and pass it in as `{ fetch: nodeFetch }` if your runtime does not have `fetch` available. Newer versions of Node have it ready out...

You have to use `openai-streams/node` if you're on Node, this way the library will use `NodeJS.Readable` instead of WHATWG `ReadableStream`, which is for Edge runtime.

Sorry, that was actually my mistake, I edited my response - `ReadableStream` is available in Edge runtime/browser, but not Node.js, so `openai-streams/node` is needed. I guess Node does support it...