You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello All,
I continue to run into this message about not finding 'open-edge' module or its type declaration, and couldn't figure out where to start debugging because all I've done was install, ran the app, and tried deploying it on Vercel along with the rest of my codebase. Funny thing is that I am able to run the app on my local machine, and have it work successfully. Any help to debug will be very much appreciated.
import { Configuration, OpenAIApi } from "openai-edge";
import { OpenAIStream, StreamingTextResponse } from "ai";
// Create an OpenAI API client (that's edge friendly!)
const config = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(config);
// Set the runtime to edge for best performance
export const runtime = "edge";
export async function POST(req: Request) {
const { prompt } = await req.json();
// Ask OpenAI for a streaming completion given the prompt
const response = await openai.createCompletion({
model: "text-davinci-003",
stream: true,
temperature: 0.6,
prompt: `Create three slogans for a business with unique features.
Business: Bookstore with cats
Slogans: "Purr-fect Pages", "Books and Whiskers", "Novels and Nuzzles"
Business: Gym with rock climbing
Slogans: "Peak Performance", "Reach New Heights", "Climb Your Way Fit"
Business: ${prompt}
Slogans:`,
});
// Convert the response into a friendly text-stream
const stream = OpenAIStream(response);
// Respond with the stream
return new StreamingTextResponse(stream);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello All,
I continue to run into this message about not finding 'open-edge' module or its type declaration, and couldn't figure out where to start debugging because all I've done was install, ran the app, and tried deploying it on Vercel along with the rest of my codebase. Funny thing is that I am able to run the app on my local machine, and have it work successfully. Any help to debug will be very much appreciated.
Steps to recreate:
What I've tried:
Deleted and reInstalled
node_modules
directory.File-in-question: ./ai-powered/app/api/completion/route.ts:1:42
Beta Was this translation helpful? Give feedback.
All reactions