Add langsmith:nostream to avoid emitting an empty AI message
This commit is contained in:
@@ -6,7 +6,7 @@ import { stockbrokerGraph } from "./stockbroker";
|
||||
import { ChatOpenAI } from "@langchain/openai";
|
||||
|
||||
async function router(
|
||||
state: GenerativeUIState,
|
||||
state: GenerativeUIState
|
||||
): Promise<Partial<GenerativeUIState>> {
|
||||
const routerDescription = `The route to take based on the user's input.
|
||||
- stockbroker: can fetch the price of a ticker, purchase/sell a ticker, or get the user's portfolio
|
||||
@@ -27,7 +27,9 @@ async function router(
|
||||
const llm = new ChatGoogleGenerativeAI({
|
||||
model: "gemini-2.0-flash",
|
||||
temperature: 0,
|
||||
}).bindTools([routerTool], { tool_choice: "router" });
|
||||
})
|
||||
.bindTools([routerTool], { tool_choice: "router" })
|
||||
.withConfig({ tags: ["langsmith:nostream"] });
|
||||
|
||||
const prompt = `You're a highly helpful AI assistant, tasked with routing the user's query to the appropriate tool.
|
||||
You should analyze the user's input, and choose the appropriate tool to use.`;
|
||||
@@ -58,7 +60,7 @@ You should analyze the user's input, and choose the appropriate tool to use.`;
|
||||
}
|
||||
|
||||
function handleRoute(
|
||||
state: GenerativeUIState,
|
||||
state: GenerativeUIState
|
||||
): "stockbroker" | "weather" | "generalInput" {
|
||||
return state.next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user