tavus 0.1.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.
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tavus
4
+ module Resources
5
+ class Videos
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Generate a new video
11
+ # @param replica_id [String] Unique identifier for the replica (required)
12
+ # @param options [Hash] Additional parameters
13
+ # @option options [String] :script Text script for video generation (required if no audio_url)
14
+ # @option options [String] :audio_url URL to audio file (required if no script)
15
+ # @option options [String] :video_name Name for the video
16
+ # @option options [String] :background_url Link to website for background
17
+ # @option options [String] :background_source_url Direct link to background video
18
+ # @option options [String] :callback_url URL to receive callbacks
19
+ # @option options [Boolean] :fast Use fast rendering process (default: false)
20
+ # @option options [Boolean] :transparent_background Generate with transparent background (requires fast: true)
21
+ # @option options [String] :watermark_image_url URL to watermark image
22
+ # @option options [Hash] :properties Additional properties
23
+ # @return [Hash] The created video details
24
+ def create(replica_id:, **options)
25
+ body = options.merge(replica_id: replica_id)
26
+
27
+ # Validate that either script or audio_url is provided
28
+ unless body[:script] || body[:audio_url]
29
+ raise ArgumentError, "Either :script or :audio_url must be provided"
30
+ end
31
+
32
+ @client.post("/v2/videos", body: body)
33
+ end
34
+
35
+ # Convenient method to generate video from text
36
+ # @param replica_id [String] Unique identifier for the replica
37
+ # @param script [String] Text script for video generation
38
+ # @param options [Hash] Additional parameters
39
+ # @return [Hash] The created video details
40
+ def generate_from_text(replica_id:, script:, **options)
41
+ create(replica_id: replica_id, script: script, **options)
42
+ end
43
+
44
+ # Convenient method to generate video from audio
45
+ # @param replica_id [String] Unique identifier for the replica
46
+ # @param audio_url [String] URL to audio file
47
+ # @param options [Hash] Additional parameters
48
+ # @return [Hash] The created video details
49
+ def generate_from_audio(replica_id:, audio_url:, **options)
50
+ create(replica_id: replica_id, audio_url: audio_url, **options)
51
+ end
52
+
53
+ # Get a single video by ID
54
+ # @param video_id [String] The unique identifier of the video
55
+ # @param verbose [Boolean] Include additional video data like thumbnails (default: false)
56
+ # @return [Hash] The video details
57
+ def get(video_id, verbose: false)
58
+ params = verbose ? { verbose: true } : {}
59
+ @client.get("/v2/videos/#{video_id}", params: params)
60
+ end
61
+
62
+ # List all videos
63
+ # @param options [Hash] Query parameters
64
+ # @option options [Integer] :limit Number of videos to return per page (default: 10)
65
+ # @option options [Integer] :page Page number to return (default: 1)
66
+ # @return [Hash] List of videos and total count
67
+ def list(**options)
68
+ @client.get("/v2/videos", params: options)
69
+ end
70
+
71
+ # Delete a video
72
+ # @param video_id [String] The unique identifier of the video
73
+ # @param hard [Boolean] If true, hard delete video and assets (irreversible)
74
+ # @return [Hash] Success response
75
+ def delete(video_id, hard: false)
76
+ params = hard ? { hard: true } : {}
77
+ @client.delete("/v2/videos/#{video_id}", params: params)
78
+ end
79
+
80
+ # Rename a video
81
+ # @param video_id [String] The unique identifier of the video
82
+ # @param video_name [String] New name for the video
83
+ # @return [Hash] Success response
84
+ def rename(video_id, video_name)
85
+ @client.patch("/v2/videos/#{video_id}/name", body: { video_name: video_name })
86
+ end
87
+ end
88
+ end
89
+ end
90
+
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tavus
4
+ VERSION = "0.1.0"
5
+ end
data/lib/tavus.rb ADDED
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "tavus/version"
4
+ require_relative "tavus/configuration"
5
+ require_relative "tavus/client"
6
+ require_relative "tavus/errors"
7
+ require_relative "tavus/resources/conversations"
8
+ require_relative "tavus/resources/personas"
9
+ require_relative "tavus/resources/replicas"
10
+ require_relative "tavus/resources/objectives"
11
+ require_relative "tavus/resources/guardrails"
12
+ require_relative "tavus/resources/documents"
13
+ require_relative "tavus/resources/videos"
14
+
15
+ module Tavus
16
+ class << self
17
+ attr_writer :configuration
18
+
19
+ def configuration
20
+ @configuration ||= Configuration.new
21
+ end
22
+
23
+ def configure
24
+ yield(configuration)
25
+ end
26
+
27
+ def reset_configuration!
28
+ @configuration = Configuration.new
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tavus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vitor Oliveira
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-10-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler-audit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.18'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.21'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.21'
111
+ description: A Ruby gem for interacting with the Tavus Conversational Video Interface
112
+ API, supporting conversations and personas management.
113
+ email:
114
+ - vbrazo@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".rspec"
120
+ - ".rubocop.yml"
121
+ - CHANGELOG.md
122
+ - Gemfile
123
+ - Gemfile.lock
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - examples/advanced_persona.rb
128
+ - examples/basic_usage.rb
129
+ - examples/complete_workflow.rb
130
+ - lib/tavus.rb
131
+ - lib/tavus/client.rb
132
+ - lib/tavus/configuration.rb
133
+ - lib/tavus/errors.rb
134
+ - lib/tavus/resources/conversations.rb
135
+ - lib/tavus/resources/documents.rb
136
+ - lib/tavus/resources/guardrails.rb
137
+ - lib/tavus/resources/objectives.rb
138
+ - lib/tavus/resources/personas.rb
139
+ - lib/tavus/resources/replicas.rb
140
+ - lib/tavus/resources/videos.rb
141
+ - lib/tavus/version.rb
142
+ homepage: https://github.com/vbrazo/tavus
143
+ licenses:
144
+ - MIT
145
+ metadata:
146
+ homepage_uri: https://github.com/vbrazo/tavus
147
+ source_code_uri: https://github.com/vbrazo/tavus
148
+ changelog_uri: https://github.com/vbrazo/tavus/blob/main/CHANGELOG.md
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: 3.1.0
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubygems_version: 3.5.16
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: Ruby client for the Tavus API
168
+ test_files: []