fix: Make max tokens configurable, bump default to 10_000 (#64)

This commit is contained in:
Brace Sproul 2025-05-30 16:07:37 -07:00 • committed by GitHub
parent 65b68a1a42
commit 7b307e9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -343,6 +343,24 @@ export const GraphConfiguration = z.object({
"Maximum number of context gathering actions during planning",
},
}),
/**
* The maximum number of tokens to generate in an individual generation.
* @default 10_000
*/
maxTokens: z
.number()
.optional()
.default(() => 10_000)
.langgraph.metadata({
x_oap_ui_config: {
type: "number",
default: 10_000,
min: 1,
max: 64_000,
description:
"The maximum number of tokens to generate in an individual generation",
},
}),
});
export type GraphConfig = LangGraphRunnableConfig<

View file

@ -65,7 +65,7 @@ export async function loadModel(config: GraphConfig, task: Task) {
thinking: { budget_tokens: thinkingBudgetTokens, type: "enabled" },
maxTokens,
}
: { maxTokens: 5_000 }),
: { maxTokens: config.configurable?.maxTokens ?? 10_000 }),
});
return model;