runapi-grok-imagine 0.2.6 → 0.2.7
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 +4 -4
- data/README.md +4 -4
- data/lib/runapi/grok_imagine/contract_gen.rb +89 -0
- data/lib/runapi/grok_imagine/resources/edit_image.rb +1 -1
- data/lib/runapi/grok_imagine/resources/image_to_video.rb +1 -5
- data/lib/runapi/grok_imagine/resources/text_to_image.rb +1 -2
- data/lib/runapi/grok_imagine/resources/text_to_video.rb +1 -4
- data/lib/runapi/grok_imagine/types.rb +0 -8
- data/lib/runapi/grok_imagine.rb +1 -0
- metadata +11 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a703110005c79f1716e346be1519250ff551ed318541f6e15ce6fcefc42760a7
|
|
4
|
+
data.tar.gz: 113a1d0c4ab22449c4ac45fa29ba112d66168a30f6675bff3f519c74c50c2fe7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a63c2a781705df2d2d15ce033657e2616c52ebe53d33b19cdda954363e7ab6f40e660bfabc0cb09a47ebf1c8e06929ae1ba7a3e686b12430a10914734f72d39
|
|
7
|
+
data.tar.gz: f915d1a24f8e31aa0551e817710e8fa679e380105c084c8ed1b8554b024290bf88e176614a4d881b33d425910a4918e10857cca78eb09c69aeb75ac952bdc8ab
|
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Grok Imagine
|
|
1
|
+
# Grok Imagine Ruby SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine on RunAPI. Use this package for image generation, image editing, and creative production workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
This README is the Ruby package guide inside the public `grok-imagine-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/grok-imagine; for API reference, use https://runapi.ai/docs#grok-imagine; for SDK docs, use https://runapi.ai/docs#sdk-grok-imagine.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
|
|
|
28
28
|
|
|
29
29
|
## Language notes
|
|
30
30
|
|
|
31
|
-
Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when building image jobs, Rails workers, or scripts. The available resources
|
|
31
|
+
Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when building image jobs, Rails workers, or scripts. The available resources are `text_to_video`, `image_to_video`, `text_to_image`, `edit_image`, `extensions`, and `upscales`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
32
32
|
|
|
33
33
|
## Links
|
|
34
34
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module GrokImagine
|
|
5
|
+
CONTRACT = {
|
|
6
|
+
"edit-image" => {
|
|
7
|
+
"models" => ["grok-imagine-edit-image"],
|
|
8
|
+
"fields_by_model" => {
|
|
9
|
+
"grok-imagine-edit-image" => {
|
|
10
|
+
"source_image_url" => {
|
|
11
|
+
"required" => true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"extend" => {
|
|
17
|
+
"models" => [],
|
|
18
|
+
"fields_by_model" => {
|
|
19
|
+
"_" => {
|
|
20
|
+
"extension_duration_seconds" => {
|
|
21
|
+
"enum" => [6, 10],
|
|
22
|
+
"type" => "integer"
|
|
23
|
+
},
|
|
24
|
+
"start_seconds" => {
|
|
25
|
+
"type" => "integer"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"image-to-video" => {
|
|
31
|
+
"models" => ["grok-imagine-image-to-video"],
|
|
32
|
+
"fields_by_model" => {
|
|
33
|
+
"grok-imagine-image-to-video" => {
|
|
34
|
+
"aspect_ratio" => {
|
|
35
|
+
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
36
|
+
},
|
|
37
|
+
"duration_seconds" => {
|
|
38
|
+
"type" => "integer"
|
|
39
|
+
},
|
|
40
|
+
"index" => {
|
|
41
|
+
"type" => "integer"
|
|
42
|
+
},
|
|
43
|
+
"motion_style" => {
|
|
44
|
+
"enum" => ["fun", "normal", "spicy"]
|
|
45
|
+
},
|
|
46
|
+
"output_resolution" => {
|
|
47
|
+
"enum" => ["480p", "720p"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"text-to-image" => {
|
|
53
|
+
"models" => ["grok-imagine-text-to-image"],
|
|
54
|
+
"fields_by_model" => {
|
|
55
|
+
"grok-imagine-text-to-image" => {
|
|
56
|
+
"aspect_ratio" => {
|
|
57
|
+
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"text-to-video" => {
|
|
63
|
+
"models" => ["grok-imagine-text-to-video"],
|
|
64
|
+
"fields_by_model" => {
|
|
65
|
+
"grok-imagine-text-to-video" => {
|
|
66
|
+
"aspect_ratio" => {
|
|
67
|
+
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
68
|
+
},
|
|
69
|
+
"duration_seconds" => {
|
|
70
|
+
"type" => "integer"
|
|
71
|
+
},
|
|
72
|
+
"motion_style" => {
|
|
73
|
+
"enum" => ["fun", "normal", "spicy"]
|
|
74
|
+
},
|
|
75
|
+
"output_resolution" => {
|
|
76
|
+
"enum" => ["480p", "720p"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"upscale-image" => {
|
|
82
|
+
"models" => [],
|
|
83
|
+
"fields_by_model" => {
|
|
84
|
+
"_" => {}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}.freeze
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -34,7 +34,7 @@ module RunApi
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
36
|
def validate_params!(params)
|
|
37
|
-
|
|
37
|
+
validate_contract!(CONTRACT["edit-image"], params)
|
|
38
38
|
raise Core::ValidationError, "source_image_url is required" unless param(params, :source_image_url)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -35,7 +35,7 @@ module RunApi
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
37
|
def validate_params!(params)
|
|
38
|
-
|
|
38
|
+
validate_contract!(CONTRACT["image-to-video"], params)
|
|
39
39
|
|
|
40
40
|
source_image_urls = param(params, :source_image_urls)
|
|
41
41
|
source_task_id = param(params, :source_task_id)
|
|
@@ -57,10 +57,6 @@ module RunApi
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
61
|
-
validate_optional!(params, :motion_style, Types::MOTION_STYLES)
|
|
62
|
-
validate_optional!(params, :output_resolution, Types::RESOLUTIONS)
|
|
63
|
-
|
|
64
60
|
if param(params, :motion_style).to_s == "spicy" && source_image_urls && !source_image_urls.empty?
|
|
65
61
|
raise Core::ValidationError, "spicy motion_style requires a source_task_id source image."
|
|
66
62
|
end
|
|
@@ -34,9 +34,8 @@ module RunApi
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
36
|
def validate_params!(params)
|
|
37
|
-
|
|
37
|
+
validate_contract!(CONTRACT["text-to-image"], params)
|
|
38
38
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
|
-
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
end
|
|
@@ -34,11 +34,8 @@ module RunApi
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
36
|
def validate_params!(params)
|
|
37
|
-
|
|
37
|
+
validate_contract!(CONTRACT["text-to-video"], params)
|
|
38
38
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
|
-
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
40
|
-
validate_optional!(params, :motion_style, Types::MOTION_STYLES)
|
|
41
|
-
validate_optional!(params, :output_resolution, Types::RESOLUTIONS)
|
|
42
39
|
|
|
43
40
|
duration_seconds = param(params, :duration_seconds)
|
|
44
41
|
if duration_seconds
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module GrokImagine
|
|
5
5
|
module Types
|
|
6
|
-
TEXT_TO_VIDEO_MODEL = "grok-imagine-text-to-video"
|
|
7
|
-
IMAGE_TO_VIDEO_MODEL = "grok-imagine-image-to-video"
|
|
8
|
-
TEXT_TO_IMAGE_MODEL = "grok-imagine-text-to-image"
|
|
9
|
-
EDIT_IMAGE_MODEL = "grok-imagine-edit-image"
|
|
10
|
-
|
|
11
|
-
ASPECT_RATIOS = %w[2:3 3:2 1:1 16:9 9:16].freeze
|
|
12
|
-
MOTION_STYLES = %w[fun normal spicy].freeze
|
|
13
|
-
RESOLUTIONS = %w[480p 720p].freeze
|
|
14
6
|
DURATION_RANGE = (6..30)
|
|
15
7
|
EXTENSION_DURATION_SECONDS = [6, 10].freeze
|
|
16
8
|
INDEX_RANGE = (0..5)
|
data/lib/runapi/grok_imagine.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "runapi/core"
|
|
4
4
|
require_relative "grok_imagine/types"
|
|
5
|
+
require_relative "grok_imagine/contract_gen"
|
|
5
6
|
require_relative "grok_imagine/resources/text_to_video"
|
|
6
7
|
require_relative "grok_imagine/resources/image_to_video"
|
|
7
8
|
require_relative "grok_imagine/resources/text_to_image"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-grok-imagine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,18 +15,18 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.7
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
26
|
-
description: The
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
version: 0.2.7
|
|
26
|
+
description: The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine
|
|
27
|
+
on RunAPI. Use this package for image generation, image editing, and creative production
|
|
28
|
+
workflows when your application needs request bodies, task status lookup, and consistent
|
|
29
|
+
RunAPI errors in Ruby.
|
|
30
30
|
email:
|
|
31
31
|
- contact@runapi.ai
|
|
32
32
|
executables: []
|
|
@@ -39,6 +39,7 @@ files:
|
|
|
39
39
|
- lib/runapi-grok_imagine.rb
|
|
40
40
|
- lib/runapi/grok_imagine.rb
|
|
41
41
|
- lib/runapi/grok_imagine/client.rb
|
|
42
|
+
- lib/runapi/grok_imagine/contract_gen.rb
|
|
42
43
|
- lib/runapi/grok_imagine/resources/edit_image.rb
|
|
43
44
|
- lib/runapi/grok_imagine/resources/extensions.rb
|
|
44
45
|
- lib/runapi/grok_imagine/resources/image_to_video.rb
|
|
@@ -50,9 +51,11 @@ homepage: https://runapi.ai/models/grok-imagine
|
|
|
50
51
|
licenses:
|
|
51
52
|
- Apache-2.0
|
|
52
53
|
metadata:
|
|
54
|
+
runapi_slug: grok-imagine
|
|
53
55
|
homepage_uri: https://runapi.ai/models/grok-imagine
|
|
54
56
|
documentation_uri: https://github.com/runapi-ai/grok-imagine-sdk/blob/main/ruby/README.md
|
|
55
57
|
source_code_uri: https://github.com/runapi-ai/grok-imagine-sdk
|
|
58
|
+
bug_tracker_uri: https://github.com/runapi-ai/grok-imagine-sdk/issues
|
|
56
59
|
changelog_uri: https://github.com/runapi-ai/grok-imagine-sdk/blob/main/CHANGELOG.md
|
|
57
60
|
rdoc_options: []
|
|
58
61
|
require_paths:
|
|
@@ -70,5 +73,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
70
73
|
requirements: []
|
|
71
74
|
rubygems_version: 4.0.10
|
|
72
75
|
specification_version: 4
|
|
73
|
-
summary: Grok Imagine
|
|
76
|
+
summary: Grok Imagine Ruby SDK for RunAPI
|
|
74
77
|
test_files: []
|