tiny_gemini 2.1.0 → 2.2.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 +3 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bc87254a4490924b2ba4193d0f4edd021154bc7fea87e5ed37fc1eea48ef036
4
- data.tar.gz: 0ae2c5d4c6c27a216a467e192502c7e654eba1aa16dd530705271ce31f9928b9
3
+ metadata.gz: 7bfafdd6a01938b30daeb9913e8c5e8724158f2d9a55103b25c09d0022717352
4
+ data.tar.gz: 86be29fae744635ae5577ec1492fbaf22eae5f3e074e4f2ce6cd56f01c7916a5
5
5
  SHA512:
6
- metadata.gz: 4824f52f7359feb61dad5c0c627a51913d2c032ddaca279a5a0bb4805c6048216004e0272ea19794db5b86d7d55c64afe42dad9c1ec83ba9a434e8894b2c4fde
7
- data.tar.gz: 7f8f17fd55c0ffb3dde4792ae092009f1fb9c667ead63b1a6ff137a7c6696b9d10f2d203b754be52e4bbde0f92c2a39057c07c00fafdcf3e522b7d2ddbc185ac
6
+ metadata.gz: 6c00e093b72af96c3aa992bc8a2a0b99aaa70eaa8dc44eaa631c15ea09953a7ac9013e7402681de2dc3df396711f8ca30b42b7dddeb0db16495aaf4521211dee
7
+ data.tar.gz: 946198664c6ef6d71ada4442d8d8e1ef87e8bb3465b40190c1678235e64ccd8f43adae08ca99a926fd5e83c4631540b71a24ae4ce68c39ed3eaae15afa1cfe25
data/lib/tiny_gemini.rb CHANGED
@@ -56,9 +56,10 @@ class TinyGemini
56
56
  # NOTE: if you want the model to impersonate a character (i.e. a talking cat)
57
57
  # you need to have set the `system_instruction` parameter when initializing
58
58
  # this class to make that work
59
- def prompt(messages)
59
+ def prompt(messages, safety_settings=nil)
60
60
  body = { contents: messages }
61
61
  body.merge!(system_instruction: { parts: { text: @system_instruction } }) if @system_instruction
62
+ body.merge!(safety_settings: safety_settings) if safety_settings
62
63
 
63
64
  request_body = body.to_json
64
65
 
@@ -79,7 +80,7 @@ class TinyGemini
79
80
  raise(TinyGeminiModelError, "No first candidate response in Gemini response") unless first_candidate_response
80
81
 
81
82
  text_response = first_candidate_response&.dig('content', 'parts')&.first&.dig('text')&.strip
82
- raise(TinyGeminiModelError, "Text response is nil or empty: `#{text_response.inspect}`") if text_reponse.nil? || text_response.length == 0
83
+ raise(TinyGeminiModelError, "Text response is nil or empty: `#{text_response.inspect}`") if text_response.nil? || text_response.length == 0
83
84
 
84
85
  text_response
85
86
  end
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.1.0
4
+ version: 2.2.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-08-01 00:00:00.000000000 Z
11
+ date: 2024-09-01 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