USAGE WITH ai Sdk Ui
import { mastra } from "@/src/mastra";
export async function POST(req: Request) {
const { prompt } = await req.json();
const myAgent = mastra.getAgent("weatherAgent");
const stream = await myAgent.stream([{ role: "user", content: prompt }]);
return stream.toDataStreamResponse();
}
USAGE with Ai sdk shows as this, I can not have a api route in my project can I some how directly pass localhost:4111 url in usechat hook of ai sdk?
export async function POST(req: Request) {
const { prompt } = await req.json();
const myAgent = mastra.getAgent("weatherAgent");
const stream = await myAgent.stream([{ role: "user", content: prompt }]);
return stream.toDataStreamResponse();
}
USAGE with Ai sdk shows as this, I can not have a api route in my project can I some how directly pass localhost:4111 url in usechat hook of ai sdk?