feat: Introduce Thinking Budget customization for Claude Code (#4618)
This commit is contained in:
1 parent
2af151e736
commit
72029fe205
5 files changed
+21
-3
No files matched your search
@@ -11,6 +11,7 @@ type ClaudeCodeOptions = {
|
||||
messages: Anthropic.Messages.MessageParam[]
|
||||
path?: string
|
||||
modelId?: string
|
||||
thinkingBudgetTokens?: number
|
||||
}
|
||||
|
||||
type ProcessState = {
|
||||
@@ -107,7 +108,7 @@ const claudeCodeTools = [
|
||||
|
||||
const CLAUDE_CODE_TIMEOUT = 600000 // 10 minutes
|
||||
|
||||
function runProcess({ systemPrompt, messages, path, modelId }: ClaudeCodeOptions) {
|
||||
function runProcess({ systemPrompt, messages, path, modelId, thinkingBudgetTokens }: ClaudeCodeOptions) {
|
||||
const claudePath = path || "claude"
|
||||
|
||||
const args = [
|
||||
@@ -132,6 +133,7 @@ function runProcess({ systemPrompt, messages, path, modelId }: ClaudeCodeOptions
|
||||
...process.env,
|
||||
// The default is 32000. However, I've gotten larger responses, so we increase it unless the user specified it.
|
||||
CLAUDE_CODE_MAX_OUTPUT_TOKENS: process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS || "64000",
|
||||
MAX_THINKING_TOKENS: (thinkingBudgetTokens || 0).toString(),
|
||||
}
|
||||
|
||||
// We don't want to consume the user's ANTHROPIC_API_KEY,
|
||||
|
||||
Reference in new issue
Block a user