From b6e5cb6275d88f065f4d09d4e9f01e92758781be Mon Sep 17 00:00:00 2001 From: Brett Lamy Date: Mon, 27 Feb 2023 20:31:04 -0800 Subject: [PATCH] fix nextjs example --- apps/nextjs-promptable/src/pages/api/stream.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/nextjs-promptable/src/pages/api/stream.ts b/apps/nextjs-promptable/src/pages/api/stream.ts index 60888bb..99fdffb 100644 --- a/apps/nextjs-promptable/src/pages/api/stream.ts +++ b/apps/nextjs-promptable/src/pages/api/stream.ts @@ -35,9 +35,7 @@ export default async function handler( // then add the user message chatHistory.addUserMessage(userInput); - const chatbotPrompt = promptable.prompts.chatbot(); - - const promptText = chatbotPrompt.format({ + const { text: prompt } = promptable.promptTemplates.Chatbot.build({ memory: chatHistory.get(), userInput, }); @@ -45,7 +43,7 @@ export default async function handler( const oaiRes = await axios.post( "https://api.openai.com/v1/completions", { - prompt: promptText, + prompt, model: "text-davinci-003", max_tokens: 1000, stream: true,