tiny_gemini 2.2.0 → 3.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_gemini.rb +2 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bfafdd6a01938b30daeb9913e8c5e8724158f2d9a55103b25c09d0022717352
4
- data.tar.gz: 86be29fae744635ae5577ec1492fbaf22eae5f3e074e4f2ce6cd56f01c7916a5
3
+ metadata.gz: b5f56e4cbc05e3d459f13871f6cd6bdddd3468b7cea23777c8361b08f802a07c
4
+ data.tar.gz: a1ef17332bd9433a72dce319e0048a5d34826fc8685e985b28088a0c80d67a6e
5
5
  SHA512:
6
- metadata.gz: 6c00e093b72af96c3aa992bc8a2a0b99aaa70eaa8dc44eaa631c15ea09953a7ac9013e7402681de2dc3df396711f8ca30b42b7dddeb0db16495aaf4521211dee
7
- data.tar.gz: 946198664c6ef6d71ada4442d8d8e1ef87e8bb3465b40190c1678235e64ccd8f43adae08ca99a926fd5e83c4631540b71a24ae4ce68c39ed3eaae15afa1cfe25
6
+ metadata.gz: 9d70f2652d4ffee8a1022e456b11f588034c9a8b9f6e090628392463bc924d172f8f33f2354fb6dd264a9f02c115989a674c2a90a5d770de134faf6be0bdce8f
7
+ data.tar.gz: a876b8793468acbd501491098acf12c23f696c529853c81c289ca530f9c74018220753ccdc465476184ede058aabfbe819ac9cc38cac18caff7912efed3f0191
data/lib/tiny_gemini.rb CHANGED
@@ -24,6 +24,7 @@ class TinyGemini
24
24
  end
25
25
 
26
26
  # sends a request to POST generateContent
27
+ # returns the parsed JSON reply
27
28
  #
28
29
  # messages: an array of hashes in the following format:
29
30
  # [
@@ -76,13 +77,7 @@ class TinyGemini
76
77
  parsed_response = JSON.parse(response.body)
77
78
  raise(TinyGeminiModelError, "No condidates in Gemini response") unless parsed_response['candidates']
78
79
 
79
- first_candidate_response = parsed_response['candidates'].first
80
- raise(TinyGeminiModelError, "No first candidate response in Gemini response") unless first_candidate_response
81
-
82
- text_response = first_candidate_response&.dig('content', 'parts')&.first&.dig('text')&.strip
83
- raise(TinyGeminiModelError, "Text response is nil or empty: `#{text_response.inspect}`") if text_response.nil? || text_response.length == 0
84
-
85
- text_response
80
+ parsed_response
86
81
  end
87
82
  end
88
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_gemini
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-01 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a tiny gem for using Google Gemini's generative models for chat
14
14
  email: jefflunt@gmail.com