Class: Vellum::VideoPromptBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/video_prompt_block.rb

Overview

A block that represents an video file in a prompt template.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_type:, state: OMIT, cache_config: OMIT, src:, metadata: OMIT, additional_properties: nil) ⇒ Vellum::VideoPromptBlock



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 35

def initialize(block_type:, state: OMIT, cache_config: OMIT, src:, metadata: OMIT, additional_properties: nil)
  @block_type = block_type
  @state = state if state != OMIT
  @cache_config = cache_config if cache_config != OMIT
  @src = src
  @metadata =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = { "block_type": block_type, "state": state, "cache_config": cache_config, "src": src, "metadata":  }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



21
22
23
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 21

def additional_properties
  @additional_properties
end

#block_type ⇒ String (readonly)



11
12
13
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 11

def block_type
  @block_type
end

#cache_config ⇒ Vellum::EphemeralPromptCacheConfig (readonly)



15
16
17
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 15

def cache_config
  @cache_config
end

#metadata ⇒ Hash{String => Object} (readonly)



19
20
21
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 19

def 
  @metadata
end

#src ⇒ String (readonly)



17
18
19
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 17

def src
  @src
end

#state ⇒ Vellum::PromptBlockState (readonly)



13
14
15
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 13

def state
  @state
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::VideoPromptBlock



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  block_type = parsed_json["block_type"]
  state = parsed_json["state"]
  unless parsed_json["cache_config"].nil?
    cache_config = parsed_json["cache_config"].to_json
    cache_config = Vellum::EphemeralPromptCacheConfig.from_json(json_object: cache_config)
  else
    cache_config = nil
  end
  src = parsed_json["src"]
   = parsed_json["metadata"]
  new(
    block_type: block_type,
    state: state,
    cache_config: cache_config,
    src: src,
    metadata: ,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void



84
85
86
87
88
89
90
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 84

def self.validate_raw(obj:)
  obj.block_type.is_a?(String) != false || raise("Passed value for field obj.block_type is not the expected type, validation failed.")
  obj.state&.is_a?(Vellum::PromptBlockState) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
  obj.cache_config.nil? || Vellum::EphemeralPromptCacheConfig.validate_raw(obj: obj.cache_config)
  obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
  obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String



75
76
77
# File 'lib/vellum_ai/types/video_prompt_block.rb', line 75

def to_json
  @_field_set&.to_json
end