friday_gemini_ai 1.5.0 → 1.7.0
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/LICENSE +1 -1
- data/README.md +90 -258
- data/lib/core/client.rb +2 -8
- data/lib/core/errors.rb +1 -1
- data/lib/core/version.rb +2 -2
- data/lib/gemini.rb +1 -1
- data/lib/mac/README.md +1 -1
- data/lib/mac/mac_utils.rb +1 -1
- data/lib/utils/loader.rb +1 -1
- data/lib/utils/logger.rb +1 -1
- data/lib/{friday_gemini_ai.rb → vesper.rb} +2 -2
- metadata +88 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d5c83ef0aa33cc8b34dedeee84dcad73a915a824bc5e2cd1f5f7b6c89b265dc
|
|
4
|
+
data.tar.gz: d8752da587505a0f6d356f9c467efaf3500132ed9d3bb37cee0655764cf830e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 854efbca4c0d58211726c4c581888483ddc13832dbebe28520cc9846176ca01086be62857ef9330ca78269310b690dcc40530cbda73f939abe599d9f9c081f70
|
|
7
|
+
data.tar.gz: fd3dd5f46dbdbfe3ab1bca479c519f0257104314d97267a2cf68dbc4794e4b36cb08feeef443864e4e8264c6fed920cc250293e8abbba58b4eaaf2373170efd8
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vesper
|
|
2
|
+
<img src="website/assets/readme-header.png" alt="Vesper" width="100%">
|
|
2
3
|
|
|
3
|
-
[](https://github.com/bniladridas/friday_gemini_ai/actions/workflows/ci.yml)
|
|
4
|
-
[](https://github.com/bniladridas/friday_gemini_ai/actions/workflows/security.yml)
|
|
5
|
-
[](https://github.com/bniladridas/friday_gemini_ai/actions/workflows/dependencies.yml)
|
|
6
|
-
[](https://github.com/bniladridas/friday_gemini_ai/actions/workflows/harperbot.yml)
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
[](https://rubygems.org/gems/friday_gemini_ai)
|
|
6
|
+

|
|
7
|
+
[](LICENSE)
|
|
8
|
+

|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Ruby client for Google's Gemini models, with a small CLI and an optional PR-review companion.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
<br>
|
|
14
|
+
|
|
15
|
+
# Installation
|
|
13
16
|
|
|
14
17
|
```bash
|
|
15
18
|
gem install friday_gemini_ai
|
|
16
19
|
```
|
|
17
20
|
|
|
21
|
+
With Bundler:
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
gem 'friday_gemini_ai', require: 'vesper'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The package is published as `friday_gemini_ai`. The runtime entrypoint is `vesper`.
|
|
28
|
+
|
|
18
29
|
Set your API key in `.env`:
|
|
19
30
|
|
|
20
31
|
```
|
|
@@ -24,51 +35,26 @@ GEMINI_API_KEY=your_api_key
|
|
|
24
35
|
> [!NOTE]
|
|
25
36
|
> Ensure your API key is kept secure and not committed to version control.
|
|
26
37
|
|
|
27
|
-
## HarperBot Integration
|
|
28
|
-
|
|
29
|
-
HarperBot provides automated PR code reviews using Google's Gemini AI. It supports two deployment modes:
|
|
30
|
-
|
|
31
|
-
### Webhook Mode (Recommended)
|
|
32
|
-
This is the preferred deployment path. You need to:
|
|
33
|
-
|
|
34
|
-
- Install the [HarperBot GitHub App](https://github.com/apps/harper-new-line) and grant it access to the repositories you want to monitor.
|
|
35
|
-
- Provision these secrets (in Vercel or another host) so the webhook server can authenticate with both Gemini and GitHub:
|
|
36
|
-
- `GEMINI_API_KEY`
|
|
37
|
-
- `HARPERBOT_GEMINI_API_KEY` *(optional override)*
|
|
38
|
-
- `HARPER_BOT_APP_ID`
|
|
39
|
-
- `HARPER_BOT_PRIVATE_KEY`
|
|
40
|
-
- `WEBHOOK_SECRET`
|
|
41
|
-
- Subscribe the app webhooks to **Pull request** and **Issue comment** events so HarperBot receives new PRs and manual `/analyze` commands.
|
|
42
|
-
- When you migrate the app to a different GitHub account, uninstall the previous installation so the retired app stops receiving webhooks and you avoid duplicate comments.
|
|
43
|
-
- Regenerate the webhook secret whenever the app changes hands (or whenever you suspect it was leaked) and update the `WEBHOOK_SECRET` environment variable before resuming deployments.
|
|
44
|
-
- Deploy the webhook service behind a production WSGI server (for example, Gunicorn) whenever you self-host it outside Vercel; Flask's dev server is not safe for production traffic.
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
<br>
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Workflow Mode (Legacy)
|
|
51
|
-
- Repository-specific GitHub Actions workflow
|
|
52
|
-
- Requires secrets setup per repository
|
|
53
|
-
- Automated setup: `curl -fsSL https://raw.githubusercontent.com/bniladridas/friday_gemini_ai/main/bin/setup-harperbot | bash` (use `--update` to update, `--dry-run` to preview)
|
|
54
|
-
- **Note:** This is legacy mode for existing users. New installations should use Webhook Mode for better scalability and centralized management
|
|
55
|
-
|
|
56
|
-
For detailed setup instructions, see [harperbot/HarperBot.md](harperbot/HarperBot.md).
|
|
57
|
-
|
|
58
|
-
## Usage
|
|
59
|
-
|
|
60
|
-
The full API of this library can be found in [docs/reference/api.md](docs/reference/api.md).
|
|
41
|
+
# Usage
|
|
61
42
|
|
|
62
43
|
### Basic Setup
|
|
63
44
|
|
|
64
|
-
**Security Note for Automated Setup:** The recommended `curl | bash` method downloads and executes code from the internet. For security, review the script at https://github.com/bniladridas/friday_gemini_ai/blob/main/bin/setup-harperbot before running. Alternatively, download first: `curl -O https://raw.githubusercontent.com/bniladridas/friday_gemini_ai/main/bin/setup-harperbot`, inspect, then `bash setup-harperbot`.
|
|
65
|
-
|
|
66
45
|
```ruby
|
|
67
|
-
require '
|
|
46
|
+
require 'vesper'
|
|
68
47
|
GeminiAI.load_env
|
|
69
48
|
|
|
70
|
-
client = GeminiAI::Client.new
|
|
49
|
+
client = GeminiAI::Client.new
|
|
50
|
+
puts client.generate_text('Write a haiku about Ruby')
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use a different model when needed:
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
71
56
|
fast_client = GeminiAI::Client.new(model: :flash)
|
|
57
|
+
puts fast_client.generate_text('Explain Ruby in one sentence')
|
|
72
58
|
```
|
|
73
59
|
|
|
74
60
|
### Model Reference
|
|
@@ -80,157 +66,76 @@ fast_client = GeminiAI::Client.new(model: :flash)
|
|
|
80
66
|
| `:flash_2_0` | `gemini-2.0-flash` | Legacy support |
|
|
81
67
|
| `:flash_lite` | `gemini-2.0-flash-lite` | Lightweight legacy |
|
|
82
68
|
|
|
83
|
-
## Capabilities
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
<br>
|
|
71
|
+
|
|
72
|
+
# Capabilities
|
|
73
|
+
|
|
74
|
+
Vesper supports text generation, chat, image-to-text analysis, model aliases, safety settings, API key masking, retry handling, and a local CLI for quick prompts.
|
|
89
75
|
|
|
90
|
-
## Features
|
|
91
76
|
|
|
92
|
-
|
|
93
|
-
* **Text Generation:** configurable parameters, safety settings
|
|
94
|
-
* **Image Analysis:** base64 image input, detailed descriptions
|
|
95
|
-
* **Chat:** context retention, system instructions
|
|
96
|
-
* **Security:** API key masking, retries, and rate limits (1s default, 3s CI)
|
|
77
|
+
<br>
|
|
97
78
|
|
|
98
|
-
|
|
79
|
+
# Handling Errors
|
|
99
80
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
a subclass of `GeminiAI::APIError` will be thrown:
|
|
81
|
+
Client validation and API failures raise `GeminiAI::Error` with a readable message.
|
|
82
|
+
HTTP 429 responses are retried automatically up to three times with exponential backoff.
|
|
103
83
|
|
|
104
84
|
```ruby
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
else
|
|
111
|
-
raise err
|
|
112
|
-
end
|
|
85
|
+
begin
|
|
86
|
+
response = client.generate_text('Hello')
|
|
87
|
+
puts response
|
|
88
|
+
rescue GeminiAI::Error => err
|
|
89
|
+
warn "Generation failed: #{err.message}"
|
|
113
90
|
end
|
|
114
91
|
```
|
|
115
92
|
|
|
116
|
-
|
|
93
|
+
Common failures include:
|
|
117
94
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
| 404 | `NotFoundError` |
|
|
124
|
-
| 422 | `UnprocessableEntityError` |
|
|
125
|
-
| 429 | `RateLimitError` |
|
|
126
|
-
| >=500 | `InternalServerError` |
|
|
127
|
-
| N/A | `APIConnectionError` |
|
|
95
|
+
- Missing or invalid `GEMINI_API_KEY`
|
|
96
|
+
- Empty prompts
|
|
97
|
+
- Prompts over the configured maximum length
|
|
98
|
+
- Gemini API errors returned by the service
|
|
99
|
+
- Network errors raised by HTTParty
|
|
128
100
|
|
|
129
101
|
### Retries
|
|
130
102
|
|
|
131
|
-
|
|
132
|
-
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
|
133
|
-
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
|
134
|
-
|
|
135
|
-
You can use the `max_retries` option to configure or disable this:
|
|
136
|
-
|
|
137
|
-
```ruby
|
|
138
|
-
# Configure the default for all requests:
|
|
139
|
-
client = GeminiAI::Client.new(max_retries: 0) # default is 2
|
|
140
|
-
|
|
141
|
-
# Or, configure per-request:
|
|
142
|
-
client.generate_text('Hello', max_retries: 5)
|
|
143
|
-
```
|
|
103
|
+
Rate-limit responses (`429`) are retried up to three times with waits of 5, 10, and 20 seconds.
|
|
144
104
|
|
|
145
105
|
### Timeouts
|
|
146
106
|
|
|
147
|
-
Requests
|
|
107
|
+
Requests use a 30 second HTTParty timeout.
|
|
148
108
|
|
|
149
|
-
```ruby
|
|
150
|
-
# Configure the default for all requests:
|
|
151
|
-
client = GeminiAI::Client.new(timeout: 20) # 20 seconds (default is 60)
|
|
152
109
|
|
|
153
|
-
|
|
154
|
-
client.generate_text('Hello', timeout: 5)
|
|
155
|
-
```
|
|
110
|
+
<br>
|
|
156
111
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Note that requests which time out will be [retried twice by default](#retries).
|
|
160
|
-
|
|
161
|
-
## Advanced Usage
|
|
162
|
-
|
|
163
|
-
### Logging
|
|
164
|
-
|
|
165
|
-
> [!IMPORTANT]
|
|
166
|
-
> All log messages are intended for debugging only. The format and content of log messages
|
|
167
|
-
> may change between releases.
|
|
168
|
-
|
|
169
|
-
#### Log levels
|
|
170
|
-
|
|
171
|
-
The log level can be configured via the `GEMINI_LOG_LEVEL` environment variable or client option.
|
|
172
|
-
|
|
173
|
-
Available log levels, from most to least verbose:
|
|
174
|
-
|
|
175
|
-
- `'debug'` - Show debug messages, info, warnings, and errors
|
|
176
|
-
- `'info'` - Show info messages, warnings, and errors
|
|
177
|
-
- `'warn'` - Show warnings and errors (default)
|
|
178
|
-
- `'error'` - Show only errors
|
|
179
|
-
- `'off'` - Disable all logging
|
|
112
|
+
# Logging
|
|
180
113
|
|
|
181
114
|
```ruby
|
|
182
|
-
require '
|
|
115
|
+
require 'vesper'
|
|
183
116
|
|
|
184
|
-
|
|
117
|
+
GeminiAI::Client.logger.level = Logger::INFO
|
|
118
|
+
client = GeminiAI::Client.new
|
|
185
119
|
```
|
|
186
120
|
|
|
187
|
-
## Frequently Asked Questions
|
|
188
121
|
|
|
189
|
-
|
|
122
|
+
<br>
|
|
190
123
|
|
|
191
|
-
|
|
124
|
+
# Requirements
|
|
192
125
|
|
|
193
|
-
1
|
|
194
|
-
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
195
|
-
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
126
|
+
Ruby 3.1 or later. Linux and macOS are recommended.
|
|
196
127
|
|
|
197
|
-
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
198
128
|
|
|
199
|
-
|
|
129
|
+
<br>
|
|
200
130
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
Ruby 3.0 or later is supported.
|
|
204
|
-
|
|
205
|
-
The following runtimes are supported:
|
|
206
|
-
|
|
207
|
-
- Ruby 3.0+
|
|
208
|
-
- JRuby (compatible versions)
|
|
209
|
-
- TruffleRuby (compatible versions)
|
|
210
|
-
|
|
211
|
-
Note that Windows support is limited; Linux and macOS are recommended.
|
|
212
|
-
|
|
213
|
-
## Migration Guide
|
|
214
|
-
|
|
215
|
-
Gemini 1.5 models have been deprecated.
|
|
216
|
-
Use:
|
|
217
|
-
|
|
218
|
-
* `:pro` → `gemini-2.5-pro`
|
|
219
|
-
* `:flash` → `gemini-2.5-flash`
|
|
220
|
-
|
|
221
|
-
Legacy options (`:flash_2_0`, `:flash_lite`) remain supported for backward compatibility.
|
|
222
|
-
|
|
223
|
-
## Environment Variables
|
|
131
|
+
# Environment Variables
|
|
224
132
|
|
|
225
133
|
```bash
|
|
226
|
-
# Required
|
|
227
134
|
GEMINI_API_KEY=your_api_key_here
|
|
228
|
-
|
|
229
|
-
# Optional
|
|
230
|
-
GEMINI_LOG_LEVEL=debug # debug | info | warn | error
|
|
135
|
+
HARPERBOT_GEMINI_API_KEY=your_api_key_here
|
|
231
136
|
```
|
|
232
137
|
|
|
233
|
-
### CLI
|
|
138
|
+
### Repo CLI
|
|
234
139
|
|
|
235
140
|
```bash
|
|
236
141
|
./bin/gemini test
|
|
@@ -238,70 +143,10 @@ GEMINI_LOG_LEVEL=debug # debug | info | warn | error
|
|
|
238
143
|
./bin/gemini chat
|
|
239
144
|
```
|
|
240
145
|
|
|
241
|
-
## GitHub Actions Integration
|
|
242
|
-
|
|
243
|
-
Friday Gemini AI includes a built-in GitHub Actions workflow for automated PR reviews via **HarperBot**, powered by Gemini AI.
|
|
244
|
-
|
|
245
|
-
💡 **Install the [HarperBot GitHub App](https://github.com/apps/harper-new-line)** for automated PR reviews across repositories.
|
|
246
|
-
|
|
247
|
-
### HarperBot – Automated PR Analysis
|
|
248
|
-
|
|
249
|
-
HarperBot provides AI-driven code review and analysis directly in pull requests.
|
|
250
|
-
|
|
251
|
-
**Key Capabilities:**
|
|
252
|
-
|
|
253
|
-
* Configurable focus: `all`, `security`, `performance`, `quality`
|
|
254
|
-
* Code quality, documentation, and test coverage analysis
|
|
255
|
-
* Security & performance issue detection
|
|
256
|
-
* Inline review comments with actionable suggestions
|
|
257
|
-
* Clean, minimal, and structured feedback output
|
|
258
|
-
|
|
259
|
-
### Setup
|
|
260
|
-
|
|
261
|
-
**Workflow Mode (default)**
|
|
262
|
-
|
|
263
|
-
1. Add repository secrets:
|
|
264
146
|
|
|
265
|
-
|
|
266
|
-
* `GITHUB_TOKEN` (auto-provided by GitHub)
|
|
267
|
-
2. Configure `.github/workflows/harperbot.yml`
|
|
268
|
-
3. Optional: tune behavior via `harperbot/config.yaml`
|
|
147
|
+
<br>
|
|
269
148
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
* Deploy to Vercel (production branch)
|
|
273
|
-
* Install the [HarperBot GitHub App](https://github.com/apps/harper-new-line) and grant it access to your repositories
|
|
274
|
-
* Set environment variables in Vercel:
|
|
275
|
-
- `GEMINI_API_KEY`: Your Google Gemini API key
|
|
276
|
-
- `HARPER_BOT_APP_ID`: App ID from your GitHub App settings
|
|
277
|
-
- `HARPER_BOT_PRIVATE_KEY`: Private key content (paste the entire .pem file)
|
|
278
|
-
- `WEBHOOK_SECRET`: Random secret string for webhook verification
|
|
279
|
-
- `VERCEL_AUTOMATION_BYPASS_SECRET`: Automatically generated by Vercel for deployment protection bypass (managed in Vercel dashboard)
|
|
280
|
-
* Configure webhook URL in GitHub App settings:
|
|
281
|
-
- Use the Vercel deployment URL (e.g., `https://your-project.vercel.app/webhook`)
|
|
282
|
-
- Append the bypass token as a query parameter (managed in Vercel dashboard, never commit to code)
|
|
283
|
-
* Webhooks will handle PR events automatically (opened, reopened, synchronize)
|
|
284
|
-
* Preferred for scalability and centralized management
|
|
285
|
-
|
|
286
|
-
**Security Note:** The bypass token for Vercel deployment protection should be stored securely in Vercel's environment variables, not exposed in public documentation or code repositories.
|
|
287
|
-
|
|
288
|
-
### Workflow Highlights
|
|
289
|
-
|
|
290
|
-
* **Pull Requests:** triggered on open, update, or reopen
|
|
291
|
-
* **Push to main:** runs Gemini CLI verification
|
|
292
|
-
* **Concurrency control:** cancels redundant runs for efficiency
|
|
293
|
-
|
|
294
|
-
Required permissions:
|
|
295
|
-
|
|
296
|
-
```yaml
|
|
297
|
-
permissions:
|
|
298
|
-
contents: read
|
|
299
|
-
pull-requests: write
|
|
300
|
-
issues: write
|
|
301
|
-
statuses: write
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Local Development & Testing
|
|
149
|
+
# Local Development & Testing
|
|
305
150
|
|
|
306
151
|
```bash
|
|
307
152
|
bundle exec rake test # Run tests
|
|
@@ -309,16 +154,17 @@ bundle exec rake rubocop # Optional lint check
|
|
|
309
154
|
gem build *.gemspec # Verify build
|
|
310
155
|
```
|
|
311
156
|
|
|
312
|
-
### Test Workflows Locally
|
|
313
157
|
|
|
314
|
-
|
|
158
|
+
<br>
|
|
315
159
|
|
|
316
|
-
|
|
317
|
-
brew install act
|
|
318
|
-
act -j test --container-architecture linux/amd64
|
|
319
|
-
```
|
|
160
|
+
# HarperBot
|
|
320
161
|
|
|
321
|
-
|
|
162
|
+
HarperBot is the optional PR-review companion included in this repo. For setup details, see [harperbot/HarperBot.md](harperbot/HarperBot.md).
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<br>
|
|
166
|
+
|
|
167
|
+
# Examples
|
|
322
168
|
|
|
323
169
|
### Text Generation
|
|
324
170
|
|
|
@@ -345,44 +191,30 @@ messages = [
|
|
|
345
191
|
puts client.chat(messages, system_instruction: 'Be helpful and concise.')
|
|
346
192
|
```
|
|
347
193
|
|
|
348
|
-
## Conventional Commits
|
|
349
194
|
|
|
350
|
-
|
|
195
|
+
<br>
|
|
351
196
|
|
|
352
|
-
|
|
353
|
-
cp scripts/commit-msg .git/hooks/
|
|
354
|
-
chmod +x .git/hooks/commit-msg
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
|
|
358
|
-
Example:
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
git commit -m "feat: add user authentication"
|
|
362
|
-
```
|
|
197
|
+
# Documentation
|
|
363
198
|
|
|
364
|
-
|
|
199
|
+
| Need | Link |
|
|
200
|
+
| --- | --- |
|
|
201
|
+
| Start | [Quickstart](docs/start/quickstart.md) |
|
|
202
|
+
| API | [Reference](docs/reference/api.md) |
|
|
203
|
+
| Recipes | [Cookbook](docs/reference/cookbook.md) |
|
|
204
|
+
| Practice | [Best practices](docs/guides/practices.md) |
|
|
205
|
+
| Automation | [Workflows](docs/guides/workflows.md) |
|
|
206
|
+
| Project | [Contributing](docs/CONTRIBUTING.md) |
|
|
365
207
|
|
|
366
|
-
* [Documentation](docs/index.md)
|
|
367
|
-
* [Quickstart](docs/start/quickstart.md)
|
|
368
|
-
* [API Reference](docs/reference/api.md)
|
|
369
|
-
* [Cookbook](docs/reference/cookbook.md)
|
|
370
|
-
* [Best Practices](docs/guides/practices.md)
|
|
371
|
-
* [CI/CD Workflows](docs/guides/workflows.md)
|
|
372
|
-
* [Changelog](docs/CHANGELOG.md)
|
|
373
|
-
* [Contributing](docs/CONTRIBUTING.md)
|
|
374
|
-
* [Resources](docs/guides/resources.md)
|
|
375
208
|
|
|
376
|
-
|
|
209
|
+
<br>
|
|
377
210
|
|
|
378
|
-
|
|
211
|
+
# Contributing
|
|
379
212
|
|
|
380
|
-
|
|
213
|
+
Fork the repo and open a pull request.
|
|
381
214
|
|
|
382
|
-
MIT – see [LICENSE](LICENSE).
|
|
383
215
|
|
|
384
|
-
<
|
|
216
|
+
<br>
|
|
385
217
|
|
|
386
|
-
|
|
218
|
+
# License
|
|
387
219
|
|
|
388
|
-
|
|
220
|
+
MIT → see [LICENSE](LICENSE).
|
data/lib/core/client.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
|
-
# Copyright (c) 2026
|
|
3
|
+
# Copyright (c) 2026 vesper
|
|
4
4
|
|
|
5
5
|
require 'httparty'
|
|
6
6
|
require 'json'
|
|
@@ -49,7 +49,6 @@ module GeminiAI
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def initialize(api_key = nil, model: :pro)
|
|
52
|
-
puts "Initializing client with api_key: #{api_key.inspect}, model: #{model}"
|
|
53
52
|
# Prioritize passed API key, then environment variable
|
|
54
53
|
@api_key = api_key || ENV.fetch('GEMINI_API_KEY', nil)
|
|
55
54
|
|
|
@@ -64,7 +63,6 @@ module GeminiAI
|
|
|
64
63
|
self.class.logger.debug("API Key length: #{@api_key&.length}")
|
|
65
64
|
|
|
66
65
|
# Validate API key before proceeding
|
|
67
|
-
puts "About to validate API key: #{@api_key.inspect}"
|
|
68
66
|
validate_api_key!
|
|
69
67
|
|
|
70
68
|
@model = resolve_model(model)
|
|
@@ -154,16 +152,13 @@ module GeminiAI
|
|
|
154
152
|
end
|
|
155
153
|
|
|
156
154
|
def validate_api_key!
|
|
157
|
-
puts "Validating API key: #{@api_key.inspect}"
|
|
158
155
|
if @api_key.nil? || @api_key.to_s.strip.empty?
|
|
159
|
-
puts 'API key is nil or empty'
|
|
160
156
|
self.class.logger.error('API key is missing')
|
|
161
157
|
raise Error, 'API key is required. Set GEMINI_API_KEY environment variable or pass key directly.'
|
|
162
158
|
end
|
|
163
159
|
|
|
164
160
|
# Optional: Add basic API key format validation
|
|
165
161
|
unless valid_api_key_format?(@api_key)
|
|
166
|
-
puts 'API key format is invalid'
|
|
167
162
|
self.class.logger.error('Invalid API key format')
|
|
168
163
|
raise Error, 'Invalid API key format. Please check your key.'
|
|
169
164
|
end
|
|
@@ -171,7 +166,6 @@ module GeminiAI
|
|
|
171
166
|
# Optional: Check key length and complexity
|
|
172
167
|
return unless @api_key.length < 40
|
|
173
168
|
|
|
174
|
-
puts 'API key is too short'
|
|
175
169
|
self.class.logger.warn('Potentially weak API key detected')
|
|
176
170
|
end
|
|
177
171
|
|
|
@@ -219,7 +213,7 @@ module GeminiAI
|
|
|
219
213
|
body: body.to_json,
|
|
220
214
|
headers: {
|
|
221
215
|
'Content-Type' => 'application/json',
|
|
222
|
-
'x-goog-api-client' => '
|
|
216
|
+
'x-goog-api-client' => 'vesper_ruby_gem/0.1.0'
|
|
223
217
|
},
|
|
224
218
|
timeout: 30
|
|
225
219
|
)
|
data/lib/core/errors.rb
CHANGED
data/lib/core/version.rb
CHANGED
data/lib/gemini.rb
CHANGED
data/lib/mac/README.md
CHANGED
data/lib/mac/mac_utils.rb
CHANGED
data/lib/utils/loader.rb
CHANGED
data/lib/utils/logger.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: friday_gemini_ai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Niladri Das
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -86,6 +86,90 @@ dependencies:
|
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: 13.3.1
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: github-markup
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '5.0'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '5.0'
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: redcarpet
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '3.6'
|
|
110
|
+
type: :development
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '3.6'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: yard
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 0.9.34
|
|
124
|
+
type: :development
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: 0.9.34
|
|
131
|
+
- !ruby/object:Gem::Dependency
|
|
132
|
+
name: rubocop
|
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: 1.72.1
|
|
138
|
+
type: :development
|
|
139
|
+
prerelease: false
|
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - "~>"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: 1.72.1
|
|
145
|
+
- !ruby/object:Gem::Dependency
|
|
146
|
+
name: rubocop-minitest
|
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - "~>"
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: 0.25.0
|
|
152
|
+
type: :development
|
|
153
|
+
prerelease: false
|
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
+
requirements:
|
|
156
|
+
- - "~>"
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: 0.25.0
|
|
159
|
+
- !ruby/object:Gem::Dependency
|
|
160
|
+
name: rubocop-rake
|
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - "~>"
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: 0.6.0
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: 0.6.0
|
|
89
173
|
description: Provides easy text generation capabilities using Google's Gemini AI models
|
|
90
174
|
email:
|
|
91
175
|
- bniladridas@gmail.com
|
|
@@ -98,14 +182,14 @@ files:
|
|
|
98
182
|
- lib/core/client.rb
|
|
99
183
|
- lib/core/errors.rb
|
|
100
184
|
- lib/core/version.rb
|
|
101
|
-
- lib/friday_gemini_ai.rb
|
|
102
185
|
- lib/gemini.rb
|
|
103
186
|
- lib/mac/README.md
|
|
104
187
|
- lib/mac/mac_utils.rb
|
|
105
188
|
- lib/utils/loader.rb
|
|
106
189
|
- lib/utils/logger.rb
|
|
107
190
|
- lib/utils/moderation.rb
|
|
108
|
-
|
|
191
|
+
- lib/vesper.rb
|
|
192
|
+
homepage: https://github.com/bniladridas/vesper
|
|
109
193
|
licenses:
|
|
110
194
|
- MIT
|
|
111
195
|
metadata:
|