Hi, I’m new to Vercel AI SDK. I’m trying to do the following. I’m not sure if there is a better way to do it
**Problem:
**
I’ve a askClarifyingQuestionTool That's supposed to ask a question from the user. In the UI, I’m rendering a textarea to get user input while the tool call is being made, and then on submit, I’m using chat.addToolOutput it to complete the tool call, but I’m not seeing any call going to the server in the network tab afterward.
Code:
const chat = useChat({ id: chatId, onToolCall: ({ toolCall }) => { return; }, transport: new DefaultChatTransport({ api: "/api/chat", body: { technique: selectedTechnique, techniqueConfig, modelSettings: { model: settings.defaultModel, temperature: settings.defaultTemperature, maxTokens: settings.maxTokens, }, }, }), });...{chat.messages.length > 0 && ( <div className="space-y-6"> {chat.messages.map((message) => { return ( <div key={message.id} className="flex flex-row gap-4 items-start"// route .ts
const result = streamText({ model: openai(modelSettings?.model || "gpt-4o"), system: systemPrompt, temperature: modelSettings?.temperature || 0.7, ...(modelSettings?.maxTokens && { maxTokens: modelSettings.maxTokens }), messages: await convertToModelMessages(messages), tools: collaborativeTools, // Enable AI tool calling for collaborative prompt building stopWhen: stepCountIs(1), });export const askClarifyingQuestionTool = tool({ description: "Ask the user a clarifying question to better understand their requirements for the prompt. Use this when the user's intent is unclear or when important configuration is missing.", inputSchema: z.object({ question: z.string().describe("The specific question to ask the user"), context: z .string() .describe("Brief explanation of why this information is needed"), field: z .enum(["examples", "persona", "outputFormat", "other"]) .describe("Which configuration field this question relates to"), suggestions: z .array(z.string()) .optional() .describe("Optional suggestions to help the user answer"), }), // execute: async (args) => { // console.log("here we go: ", args); // // Return args for client-side rendering - user interaction required // return { // type: "question", // ...args, // requiresUserInput: true, // }; // },});