runapi-happyhorse 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 +1 -1
- data/lib/runapi/happyhorse/contract_gen.rb +82 -0
- data/lib/runapi/happyhorse/resources/edit_video.rb +2 -4
- data/lib/runapi/happyhorse/resources/image_to_video.rb +1 -3
- data/lib/runapi/happyhorse/resources/text_to_video.rb +4 -6
- data/lib/runapi/happyhorse/types.rb +0 -12
- data/lib/runapi/happyhorse.rb +1 -0
- metadata +10 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6dce8cdd8d38b5c1062594b3de7c673544d2558abe8db1c616b35e81ae1c9bc
|
|
4
|
+
data.tar.gz: c2ab10637f4c26d08b77e6b44dc80eb51be19c99b6ba34d610656426771b6555
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e19584b1a78ef79a9d869b5eef458afd4fb5b7b7d87d395db073e7654caf27bdc0a656b97851796cc0d7eb979113c9a1aa555cfa0c67d875c395dc2c6ee5be6
|
|
7
|
+
data.tar.gz: cd1e0d2335573a8ac73d3df65640555fc0afb3f4bc1427c1bf1386d232a209769f3a7a94a68eee82c86d9910be40b5927427beb3f07e535ee6f993ab30c5c8e6
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HappyHorse API Ruby SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The HappyHorse Ruby SDK is the language-specific package for HappyHorse on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module HappyHorse
|
|
5
|
+
CONTRACT = {
|
|
6
|
+
"edit-video" => {
|
|
7
|
+
"models" => ["happyhorse-edit-video"],
|
|
8
|
+
"fields_by_model" => {
|
|
9
|
+
"happyhorse-edit-video" => {
|
|
10
|
+
"audio_setting" => {
|
|
11
|
+
"enum" => ["auto", "original"]
|
|
12
|
+
},
|
|
13
|
+
"output_resolution" => {
|
|
14
|
+
"enum" => ["720p", "1080p"]
|
|
15
|
+
},
|
|
16
|
+
"seed" => {
|
|
17
|
+
"type" => "integer"
|
|
18
|
+
},
|
|
19
|
+
"source_video_url" => {
|
|
20
|
+
"required" => true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"image-to-video" => {
|
|
26
|
+
"models" => ["happyhorse-image-to-video"],
|
|
27
|
+
"fields_by_model" => {
|
|
28
|
+
"happyhorse-image-to-video" => {
|
|
29
|
+
"duration_seconds" => {
|
|
30
|
+
"type" => "integer"
|
|
31
|
+
},
|
|
32
|
+
"first_frame_image_url" => {
|
|
33
|
+
"required" => true
|
|
34
|
+
},
|
|
35
|
+
"output_resolution" => {
|
|
36
|
+
"enum" => ["720p", "1080p"]
|
|
37
|
+
},
|
|
38
|
+
"seed" => {
|
|
39
|
+
"type" => "integer"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"text-to-video" => {
|
|
45
|
+
"models" => ["happyhorse-character", "happyhorse-text-to-video"],
|
|
46
|
+
"fields_by_model" => {
|
|
47
|
+
"happyhorse-character" => {
|
|
48
|
+
"aspect_ratio" => {
|
|
49
|
+
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
50
|
+
},
|
|
51
|
+
"duration_seconds" => {
|
|
52
|
+
"type" => "integer"
|
|
53
|
+
},
|
|
54
|
+
"output_resolution" => {
|
|
55
|
+
"enum" => ["720p", "1080p"]
|
|
56
|
+
},
|
|
57
|
+
"reference_image_urls" => {
|
|
58
|
+
"required" => true
|
|
59
|
+
},
|
|
60
|
+
"seed" => {
|
|
61
|
+
"type" => "integer"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"happyhorse-text-to-video" => {
|
|
65
|
+
"aspect_ratio" => {
|
|
66
|
+
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
67
|
+
},
|
|
68
|
+
"duration_seconds" => {
|
|
69
|
+
"type" => "integer"
|
|
70
|
+
},
|
|
71
|
+
"output_resolution" => {
|
|
72
|
+
"enum" => ["720p", "1080p"]
|
|
73
|
+
},
|
|
74
|
+
"seed" => {
|
|
75
|
+
"type" => "integer"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}.freeze
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -48,17 +48,15 @@ module RunApi
|
|
|
48
48
|
private
|
|
49
49
|
|
|
50
50
|
def validate_params!(params)
|
|
51
|
-
|
|
51
|
+
validate_contract!(CONTRACT["edit-video"], params)
|
|
52
|
+
|
|
52
53
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
53
|
-
raise Core::ValidationError, "source_video_url is required" unless param(params, :source_video_url)
|
|
54
54
|
|
|
55
55
|
reference_image_urls = param(params, :reference_image_urls)
|
|
56
56
|
if reference_image_urls && (!reference_image_urls.is_a?(Array) || !REFERENCE_IMAGE_RANGE.cover?(reference_image_urls.size))
|
|
57
57
|
raise Core::ValidationError, "reference_image_urls must include at most #{REFERENCE_IMAGE_RANGE.max} entries"
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
|
|
61
|
-
validate_optional!(params, :audio_setting, Types::AUDIO_SETTINGS)
|
|
62
60
|
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
63
61
|
end
|
|
64
62
|
|
|
@@ -47,10 +47,8 @@ module RunApi
|
|
|
47
47
|
private
|
|
48
48
|
|
|
49
49
|
def validate_params!(params)
|
|
50
|
-
|
|
51
|
-
raise Core::ValidationError, "first_frame_image_url is required" unless param(params, :first_frame_image_url)
|
|
50
|
+
validate_contract!(CONTRACT["image-to-video"], params)
|
|
52
51
|
|
|
53
|
-
validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
|
|
54
52
|
validate_integer_range!(params, :duration_seconds, Types::DURATION_RANGE)
|
|
55
53
|
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
56
54
|
end
|
|
@@ -48,21 +48,19 @@ module RunApi
|
|
|
48
48
|
private
|
|
49
49
|
|
|
50
50
|
def validate_params!(params)
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
validate_contract!(CONTRACT["text-to-video"], params)
|
|
52
|
+
|
|
53
53
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
54
54
|
|
|
55
55
|
reference_image_urls = param(params, :reference_image_urls)
|
|
56
|
-
if model == Types::CHARACTER_MODEL
|
|
57
|
-
|
|
56
|
+
if param(params, :model) == Types::CHARACTER_MODEL
|
|
57
|
+
if reference_image_urls && !(reference_image_urls.is_a?(Array) && REFERENCE_IMAGE_URLS_RANGE.cover?(reference_image_urls.size))
|
|
58
58
|
raise Core::ValidationError, "reference_image_urls must include between #{REFERENCE_IMAGE_URLS_RANGE.min} and #{REFERENCE_IMAGE_URLS_RANGE.max} entries"
|
|
59
59
|
end
|
|
60
60
|
elsif reference_image_urls
|
|
61
61
|
raise Core::ValidationError, "reference_image_urls is only supported for #{Types::CHARACTER_MODEL}"
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
|
|
65
|
-
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
66
64
|
validate_integer_range!(params, :duration_seconds, Types::DURATION_RANGE)
|
|
67
65
|
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
68
66
|
end
|
|
@@ -4,20 +4,8 @@ module RunApi
|
|
|
4
4
|
module HappyHorse
|
|
5
5
|
# Type definitions and constants for HappyHorse video generation and editing.
|
|
6
6
|
module Types
|
|
7
|
-
# Standard text-to-video model.
|
|
8
|
-
TEXT_TO_VIDEO_MODEL = "happyhorse-text-to-video"
|
|
9
7
|
# Character-consistent model; requires 1-9 reference_image_urls.
|
|
10
8
|
CHARACTER_MODEL = "happyhorse-character"
|
|
11
|
-
# All text-to-video model variants.
|
|
12
|
-
TEXT_TO_VIDEO_MODELS = [TEXT_TO_VIDEO_MODEL, CHARACTER_MODEL].freeze
|
|
13
|
-
IMAGE_TO_VIDEO_MODEL = "happyhorse-image-to-video"
|
|
14
|
-
EDIT_VIDEO_MODEL = "happyhorse-edit-video"
|
|
15
|
-
# Output resolution options. Defaults to 1080p.
|
|
16
|
-
OUTPUT_RESOLUTIONS = %w[720p 1080p].freeze
|
|
17
|
-
# Aspect ratio options. Defaults to 16:9.
|
|
18
|
-
ASPECT_RATIOS = %w[16:9 9:16 1:1 4:3 3:4].freeze
|
|
19
|
-
# Audio handling for video editing: "auto" lets the model decide, "original" preserves source audio.
|
|
20
|
-
AUDIO_SETTINGS = %w[auto original].freeze
|
|
21
9
|
# Duration range in seconds (3-15). Defaults to 5.
|
|
22
10
|
DURATION_RANGE = (3..15)
|
|
23
11
|
# Reproducibility seed range.
|
data/lib/runapi/happyhorse.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "runapi/core"
|
|
4
4
|
require_relative "happyhorse/types"
|
|
5
|
+
require_relative "happyhorse/contract_gen"
|
|
5
6
|
require_relative "happyhorse/resources/edit_video"
|
|
6
7
|
require_relative "happyhorse/resources/image_to_video"
|
|
7
8
|
require_relative "happyhorse/resources/text_to_video"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-happyhorse
|
|
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,17 +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
|
-
on RunAPI. Use this package for
|
|
28
|
-
|
|
25
|
+
version: 0.2.7
|
|
26
|
+
description: The HappyHorse Ruby SDK is the language-specific package for HappyHorse
|
|
27
|
+
on RunAPI. Use this package for video generation, animation, and video editing workflows
|
|
28
|
+
when your application needs request bodies, task status lookup, and consistent RunAPI
|
|
29
|
+
errors in Ruby.
|
|
29
30
|
email:
|
|
30
31
|
- contact@runapi.ai
|
|
31
32
|
executables: []
|
|
@@ -38,6 +39,7 @@ files:
|
|
|
38
39
|
- lib/runapi-happyhorse.rb
|
|
39
40
|
- lib/runapi/happyhorse.rb
|
|
40
41
|
- lib/runapi/happyhorse/client.rb
|
|
42
|
+
- lib/runapi/happyhorse/contract_gen.rb
|
|
41
43
|
- lib/runapi/happyhorse/resources/edit_video.rb
|
|
42
44
|
- lib/runapi/happyhorse/resources/image_to_video.rb
|
|
43
45
|
- lib/runapi/happyhorse/resources/text_to_video.rb
|
|
@@ -46,9 +48,11 @@ homepage: https://runapi.ai/models/happyhorse
|
|
|
46
48
|
licenses:
|
|
47
49
|
- Apache-2.0
|
|
48
50
|
metadata:
|
|
51
|
+
runapi_slug: happyhorse
|
|
49
52
|
homepage_uri: https://runapi.ai/models/happyhorse
|
|
50
53
|
documentation_uri: https://github.com/runapi-ai/happyhorse-sdk/blob/main/ruby/README.md
|
|
51
54
|
source_code_uri: https://github.com/runapi-ai/happyhorse-sdk
|
|
55
|
+
bug_tracker_uri: https://github.com/runapi-ai/happyhorse-sdk/issues
|
|
52
56
|
changelog_uri: https://github.com/runapi-ai/happyhorse-sdk/blob/main/CHANGELOG.md
|
|
53
57
|
rdoc_options: []
|
|
54
58
|
require_paths:
|