geminai 0.1.0 → 0.2.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: 9d805349d2b5e83401e3d9e299d237210d3bc758985d42e5308b1302f8e436c6
4
- data.tar.gz: '0887d0adca55f7ec97bc12932be5e523ab0859dce30ecbb0d42b99625ce2f121'
3
+ metadata.gz: 79f9017e978b23a2c95b0916eb2bdd9b8d1657bede042832fbee9be77f48e1b7
4
+ data.tar.gz: 06d690f6ad1264f10cbdf1cff433dc92a9decbf2c01ff020bed8f7c439dcf551
5
5
  SHA512:
6
- metadata.gz: 1b9bc352fc5c5222b4ed7d2236e2a7299de81676344175d8d975384025d62705c10312013ee3874dc401e3204ba1006f20a0716be9fa48331bf74d8f5cace6db
7
- data.tar.gz: 000f7985bf738b8dfb0f2f13f72260f8e179b78c6bdb12255309c6c80ed310003e3fa8367b0a0658db52eaba6f2541f20c85c9ea26751628f27167f81472f350
6
+ metadata.gz: bbb724f49b0a32ca075c686c6b72cd8316f093e5e89c745c5cf803fc5fb91140e840e0e914529ab1b3d1f8d1f74fbde5956e67e1122b2d9264a8a8bb4897f623
7
+ data.tar.gz: 2bf82c43f4546d7c2eac35b0e783dabfa3247cd5ec8827af4391ededd2849b55a0c01203a542b133d3cc0edee47062743e955038f7255b901840cccbd2c1fc10
data/README.md CHANGED
@@ -104,7 +104,29 @@ puts interaction_2.output_text
104
104
  # => "Your favorite jihad is a butlerian jihad."
105
105
  ```
106
106
 
107
- ---
107
+ ### 4. Video generation
108
+
109
+ ```ruby
110
+ # Generate a video
111
+ interaction = client.generate_video(
112
+ "A beautiful sunset over a calm ocean.",
113
+ model: "gemini-omni-flash-preview"
114
+ )
115
+
116
+ if interaction.output_video
117
+ # Access base64 data
118
+ video_data = interaction.output_video[:data]
119
+ # Or access the URI if delivery: "uri" was used
120
+ video_uri = interaction.output_video[:uri]
121
+ end
122
+
123
+ # Stateful video editing
124
+ edit_interaction = client.interact(
125
+ model: "gemini-omni-flash-preview",
126
+ input: "Make the sun more vibrant and red.",
127
+ previous_interaction_id: interaction.id
128
+ )
129
+ ```
108
130
 
109
131
  ## Running Tests
110
132
 
@@ -79,6 +79,19 @@ module Geminai
79
79
  **options
80
80
  )
81
81
  end
82
+
83
+ # Helper method for video generation using response_format
84
+ def generate_video(prompt, model:, delivery: "data", **options)
85
+ interact(
86
+ model: model,
87
+ input: prompt,
88
+ response_format: {
89
+ type: "video",
90
+ delivery: delivery
91
+ },
92
+ **options
93
+ )
94
+ end
82
95
  end
83
96
 
84
97
  class ApiError < StandardError
@@ -51,6 +51,36 @@ module Geminai
51
51
  images
52
52
  end
53
53
 
54
+ def output_videos
55
+ videos = []
56
+ @steps.each do |step|
57
+ next unless step.model_output?
58
+ (step.content || []).each do |part|
59
+ if part[:type] == "video"
60
+ videos <<
61
+ {
62
+ data: part[:data],
63
+ uri: part[:uri],
64
+ mime_type: part[:mime_type]
65
+ }
66
+ elsif part[:video]
67
+ videos <<
68
+ {
69
+ data: part[:video][:data] || part[:video][:video_bytes],
70
+ uri: part[:video][:uri],
71
+ mime_type: part[:video][:mime_type]
72
+ }
73
+ end
74
+ end
75
+ end
76
+
77
+ videos
78
+ end
79
+
80
+ def output_video
81
+ output_videos.first
82
+ end
83
+
54
84
  def grounding_metadata
55
85
  queries = []
56
86
  citations = []
@@ -1,3 +1,3 @@
1
1
  module Geminai
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geminai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - swlkr
@@ -9,7 +9,7 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
- description: A gem for google's gemini interactions api
12
+ description: A gem for googles gemini interactions api
13
13
  email: []
14
14
  executables: []
15
15
  extensions: []
@@ -44,5 +44,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  requirements: []
45
45
  rubygems_version: 3.7.2
46
46
  specification_version: 4
47
- summary: Use google's gemini interactions api
47
+ summary: Use googles gemini interactions api
48
48
  test_files: []