module Riffer::Rig::Commands::Reasoning
Constants
- SAVE
Public Instance Methods
(settings_path: String) → Riffer::Rig::Command
Source
# File lib/riffer/rig/commands/reasoning.rb, line 10 def command(settings_path:) Riffer::Rig::Command.new( 'reasoning', description: 'Switch the reasoning level for this session: /reasoning high, /reasoning --save', extension: :core ) { |ctx| run(ctx, settings_path:) } end
@rbs settings_path: String @rbs return: Riffer::Rig::Command
(Riffer::Rig::Command::Context ctx, settings_path: String) → void
Source
# File lib/riffer/rig/commands/reasoning.rb, line 21 def run(ctx, settings_path:) words = ctx.args.split save = words.delete(SAVE) level = words.join(' ') if level.empty? current = ctx.runtime.reasoning return ctx.say("Reasoning: #{current || Riffer::Rig::Runtime::DEFAULT_REASONING_LABEL}") unless save return ctx.say('No reasoning level is in effect to save') unless current refusal = Riffer::Rig::Settings::File.store_reasoning(current, path: settings_path) return ctx.host.notify(refusal, level: :error) if refusal return ctx.say("Saved #{current} to #{settings_path}") end rejection = Riffer::Rig::Settings::ModelOptions.reasoning_rejection(level) return ctx.say(rejection) if rejection ctx.runtime.reasoning = level refusal = Riffer::Rig::Settings::File.store_reasoning(level, path: settings_path) if save ctx.host.notify(refusal, level: :error) if refusal saved = save && !refusal ctx.say(saved ? "Reasoning switched to #{level} and saved to #{settings_path}" : "Reasoning switched to #{level}") end
@rbs ctx: Riffer::Rig::Command::Context @rbs settings_path: String @rbs return: void