Closed xts-bit closed 11 months ago
@jaredpalmer @MaxLeiter Any idea about this issue?
This isn't AI SDK related, you may want to experiment with a more complete system prompt for mixtral, or use one that's been trained for chat.
@MaxLeiter But can you please tell me how I give a system prompt? if I'm doing like this:
export async function POST(req: Request) {
const { messages } = await req.json();
console.log(messages)
try {
const response = await openai.chat.completions.create({
messages: messages,
model: "mistralai/Mixtral-8x7B-Instruct-v0.1",
max_tokens: 12,
stream: true
});
const stream = OpenAIStream(response);
return new StreamingTextResponse(stream);
} catch (error) {
console.log(error)
}
}
@lgrammel How do I set a system prompt to the AI?
Currently, i am doing something like [...messages, SYSTEM_PROMPT] to make it work, But unfortunately, it's not working as expected.
Can you please help me out?
@xts-bit Check out the OpenAI documentation for their SDK: https://platform.openai.com/docs/guides/text-generation/chat-completions-api
@lgrammel It doesn't work like that i did messages: [ { "role": "system", "content": "You are a helpful assistant." }, ...messages]
it gives error index.mjs:288
POST http://localhost:3000/api/chat 404 (Not Found)
Description
I'm using AI SDK to use together AI API using OpenAI SDK which supports this, I tried this in Node.js and it works, However, when I try to do that in Next.js using Vercel AI SDK it's not working as expected, if I prompt it "What is Vercel" in the input in the frontend it says "I'm helpful assistant" How can i do things correctly?
Code example
Additional context
How can i get correct response that make sense according to the input?