Hello guys,
I am using a tool to generate tasks from a meeting, the tasks should be objects,
it generates them well but
The problem after generating the object the Llm mistral always return a text part after the tool result
I tried by sending the tool as a call and not as a result but it gives en error
message: "Unexpected role 'user' after role 'tool'",
I saw the example of getWeather which involves calling more than one time and then using addToolResult in the frontend. but i want only in one call & only the objects, i know i can generate objects using streamObjects, but i want the llm decide wether to use a specifc tool or not.
Code
const result = streamText({
model: getMistralModel(selectedLlm),
maxSteps: 5,
system,
messages: messages.slice(-6),
tools: {
proposeTodoCreation,
},
});
export const proposeTodoCreation = tool({
description: "to create tasks or todos or to modify tasks or todos",
parameters: z.object({
todos: z
.array(
z.object({
todo: z.string().describe(".."),
assignee: z.string().describe("..."),
})
)
.describe("The array of todos identified from the context"),
}),
execute: async ({ todos }) => todos,
});
I appreciate it, thanks !