omniai-google 3.7.2 → 3.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f0e603d848a10021b4039331d5ace03d9fcebdc6ff0657128bc9cb1da5b8a4d
4
- data.tar.gz: 53712cee681975309f887148fd7bf68e7c8b73030feff12287d3b46f7b6af7e0
3
+ metadata.gz: 5683bc29149bb31082f782ed460483773e2a88537290909d04adc3fb5285aad4
4
+ data.tar.gz: dd2cdde8860b212f25a4c761e1e48eccb31aeb0cbaa58dc963d48386f2352c6c
5
5
  SHA512:
6
- metadata.gz: ef4e3f492ed3c3be562ed3f1137b8264126e7b4e80134195800661bb0341b77bdce81d38ccc12ca254752f80e594e4e83adcc09afd24edff5eccf42addb51aa2
7
- data.tar.gz: fcd20b06d373fb62752e26cfc89ca8bdac82a9bcfad1a2d6cb8d6c520a1c698d6dfcf606038f03bafd322695b20d6eba43d2e391ca860fc8ce57ca1ef78ca3ca
6
+ metadata.gz: 1880ce5da42484fa6f28ba61d14f4ee1d11cb4f3bf2d2b7d772b663af9222743775618dfc1f02de7ac1f50ac952ca742374b039722930ae28c6b388d67c0eff8
7
+ data.tar.gz: 6e8d16e2b1686ae61810ece5e5fb6c07fa69a4b0dcd25063261edc54e8765e228e3e40bd9fdde8b56fffc7b5c467f1a4e9c83708bc48b2bcd47ecfb144b52f31
data/README.md CHANGED
@@ -87,7 +87,7 @@ completion.text # 'The capital of Canada is Ottawa.'
87
87
 
88
88
  #### Model
89
89
 
90
- `model` takes an optional string (default is `gemini-3-flash-preview`):
90
+ `model` takes an optional string (default is `gemini-3.5-flash`):
91
91
 
92
92
  ```ruby
93
93
  completion = client.chat('How fast is a cheetah?', model: OmniAI::Google::Chat::Model::GEMINI_FLASH)
@@ -266,20 +266,32 @@ client.transcribe("phone_call.mp3", model: OmniAI::Google::Transcribe::Model::TE
266
266
  # For medical conversations
267
267
  client.transcribe("medical_interview.mp3", model: OmniAI::Google::Transcribe::Model::MEDICAL_CONVERSATION)
268
268
 
269
+ # Latest generation multilingual model (recommended)
270
+ client.transcribe("audio.mp3", model: OmniAI::Google::Transcribe::Model::CHIRP_3)
271
+
269
272
  # Other available models
270
273
  client.transcribe("audio.mp3", model: OmniAI::Google::Transcribe::Model::CHIRP_2) # Enhanced model
271
274
  client.transcribe("audio.mp3", model: OmniAI::Google::Transcribe::Model::CHIRP) # Universal model
272
275
  ```
273
276
 
274
277
  **Available Model Constants:**
278
+ - `OmniAI::Google::Transcribe::Model::CHIRP_3` - Latest-generation multilingual ASR model (recommended)
279
+ - `OmniAI::Google::Transcribe::Model::CHIRP_2` - Enhanced universal model
280
+ - `OmniAI::Google::Transcribe::Model::CHIRP` - Universal model
275
281
  - `OmniAI::Google::Transcribe::Model::LATEST_SHORT` - Optimized for audio < 60 seconds
276
282
  - `OmniAI::Google::Transcribe::Model::LATEST_LONG` - Optimized for long-form audio
283
+ - `OmniAI::Google::Transcribe::Model::TELEPHONY` - For phone/telephony audio
277
284
  - `OmniAI::Google::Transcribe::Model::TELEPHONY_SHORT` - For short phone calls
278
- - `OmniAI::Google::Transcribe::Model::TELEPHONY_LONG` - For long phone calls
285
+ - `OmniAI::Google::Transcribe::Model::TELEPHONY_LONG` - For long phone calls
279
286
  - `OmniAI::Google::Transcribe::Model::MEDICAL_CONVERSATION` - For medical conversations
280
287
  - `OmniAI::Google::Transcribe::Model::MEDICAL_DICTATION` - For medical dictation
281
- - `OmniAI::Google::Transcribe::Model::CHIRP_2` - Enhanced universal model
282
- - `OmniAI::Google::Transcribe::Model::CHIRP` - Universal model
288
+
289
+ > **Region note:** `CHIRP_3` is only served from the `us` and `eu` multi-region endpoints (not `global`,
290
+ > and not zonal regions like `us-east4`). The provider maps the configured `location_id` to its
291
+ > multi-region parent — any `us*` region resolves to `us`, any `eu`/`europe*` region resolves to `eu` —
292
+ > and defaults to `us` when nothing is configured. This means a Vertex AI client configured with a zonal
293
+ > `location_id` (e.g. `us-east4`) for Gemini will still route `CHIRP_3` correctly. `CHIRP_2` is always
294
+ > routed to `us-central1`.
283
295
 
284
296
  #### Supported Formats
285
297
 
@@ -22,11 +22,12 @@ module OmniAI
22
22
  GEMINI_2_0_FLASH = "gemini-2.0-flash"
23
23
  GEMINI_2_5_FLASH = "gemini-2.5-flash"
24
24
  GEMINI_3_FLASH = "gemini-3-flash-preview"
25
+ GEMINI_3_5_FLASH = "gemini-3.5-flash"
25
26
  GEMINI_PRO = GEMINI_3_1_PRO
26
- GEMINI_FLASH = GEMINI_3_FLASH
27
+ GEMINI_FLASH = GEMINI_3_5_FLASH
27
28
  end
28
29
 
29
- DEFAULT_MODEL = Model::GEMINI_3_FLASH
30
+ DEFAULT_MODEL = Model::GEMINI_3_5_FLASH
30
31
 
31
32
  module ResponseMimeType
32
33
  JSON = "application/json"
@@ -12,10 +12,12 @@ module OmniAI
12
12
  include TranscribeHelpers
13
13
 
14
14
  module Model
15
+ CHIRP_3 = "chirp_3"
15
16
  CHIRP_2 = "chirp_2"
16
17
  CHIRP = "chirp"
17
18
  LATEST_LONG = "latest_long"
18
19
  LATEST_SHORT = "latest_short"
20
+ TELEPHONY = "telephony"
19
21
  TELEPHONY_LONG = "telephony_long"
20
22
  TELEPHONY_SHORT = "telephony_short"
21
23
  MEDICAL_CONVERSATION = "medical_conversation"
@@ -111,7 +113,7 @@ module OmniAI
111
113
  # Speech-to-Text API uses different endpoints for regional vs global
112
114
  endpoint = speech_endpoint
113
115
  speech_connection = HTTP.persistent(endpoint)
114
- .timeout(connect: @client.timeout, write: @client.timeout, read: @client.timeout)
116
+ .timeout(**http_timeout_options)
115
117
  .accept(:json)
116
118
 
117
119
  # Add authentication if using credentials
@@ -17,16 +17,44 @@ module OmniAI
17
17
  case @model
18
18
  when "chirp_2"
19
19
  "us-central1"
20
+ when "chirp_3"
21
+ chirp_3_location_id
20
22
  else
21
23
  @client.instance_variable_get(:@location_id) || "global"
22
24
  end
23
25
  end
24
26
 
27
+ # Chirp 3 is only served from the `us` and `eu` multi-region endpoints (not `global`, and
28
+ # not zonal regions like `us-east4`). A Vertex client typically configures a zonal
29
+ # `location_id` for Gemini, so map any configured region to its multi-region parent and
30
+ # default to `us`.
31
+ #
32
+ # @return [String] "us" or "eu"
33
+ def chirp_3_location_id
34
+ case @client.instance_variable_get(:@location_id)
35
+ when /\A(eu|europe)/i then "eu"
36
+ else "us"
37
+ end
38
+ end
39
+
25
40
  # @return [String]
26
41
  def speech_endpoint
27
42
  location_id == "global" ? "https://speech.googleapis.com" : "https://#{location_id}-speech.googleapis.com"
28
43
  end
29
44
 
45
+ # Normalizes the client timeout into keyword args for HTTP.rb's `.timeout`. The speech
46
+ # endpoints build their own connections, so (unlike the base client, which passes the
47
+ # value straight through) they must accept both a scalar and a per-operation Hash. A Hash
48
+ # is passed through untouched; a scalar (or nil) is wrapped per-operation as before.
49
+ #
50
+ # @return [Hash]
51
+ def http_timeout_options
52
+ timeout = @client.timeout
53
+ return timeout if timeout.is_a?(Hash)
54
+
55
+ { connect: timeout, write: timeout, read: timeout }
56
+ end
57
+
30
58
  # @return [Array<String>, nil]
31
59
  def language_codes
32
60
  case @language
@@ -184,7 +212,7 @@ module OmniAI
184
212
  def poll_operation!(operation_name)
185
213
  endpoint = speech_endpoint
186
214
  connection = HTTP.persistent(endpoint)
187
- .timeout(connect: @client.timeout, write: @client.timeout, read: @client.timeout)
215
+ .timeout(**http_timeout_options)
188
216
  .accept(:json)
189
217
 
190
218
  # Add authentication if using credentials
@@ -222,7 +250,7 @@ module OmniAI
222
250
  def request_batch!
223
251
  endpoint = speech_endpoint
224
252
  connection = HTTP.persistent(endpoint)
225
- .timeout(connect: @client.timeout, write: @client.timeout, read: @client.timeout)
253
+ .timeout(**http_timeout_options)
226
254
  .accept(:json)
227
255
 
228
256
  # Add authentication if using credentials
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module Google
5
- VERSION = "3.7.2"
5
+ VERSION = "3.9.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre