girb-ruby_llm 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +31 -22
- data/README_ja.md +31 -22
- data/lib/girb-ruby_llm/version.rb +1 -1
- data/lib/girb-ruby_llm.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66f01e57eaba72b64b36e0621eabd8c01251ebf92baacd82b738332867e5f6e8
|
|
4
|
+
data.tar.gz: fa63bea432ab5e4d36be4253df606c526c1b0920e1e22e4ca6b2929a7f837cdc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a94d28c70c59bb44802dd7932b5a33e46e488bad840cdf4b3666070353d61058b501135e58edc7baea4ca0d4fe6a0dc93bdf19491452d768eca1e968f54510d
|
|
7
|
+
data.tar.gz: d0e28049f1c2eb77f30a0e1ede71d39af6d96b1e96975986fd4803805cc982b2f1bfec6301646a574a3261e366617c2c819aa38e1e7d23e11f4986a1b997b2f7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.1] - 2026-02-03
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- GIRB_MODEL environment variable support (required)
|
|
8
|
+
- Auto-refresh models for local providers (Ollama, GPUStack)
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Recommend ~/.irbrc configuration instead of environment variables
|
|
13
|
+
|
|
3
14
|
## [0.1.0] - 2025-02-02
|
|
4
15
|
|
|
5
16
|
### Added
|
data/README.md
CHANGED
|
@@ -23,28 +23,33 @@ gem install girb girb-ruby_llm
|
|
|
23
23
|
|
|
24
24
|
## Setup
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
### Option 1: Configure in ~/.irbrc (Recommended)
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
Add to your `~/.irbrc`:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
require 'girb-ruby_llm'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
RubyLLM.configure do |config|
|
|
34
|
+
config.gemini_api_key = 'your-api-key'
|
|
35
|
+
end
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
Girb.configure do |c|
|
|
38
|
+
c.provider = Girb::Providers::RubyLlm.new(model: 'gemini-2.5-flash')
|
|
39
|
+
end
|
|
37
40
|
```
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
Then use regular `irb` command.
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
### Option 2: Configure via environment variables
|
|
42
45
|
|
|
43
|
-
```
|
|
44
|
-
|
|
46
|
+
```bash
|
|
47
|
+
export GIRB_PROVIDER=girb-ruby_llm
|
|
48
|
+
export GIRB_MODEL=gemini-2.5-flash
|
|
49
|
+
export GEMINI_API_KEY=your-api-key
|
|
45
50
|
```
|
|
46
51
|
|
|
47
|
-
Then
|
|
52
|
+
Then start with `girb` command.
|
|
48
53
|
|
|
49
54
|
## Configuration
|
|
50
55
|
|
|
@@ -89,6 +94,7 @@ Set your API key or endpoint as an environment variable:
|
|
|
89
94
|
|
|
90
95
|
```bash
|
|
91
96
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
97
|
+
export GIRB_MODEL=gpt-4o
|
|
92
98
|
export OPENAI_API_KEY="sk-..."
|
|
93
99
|
girb
|
|
94
100
|
```
|
|
@@ -97,6 +103,7 @@ girb
|
|
|
97
103
|
|
|
98
104
|
```bash
|
|
99
105
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
106
|
+
export GIRB_MODEL=claude-sonnet-4-20250514
|
|
100
107
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
101
108
|
girb
|
|
102
109
|
```
|
|
@@ -107,8 +114,9 @@ girb
|
|
|
107
114
|
# Start Ollama first
|
|
108
115
|
ollama serve
|
|
109
116
|
|
|
110
|
-
# Set the provider and API base URL
|
|
117
|
+
# Set the provider, model, and API base URL
|
|
111
118
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
119
|
+
export GIRB_MODEL=llama3.2:latest
|
|
112
120
|
export OLLAMA_API_BASE="http://localhost:11434/v1"
|
|
113
121
|
girb
|
|
114
122
|
```
|
|
@@ -117,29 +125,30 @@ girb
|
|
|
117
125
|
|
|
118
126
|
```bash
|
|
119
127
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
128
|
+
export GIRB_MODEL=your-model-name
|
|
120
129
|
export OPENAI_API_KEY="not-needed" # Some require any non-empty value
|
|
121
130
|
export OPENAI_API_BASE="http://localhost:1234/v1"
|
|
122
131
|
girb
|
|
123
132
|
```
|
|
124
133
|
|
|
125
|
-
###
|
|
134
|
+
### Advanced Configuration
|
|
126
135
|
|
|
127
|
-
|
|
136
|
+
For more control, configure Girb in your `~/.irbrc`:
|
|
128
137
|
|
|
129
138
|
```ruby
|
|
130
139
|
# ~/.irbrc
|
|
131
140
|
require 'girb-ruby_llm'
|
|
132
141
|
|
|
133
|
-
RubyLLM.configure do |config|
|
|
134
|
-
config.ollama_api_base = "http://localhost:11434/v1"
|
|
135
|
-
end
|
|
136
|
-
RubyLLM::Models.refresh!
|
|
137
|
-
|
|
138
142
|
Girb.configure do |c|
|
|
139
|
-
c.
|
|
143
|
+
c.debug = true # Enable debug output
|
|
144
|
+
c.custom_prompt = <<~PROMPT
|
|
145
|
+
Always confirm before destructive operations.
|
|
146
|
+
PROMPT
|
|
140
147
|
end
|
|
141
148
|
```
|
|
142
149
|
|
|
150
|
+
Note: `RubyLLM::Models.refresh!` is automatically called for local providers (Ollama, GPUStack).
|
|
151
|
+
|
|
143
152
|
## Supported Models
|
|
144
153
|
|
|
145
154
|
See [RubyLLM Available Models](https://rubyllm.com/reference/available-models) for the full list of supported models.
|
data/README_ja.md
CHANGED
|
@@ -21,28 +21,33 @@ gem install girb girb-ruby_llm
|
|
|
21
21
|
|
|
22
22
|
## セットアップ
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### 方法1: ~/.irbrcで設定(推奨)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
`~/.irbrc` に追加:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'girb-ruby_llm'
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
RubyLLM.configure do |config|
|
|
32
|
+
config.gemini_api_key = 'your-api-key'
|
|
33
|
+
end
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
Girb.configure do |c|
|
|
36
|
+
c.provider = Girb::Providers::RubyLlm.new(model: 'gemini-2.5-flash')
|
|
37
|
+
end
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
通常の `irb` コマンドで使用できます。
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
### 方法2: 環境変数で設定
|
|
40
43
|
|
|
41
|
-
```
|
|
42
|
-
|
|
44
|
+
```bash
|
|
45
|
+
export GIRB_PROVIDER=girb-ruby_llm
|
|
46
|
+
export GIRB_MODEL=gemini-2.5-flash
|
|
47
|
+
export GEMINI_API_KEY=your-api-key
|
|
43
48
|
```
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
`girb` コマンドで起動します。
|
|
46
51
|
|
|
47
52
|
## 設定
|
|
48
53
|
|
|
@@ -87,6 +92,7 @@ APIキーまたはエンドポイントを環境変数として設定します:
|
|
|
87
92
|
|
|
88
93
|
```bash
|
|
89
94
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
95
|
+
export GIRB_MODEL=gpt-4o
|
|
90
96
|
export OPENAI_API_KEY="sk-..."
|
|
91
97
|
girb
|
|
92
98
|
```
|
|
@@ -95,6 +101,7 @@ girb
|
|
|
95
101
|
|
|
96
102
|
```bash
|
|
97
103
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
104
|
+
export GIRB_MODEL=claude-sonnet-4-20250514
|
|
98
105
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
99
106
|
girb
|
|
100
107
|
```
|
|
@@ -105,8 +112,9 @@ girb
|
|
|
105
112
|
# まずOllamaを起動
|
|
106
113
|
ollama serve
|
|
107
114
|
|
|
108
|
-
#
|
|
115
|
+
# プロバイダー、モデル、APIベースURLを設定
|
|
109
116
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
117
|
+
export GIRB_MODEL=llama3.2:latest
|
|
110
118
|
export OLLAMA_API_BASE="http://localhost:11434/v1"
|
|
111
119
|
girb
|
|
112
120
|
```
|
|
@@ -115,29 +123,30 @@ girb
|
|
|
115
123
|
|
|
116
124
|
```bash
|
|
117
125
|
export GIRB_PROVIDER=girb-ruby_llm
|
|
126
|
+
export GIRB_MODEL=your-model-name
|
|
118
127
|
export OPENAI_API_KEY="not-needed" # 空でない値が必要な場合
|
|
119
128
|
export OPENAI_API_BASE="http://localhost:1234/v1"
|
|
120
129
|
girb
|
|
121
130
|
```
|
|
122
131
|
|
|
123
|
-
###
|
|
132
|
+
### 詳細設定
|
|
124
133
|
|
|
125
|
-
|
|
134
|
+
より細かい制御が必要な場合、`~/.irbrc`でGirbを設定できます:
|
|
126
135
|
|
|
127
136
|
```ruby
|
|
128
137
|
# ~/.irbrc
|
|
129
138
|
require 'girb-ruby_llm'
|
|
130
139
|
|
|
131
|
-
RubyLLM.configure do |config|
|
|
132
|
-
config.ollama_api_base = "http://localhost:11434/v1"
|
|
133
|
-
end
|
|
134
|
-
RubyLLM::Models.refresh!
|
|
135
|
-
|
|
136
140
|
Girb.configure do |c|
|
|
137
|
-
c.
|
|
141
|
+
c.debug = true # デバッグ出力を有効化
|
|
142
|
+
c.custom_prompt = <<~PROMPT
|
|
143
|
+
破壊的操作の前に必ず確認してください。
|
|
144
|
+
PROMPT
|
|
138
145
|
end
|
|
139
146
|
```
|
|
140
147
|
|
|
148
|
+
注: ローカルプロバイダー(Ollama、GPUStack)使用時は`RubyLLM::Models.refresh!`が自動的に呼ばれます。
|
|
149
|
+
|
|
141
150
|
## 対応モデル
|
|
142
151
|
|
|
143
152
|
サポートされているモデルの完全なリストは[RubyLLM Available Models](https://rubyllm.com/reference/available-models)を参照してください。
|
data/lib/girb-ruby_llm.rb
CHANGED
|
@@ -32,6 +32,9 @@ RUBY_LLM_CONFIG_MAP = {
|
|
|
32
32
|
# Check if any RubyLLM config is available
|
|
33
33
|
has_config = RUBY_LLM_CONFIG_MAP.any? { |env_var, _| ENV[env_var] }
|
|
34
34
|
|
|
35
|
+
# Local providers that require Models.refresh!
|
|
36
|
+
LOCAL_PROVIDERS = %w[OLLAMA_API_BASE GPUSTACK_API_BASE].freeze
|
|
37
|
+
|
|
35
38
|
if has_config
|
|
36
39
|
# Configure RubyLLM with all available environment variables
|
|
37
40
|
RubyLLM.configure do |config|
|
|
@@ -40,9 +43,18 @@ if has_config
|
|
|
40
43
|
end
|
|
41
44
|
end
|
|
42
45
|
|
|
46
|
+
# Refresh models for local providers (Ollama, GPUStack)
|
|
47
|
+
if LOCAL_PROVIDERS.any? { |env_var| ENV[env_var] }
|
|
48
|
+
RubyLLM::Models.refresh!
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
model = ENV["GIRB_MODEL"]
|
|
52
|
+
unless model
|
|
53
|
+
warn "[girb-ruby_llm] GIRB_MODEL not set. Please specify a model."
|
|
54
|
+
warn "[girb-ruby_llm] Example: export GIRB_MODEL=gemini-2.5-flash"
|
|
55
|
+
end
|
|
56
|
+
|
|
43
57
|
Girb.configure do |c|
|
|
44
|
-
|
|
45
|
-
c.provider = Girb::Providers::RubyLlm.new(model: c.model)
|
|
46
|
-
end
|
|
58
|
+
c.provider ||= Girb::Providers::RubyLlm.new(model: model)
|
|
47
59
|
end
|
|
48
60
|
end
|