Module: Brute

Defined in:
lib/brute.rb,
lib/brute/tool.rb,
lib/brute/agent.rb,
lib/brute/skill.rb,
lib/brute/tools.rb,
lib/brute/prompts.rb,
lib/brute/session.rb,
lib/brute/version.rb,
lib/brute/pipeline.rb,
lib/brute/sub_agent.rb,
lib/brute/truncation.rb,
lib/brute/utils/diff.rb,
lib/brute/tools/shell.rb,
lib/brute/prompts/base.rb,
lib/brute/system_prompt.rb,
lib/brute/tools/fs_read.rb,
lib/brute/tools/fs_undo.rb,
lib/brute/events/handler.rb,
lib/brute/prompts/skills.rb,
lib/brute/tools/fs_patch.rb,
lib/brute/tools/fs_write.rb,
lib/brute/tools/question.rb,
lib/brute/providers/shell.rb,
lib/brute/tools/fs_remove.rb,
lib/brute/tools/fs_search.rb,
lib/brute/tools/net_fetch.rb,
lib/brute/tools/todo_read.rb,
lib/brute/prompts/autonomy.rb,
lib/brute/prompts/identity.rb,
lib/brute/store/todo_store.rb,
lib/brute/tools/todo_write.rb,
lib/brute/prompts/max_steps.rb,
lib/brute/prompts/code_style.rb,
lib/brute/prompts/git_safety.rb,
lib/brute/prompts/tool_usage.rb,
lib/brute/prompts/conventions.rb,
lib/brute/prompts/doing_tasks.rb,
lib/brute/prompts/environment.rb,
lib/brute/prompts/objectivity.rb,
lib/brute/prompts/build_switch.rb,
lib/brute/prompts/instructions.rb,
lib/brute/store/snapshot_store.rb,
lib/brute/middleware/user_queue.rb,
lib/brute/prompts/plan_reminder.rb,
lib/brute/prompts/proactiveness.rb,
lib/brute/middleware/005_tracing.rb,
lib/brute/prompts/frontend_tasks.rb,
lib/brute/prompts/tone_and_style.rb,
lib/brute/middleware/100_llm_call.rb,
lib/brute/prompts/code_references.rb,
lib/brute/prompts/task_management.rb,
lib/brute/middleware/001_otel_span.rb,
lib/brute/middleware/004_summarize.rb,
lib/brute/middleware/060_questions.rb,
lib/brute/middleware/070_tool_call.rb,
lib/brute/middleware/event_handler.rb,
lib/brute/prompts/editing_approach.rb,
lib/brute/providers/shell_response.rb,
lib/brute/queue/file_mutation_queue.rb,
lib/brute/prompts/editing_constraints.rb,
lib/brute/prompts/security_and_safety.rb,
lib/brute/middleware/020_system_prompt.rb,
lib/brute/middleware/010_max_iterations.rb,
lib/brute/middleware/073_otel_tool_call.rb,
lib/brute/events/terminal_output_handler.rb,
lib/brute/events/prefixed_terminal_output.rb,
lib/brute/middleware/003_tool_result_loop.rb,
lib/brute/middleware/015_otel_token_usage.rb,
lib/brute/middleware/040_compaction_check.rb,
lib/brute/middleware/075_otel_tool_results.rb

Defined Under Namespace

Modules: Diff, Events, Middleware, Prompts, Providers, Queue, Skill, Store, Tools, Truncation Classes: Agent, Pipeline, Session, SubAgent, SystemPrompt, Tool

Constant Summary collapse

LOGO =
<<-LOGO
 .o8                                .             
"888                              .o8             
 888oooo.  oooo d8b oooo  oooo  .o888oo  .ooooo.  
 d88' `88b `888""8P `888  `888    888   d88' `88b 
 888   888  888      888   888    888   888ooo888 
 888   888  888      888   888    888 . 888    .o 
 `Y8bod8P' d888b     `V88V"V8P'   "888" `Y8bod8P' 
LOGO
DEFAULT_SYSTEM_PROMPT =
"You are a helpful assistant, hellbent on taking over the world."
VERSION =
"2.0.4"

Class Method Summary collapse

Class Method Details

.configObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/brute.rb', line 31

def self.config
  @config ||= begin
    RubyLLM.configure do |config|
      # Anthropic
      config.anthropic_api_key = ENV['ANTHROPIC_API_KEY']
      config.anthropic_api_base = ENV['ANTHROPIC_API_BASE'] # Available in v1.13.0+ (optional custom Anthropic endpoint)
    
      # Azure
      config.azure_api_base = ENV['AZURE_API_BASE'] # Microsoft Foundry project endpoint
      config.azure_api_key = ENV['AZURE_API_KEY'] # use this or
      config.azure_ai_auth_token = ENV['AZURE_AI_AUTH_TOKEN'] # this
    
      # Bedrock
      config.bedrock_api_key = ENV['AWS_ACCESS_KEY_ID']
      config.bedrock_secret_key = ENV['AWS_SECRET_ACCESS_KEY']
      config.bedrock_region = ENV['AWS_REGION'] # Required for Bedrock
      config.bedrock_session_token = ENV['AWS_SESSION_TOKEN'] # For temporary credentials
    
      # DeepSeek
      config.deepseek_api_key = ENV['DEEPSEEK_API_KEY']
      config.deepseek_api_base = ENV['DEEPSEEK_API_BASE'] # Available in v1.13.0+ (optional custom DeepSeek endpoint)
    
      # Gemini
      config.gemini_api_key = ENV['GEMINI_API_KEY']
      config.gemini_api_base = ENV['GEMINI_API_BASE'] # Available in v1.9.0+ (optional API version override)
    
      # GPUStack
      config.gpustack_api_base = ENV['GPUSTACK_API_BASE']
      config.gpustack_api_key = ENV['GPUSTACK_API_KEY']
    
      # Mistral
      config.mistral_api_key = ENV['MISTRAL_API_KEY']
    
      # Ollama
      config.ollama_api_base = 'http://localhost:11434/v1'
      config.ollama_api_key = ENV['OLLAMA_API_KEY'] # Available in v1.13.0+ (optional for authenticated/remote Ollama endpoints)
    
      # OpenAI
      config.openai_api_key = ENV['OPENAI_API_KEY']
      config.openai_api_base = ENV['OPENAI_API_BASE'] # Optional custom OpenAI-compatible endpoint
    
      # OpenRouter
      config.openrouter_api_key = ENV['OPENROUTER_API_KEY']
      config.openrouter_api_base = ENV['OPENROUTER_API_BASE'] # Available in v1.13.0+ (optional custom OpenRouter endpoint)
    
      # Perplexity
      config.perplexity_api_key = ENV['PERPLEXITY_API_KEY']
    
      # Vertex AI
      config.vertexai_project_id = ENV['GOOGLE_CLOUD_PROJECT'] # Available in v1.7.0+
      config.vertexai_location = ENV['GOOGLE_CLOUD_LOCATION']
      config. = ENV['VERTEXAI_SERVICE_ACCOUNT_KEY'] # Optional: service account JSON key
    
      # xAI
      config.xai_api_key = ENV['XAI_API_KEY'] # Available in v1.11.0+
    end
    RubyLLM.config
  end
end

.providerObject



91
92
93
# File 'lib/brute.rb', line 91

def self.provider
  @provider ||= :anthropic
end

.provider=(p) ⇒ Object



95
96
97
# File 'lib/brute.rb', line 95

def self.provider=(p)
  @provider = p.to_sym
end