google-genai 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: a18e13e385a81cf2ebab0a30af1bed3005fdb7f9d647f1e8fe216a34943337f4
4
- data.tar.gz: 48f03f1a03de21d84480bfb9518f35bd13589f81418ad3dc7f74b5c73e331c7c
3
+ metadata.gz: 1f244207b40e13c6ff1702ddd721bdd75583ffd11eae0c76ffa900e1a02e37e7
4
+ data.tar.gz: 912a9bc9e1411edc29856be4e497983fdeed31cebc0deadc5275cb88c4daf9ce
5
5
  SHA512:
6
- metadata.gz: 84e01482f630c3d49b40970b1db16defc4b649b7844fe6e929923bfc569e4f957ddae89f56d17de843367c48f0d36eb210ae2ba85f613f429532426c45e888d6
7
- data.tar.gz: 725c5071b50d49bbdb5515a9473629c9f97f34e8ec8c1c0371987dc0fc7b863c0a297b44bd88999b3255c30d193745618e3757c3a1bcd954bae9199e718904b6
6
+ metadata.gz: 0a28c3e8b7b3d0b63037cb27b434e03ec47fb5c31ba65bf4002c71635347a427b2e6d8746ebdbeb2d691bd028b22ad1389a6e190e91b8fb9aa225cd241a97bc1
7
+ data.tar.gz: cdc7b1bc60e17b8ce6a75060b60d7808d1856bfcc6829632d84e9077ba42ed0fd566031975f09b832161155a34266be7024a33c05ec5bb932d6f29ef96b9e3b1
data/README.md CHANGED
@@ -22,7 +22,43 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Here's a quick example of how to upload an audio file and generate a summary.
26
+
27
+ ```ruby
28
+ require 'google/genai'
29
+
30
+ # The client will automatically use the GOOGLE_API_KEY or GEMINI_API_KEY environment variable.
31
+ client = Google::Genai::Client.new
32
+
33
+ # Path to your local audio file.
34
+ audio_file_path = 'path/to/your/audio.mp4' # <--- CHANGE THIS
35
+
36
+ begin
37
+ # Upload the file to the Gemini API.
38
+ # If the automatically detected MIME type is incorrect (e.g., for an MP4 audio file),
39
+ # you can override it like this:
40
+ puts "Uploading file: #{audio_file_path}..."
41
+ audio_file = client.files.upload(file: audio_file_path, config: { mime_type: 'audio/m4a' })
42
+ puts "File uploaded successfully. URI: #{audio_file.uri}"
43
+
44
+ # Ask the model to summarize the audio file.
45
+ puts "Generating summary..."
46
+ prompt = "Please provide a concise summary of this audio file."
47
+
48
+ response = client.models.generate_content(
49
+ model: 'gemini-2.5-flash',
50
+ contents: [prompt, audio_file]
51
+ )
52
+
53
+ # Print the summary
54
+ puts "\n--- Summary ---"
55
+ puts response.text
56
+ puts "---------------"
57
+
58
+ rescue Google::Genai::APIError => e
59
+ puts "An API error occurred: #{e.message}"
60
+ end
61
+ ```
26
62
 
27
63
  ## Development
28
64
 
@@ -6,6 +6,7 @@ module Google
6
6
  module Genai
7
7
  class Client
8
8
  def initialize(api_key: nil, vertexai: nil, credentials: nil, project: nil, location: nil, http_options: nil)
9
+ api_key ||= ENV['GOOGLE_API_KEY'] || ENV['GEMINI_API_KEY']
9
10
  @api_client = ApiClient.new(
10
11
  api_key: api_key,
11
12
  vertexai: vertexai,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Google
4
4
  module Genai
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-genai
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
  - Gyumin Sim