-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a clear and detailed title that summarizes the issue.
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.
Example Code
// Create a tool with a discriminatedUnion and positive
/*
expiration: z
// will cause 400
.discriminatedUnion("type", [
z.object({
type: z.literal("relative"),
relativeSeconds: z
.number()
// Will cause 400
.positive()
.describe("Number of seconds from now until expiration"),
}),
z.object({
type: z.literal("exact"),
exactDate: z
.string()
.describe(
"Exact expiration date/time in ISO 8601 format (e.g., '2025-06-01T00:00:00Z')",
),
}),
])
*/
import { ChatVertexAI } from "@langchain/google-vertexai";
export const geminiPro = new ChatVertexAI({
model: "gemini-2.5-pro",
temperature: 0.3,
maxConcurrency: 50,
maxRetries: 20,
location: "global",
platformType: "gcp",
cache: true,
vertexai: true,
});
// ...
const toolNode = new ToolNode(aggregatedTools);
const modelWithTools = llm.bindTools(aggregatedTools);
async function callModel(state: typeof LiteState.State) {
const messages = [...state.messages];
const chain = prompt.pipe(modelWithTools);
const response = await chain.invoke(
{
...state,
messages,
},
{ maxConcurrency: 50 },
);
return response;
}
const liteAgentNodeName = "lite_agent";
const workflow = new StateGraph(LiteState)
.addNode(liteAgentNodeName, callModel)
.addEdge("__start__", liteAgentNodeName)
.addNode("tools", toolNode)
.addEdge("tools", liteAgentNodeName)
.addConditionalEdges(liteAgentNodeName, shouldContinue);
const compiledLiteGraph = workflow.compile({ store: liteStore });
const result = await compiledLiteGraph.invoke(
{
messages: [
...state.messages,
],
},
{
...config,
maxConcurrency: 50,
},
);
Error Message and Stack Trace (if applicable)
Description
I am using the @langchain/google-vertexai
package with Gemini Pro 2.5
@langchain/[email protected]
@langchain/[email protected]
i expect .discriminatedUnion and .positive() to work, or to get a helpful error.
currently i just get an unhelpful 400 error from the model call
System Info
n/a
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working