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
I use ai with user input to generate a project scope.
I then take that scope and pass it into another ai to generate clarifying questions.
This means I call the ai twice in a server action. One after the other.
Is this the correct way of doing it? Or should I use a tool?
Basically how can i pass in the reply from ai into the next AI.
const messagesArray: { role: any; content: string }[] = [];
messagesArray.push({ role: 'assistant', content: scopeFromAI });
aiState.update((messages: ServerMessage[]) => [...messages, { role: 'system', content: systemPrompt }]);
const result = await generateObject({
model: anthropic('claude-3-5-sonnet-20240620'),
messages: messagesArray,
system: systemPrompt,
schema: z.object({
clarifyingQuestions: z
.array(z.string().describe('A detailed q'))
.describe('List of questions that would help clarify the scope. Max 5 questions.'),
}),
});
Because i get an error Failed to evaluate project: Your API request included an assistantmessage in the final position, which would pre-fill theassistantresponse. When using tools, pre-filling theassistant response is not supported
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
-
I have the following use case:
This means I call the ai twice in a server action. One after the other.
Is this the correct way of doing it? Or should I use a tool?
Basically how can i pass in the reply from ai into the next AI.
Because i get an error
Failed to evaluate project: Your API request included an
assistantmessage in the final position, which would pre-fill the
assistantresponse. When using tools, pre-filling the
assistantresponse is not supported
Beta Was this translation helpful? Give feedback.
All reactions