ruby-gemini-api 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d3fab54be3c9a6830811a1ee33e72aa775d8f313a9aaaa702219b2fbd9393db
4
- data.tar.gz: 64a8c2089d56cad74c8847ebb58cf34d810bbb1bc77e7b7500151c268a7f88d5
3
+ metadata.gz: f5a02e1edca475bc3a7ab45e9e595186a99e2546fb46c1f1f1232a8215d45469
4
+ data.tar.gz: a688b8e1a0bb724ab24d8cb1113ad689a784bc41915b180e17e9b4552dad4628
5
5
  SHA512:
6
- metadata.gz: 3e6155154922f2b29c55271c35483b1e4a29aa406117d6b880235b501a7af2b10234f997b5149ed6f1a2c708889a652140debc91132854f9bca7139c3130958a
7
- data.tar.gz: d2257648e0a703931e16d057b2a62c340ce595e385c160a00b3a43abf9604ded4f9619401c96b3b8765159d4f2b8efcde9bb34c3623d27fa258004252320c0e9
6
+ metadata.gz: a5d4af0804fb7ded6bbf069b492b31b56979ab6421dafcf671704a8aae62405946ca4efa6cdb1ef13ab69ec16a19fb0b1d19df5045d6840ae843c7500250094d
7
+ data.tar.gz: e9c83f07e0cfb54827d7c0a4180ab8731a7b8580669073d7d9acfe0a8b45b015d18c42acf6fbd1ffd2da3b9acb89ea7723da7e1abba756761666944a985f63dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## [Unreleased]
2
2
 
3
3
  ## [0.1.0] - 2025-04-05
4
-
5
4
  - Initial release
5
+
6
+ ## [0.1.1] - 2025-05-04
7
+ - Changed generate_contents to accept temperature parameter
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- [README ‐ 日本語](https://github.com/rira100000000/ruby-gemini/wiki/README-%E2%80%90-%E6%97%A5%E6%9C%AC%E8%AA%9E)
2
- # Ruby-Gemini
1
+ [README ‐ 日本語](https://github.com/rira100000000/ruby-gemini-api/wiki/README-%E2%80%90-%E6%97%A5%E6%9C%AC%E8%AA%9E)
2
+ # Ruby-Gemini-API
3
3
 
4
4
  A Ruby client library for Google's Gemini API. This gem provides a simple, intuitive interface for interacting with Gemini's generative AI capabilities, following patterns similar to other AI client libraries.
5
5
 
@@ -23,7 +23,7 @@ This project is inspired by and pays homage to [ruby-openai](https://github.com/
23
23
  Add this line to your application's Gemfile:
24
24
 
25
25
  ```ruby
26
- gem 'ruby-gemini'
26
+ gem 'ruby-gemini-api'
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -35,7 +35,7 @@ $ bundle install
35
35
  Or install it yourself as:
36
36
 
37
37
  ```bash
38
- $ gem install ruby-gemini
38
+ $ gem install ruby-gemini-api
39
39
  ```
40
40
 
41
41
  ## Quick Start
data/lib/gemini/client.rb CHANGED
@@ -118,7 +118,7 @@ module Gemini
118
118
 
119
119
  # Method with usage similar to OpenAI's chat
120
120
  def generate_content(prompt, model: "gemini-2.0-flash-lite", system_instruction: nil,
121
- response_mime_type: nil, response_schema: nil, **parameters, &stream_callback)
121
+ response_mime_type: nil, response_schema: nil, temperature: 0.5, **parameters, &stream_callback)
122
122
  # For image/text combinations, the prompt is passed as an array
123
123
  # example: [{type: "text", text: "What is this?"}, {type: "image_url", image_url: {url: "https://example.com/image.jpg"}}]
124
124
  content = format_content(prompt)
@@ -131,18 +131,16 @@ module Gemini
131
131
  params[:system_instruction] = format_content(system_instruction)
132
132
  end
133
133
 
134
- if response_mime_type || response_schema
135
134
  params[:generation_config] ||= {}
136
135
 
137
- if response_mime_type
138
- params[:generation_config]["response_mime_type"] = response_mime_type
139
- end
140
-
141
- if response_schema
142
- params[:generation_config]["response_schema"] = response_schema
143
- end
136
+ if response_mime_type
137
+ params[:generation_config]["response_mime_type"] = response_mime_type
144
138
  end
145
139
 
140
+ if response_schema
141
+ params[:generation_config]["response_schema"] = response_schema
142
+ end
143
+ params[:generation_config]["temperature"] = temperature
146
144
  # Merge other parameters
147
145
  params.merge!(parameters)
148
146
 
@@ -155,7 +153,7 @@ module Gemini
155
153
 
156
154
  # Streaming text generation
157
155
  def generate_content_stream(prompt, model: "gemini-2.0-flash-lite", system_instruction: nil,
158
- response_mime_type: nil, response_schema: nil, **parameters, &block)
156
+ response_mime_type: nil, response_schema: nil, temperature: 0.5, **parameters, &block)
159
157
  raise ArgumentError, "Block is required for streaming" unless block_given?
160
158
 
161
159
  content = format_content(prompt)
@@ -168,18 +166,16 @@ module Gemini
168
166
  params[:system_instruction] = format_content(system_instruction)
169
167
  end
170
168
 
171
- if response_mime_type || response_schema
172
- params[:generation_config] ||= {}
173
-
174
- if response_mime_type
175
- params[:generation_config][:response_mime_type] = response_mime_type
176
- end
177
-
178
- if response_schema
179
- params[:generation_config][:response_schema] = response_schema
180
- end
169
+ params[:generation_config] ||= {}
170
+
171
+ if response_mime_type
172
+ params[:generation_config][:response_mime_type] = response_mime_type
181
173
  end
182
174
 
175
+ if response_schema
176
+ params[:generation_config][:response_schema] = response_schema
177
+ end
178
+ params[:generation_config]["temperature"] = temperature
183
179
  # Merge other parameters
184
180
  params.merge!(parameters)
185
181
 
@@ -13,7 +13,7 @@ module Gemini
13
13
  def default_headers
14
14
  {
15
15
  "Content-Type" => "application/json",
16
- "User-Agent" => "ruby-gemini/#{Gemini::VERSION}"
16
+ "User-Agent" => "ruby-gemini-api/#{Gemini::VERSION}"
17
17
  }
18
18
  end
19
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gemini
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/gemini.rb CHANGED
@@ -73,7 +73,7 @@ module Gemini
73
73
  color = level == :error ? "\033[31m" : "\033[33m"
74
74
  logger = Logger.new($stdout)
75
75
  logger.formatter = proc do |_severity, _datetime, _progname, msg|
76
- "#{color}#{prefix} (spotted in ruby-gemini #{VERSION}): #{msg}\n\033[0m"
76
+ "#{color}#{prefix} (spotted in ruby-gemini-api #{VERSION}): #{msg}\n\033[0m"
77
77
  end
78
78
  logger.send(level, message)
79
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-gemini-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rira100000000
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-13 00:00:00.000000000 Z
11
+ date: 2025-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -163,13 +163,13 @@ files:
163
163
  - lib/gemini/threads.rb
164
164
  - lib/gemini/version.rb
165
165
  - lib/ruby/gemini.rb
166
- homepage: https://github.com/rira100000000/ruby-gemini
166
+ homepage: https://github.com/rira100000000/ruby-gemini-api
167
167
  licenses:
168
168
  - MIT
169
169
  metadata:
170
- homepage_uri: https://github.com/rira100000000/ruby-gemini
171
- source_code_uri: https://github.com/rira100000000/ruby-gemini
172
- changelog_uri: https://github.com/rira100000000/ruby-gemini/blob/main/CHANGELOG.md
170
+ homepage_uri: https://github.com/rira100000000/ruby-gemini-api
171
+ source_code_uri: https://github.com/rira100000000/ruby-gemini-api
172
+ changelog_uri: https://github.com/rira100000000/ruby-gemini-api/blob/main/CHANGELOG.md
173
173
  rubygems_mfa_required: 'true'
174
174
  post_install_message:
175
175
  rdoc_options: []