Class: RubynCode::CLI::Commands::Think
- Inherits:
-
Base
- Object
- Base
- RubynCode::CLI::Commands::Think
show all
- Defined in:
- lib/rubyn_code/cli/commands/think.rb
Overview
Toggle extended thinking on/off and optionally set the budget.
/think # show current budget
/think off # disable
/think <budget> # enable with <budget> tokens (e.g. /think 8192)
Constant Summary
collapse
- DEFAULT_BUDGET =
8_192
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
aliases, all_names, hidden?
Class Method Details
.command_name ⇒ Object
14
|
# File 'lib/rubyn_code/cli/commands/think.rb', line 14
def self.command_name = '/think'
|
.description ⇒ Object
15
|
# File 'lib/rubyn_code/cli/commands/think.rb', line 15
def self.description = 'Toggle or set extended thinking budget (tokens)'
|
Instance Method Details
#execute(args, ctx) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rubyn_code/cli/commands/think.rb', line 17
def execute(args, ctx)
arg = args.first
current = ctx.llm_client.respond_to?(:thinking_budget_tokens) ? ctx.llm_client.thinking_budget_tokens : 0
case arg
when nil
show_status(current, ctx)
when 'off', '0'
ctx.llm_client.thinking_budget_tokens = 0
ctx.renderer.info('Extended thinking OFF 🧠✋')
when /\A\d+\z/
budget = arg.to_i
ctx.llm_client.thinking_budget_tokens = budget
ctx.renderer.info("Extended thinking ON — budget: #{budget} tokens 🧠")
else
ctx.renderer.warning("Usage: /think [off|<budget>]. Got: #{arg}")
end
end
|