brute 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d81acc813055cd8621c71b3d1c444b9c39cf9c316b0e4b41eddab60a3f27f85a
4
- data.tar.gz: 746bd2d574c6203e80153d0c747e55cecff746b5aa61ae1b38c9471aaee8feef
3
+ metadata.gz: fa9acc014adfa80301780aa8bc76e26fec90b9005dd3bd1a778d2807963374ca
4
+ data.tar.gz: ee086a3b83d49a20ede439d5b421111032087bb70edb462da0dd00a45491dbb6
5
5
  SHA512:
6
- metadata.gz: c18662ee0a25508ebd7df4015454b4b6e77eb7fa7e5a3f69fe2b9b1e64a8f0392fd1478cde5e5f310c85e1a683302346cc0528cb20beab80705029331ed7e4e7
7
- data.tar.gz: 60047800ecee00b2c959ca9f12385540b2be949ebfffa3f16312dc534a0342a82e5bebe0227228461e2fcba634a76a38df7d3c70bcada0c40a3be37f82c156c0
6
+ metadata.gz: 7ae63658a5f0c921a0ea4d0ad34a3c3b494a1965451f2d32022d543b1a24224f6ad25251bf323492d34f2d3e33ef4343ae322b592198d8b72d278cfcefc0b041
7
+ data.tar.gz: 6c5121ce297a25b8631edbb2712ce4fcdf27fa7f55404f9fd169e71f8765ab3d71fe41164c4740e61977c49dc4494ed8db417b36a7744f7b52a69c53bc2d215c
@@ -91,6 +91,10 @@ module Brute
91
91
  #
92
92
  # Returns the final assistant response.
93
93
  def run(user_message)
94
+ unless @provider
95
+ raise "No LLM provider configured. Set LLM_API_KEY and optionally LLM_PROVIDER (default: anthropic)"
96
+ end
97
+
94
98
  @request_count = 0
95
99
 
96
100
  # Build the initial prompt with system message on first turn
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Brute
4
+ VERSION = "0.1.2"
5
+ end
data/lib/brute.rb CHANGED
@@ -62,7 +62,7 @@ require_relative "brute/tools/delegate"
62
62
  require_relative "brute/orchestrator"
63
63
 
64
64
  module Brute
65
- VERSION = "0.1.0"
65
+ VERSION = "0.1.2"
66
66
 
67
67
  # The complete set of tools available to the agent.
68
68
  TOOLS = [
@@ -100,21 +100,30 @@ module Brute
100
100
  )
101
101
  end
102
102
 
103
+ PROVIDERS = {
104
+ "anthropic" => ->(key) { LLM.anthropic(key: key).tap { Patches::AnthropicToolRole.apply! } },
105
+ "openai" => ->(key) { LLM.openai(key: key) },
106
+ "google" => ->(key) { LLM.google(key: key) },
107
+ "deepseek" => ->(key) { LLM.deepseek(key: key) },
108
+ "ollama" => ->(key) { LLM.ollama(key: key) },
109
+ "xai" => ->(key) { LLM.xai(key: key) },
110
+ }.freeze
111
+
112
+ # Resolve the LLM provider from environment variables.
113
+ #
114
+ # LLM_API_KEY — the API key (required)
115
+ # LLM_PROVIDER — provider name (default: "anthropic")
116
+ #
117
+ # Returns nil if LLM_API_KEY is not set. Error is deferred to Orchestrator#run.
103
118
  def self.resolve_provider
104
- if ENV["ANTHROPIC_API_KEY"]
105
- LLM.anthropic(key: ENV["ANTHROPIC_API_KEY"]).tap { Patches::AnthropicToolRole.apply! }
106
- elsif ENV["OPENAI_API_KEY"]
107
- LLM.openai(key: ENV["OPENAI_API_KEY"])
108
- elsif ENV["GOOGLE_API_KEY"]
109
- LLM.google(key: ENV["GOOGLE_API_KEY"])
110
- else
111
- raise <<~MSG
112
- No API key found. Set one of:
113
- ANTHROPIC_API_KEY
114
- OPENAI_API_KEY
115
- GOOGLE_API_KEY
116
- MSG
117
- end
119
+ key = ENV["LLM_API_KEY"]
120
+ return nil unless key
121
+
122
+ name = ENV.fetch("LLM_PROVIDER", "anthropic").downcase
123
+ factory = PROVIDERS[name]
124
+ raise "Unknown LLM provider: #{name}. Available: #{PROVIDERS.keys.join(", ")}" unless factory
125
+
126
+ factory.call(key)
118
127
  end
119
128
 
120
129
  private_class_method :resolve_provider
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brute Contributors
@@ -37,6 +37,34 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: minitest
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '5.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rake
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '13.0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '13.0'
40
68
  description: Production-grade coding agent with tool execution, middleware pipeline,
41
69
  context compaction, session persistence, and multi-provider LLM support.
42
70
  executables: []
@@ -78,6 +106,7 @@ files:
78
106
  - lib/brute/tools/shell.rb
79
107
  - lib/brute/tools/todo_read.rb
80
108
  - lib/brute/tools/todo_write.rb
109
+ - lib/brute/version.rb
81
110
  licenses:
82
111
  - MIT
83
112
  metadata: {}