Class: Cohere::Transcribe::PublicationOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/cohere/transcribe/types.rb,
sig/cohere/transcribe.rbs

Overview

Optional durable output settings for a transcription run.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formats: nil, output_dir: nil, existing: "error", profile_json: nil) ⇒ PublicationOptions

Returns a new instance of PublicationOptions.

Raises:

  • (ArgumentError)


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cohere/transcribe/types.rb', line 86

def initialize(formats: nil, output_dir: nil, existing: "error", profile_json: nil)
  unless formats.nil?
    formats = TypesSupport.tuple(formats, field: "formats").uniq.freeze
    raise ArgumentError, "formats must contain at least one output format" if formats.empty?

    unsupported = formats.reject { |format| TypesSupport::OUTPUT_FORMATS.include?(format) }
    unless unsupported.empty?
      rendered = unsupported.map(&:to_s).sort.join(", ")
      raise ArgumentError, "Unsupported output format(s): #{rendered}"
    end
  end
  raise ArgumentError, "existing must be 'error', 'overwrite', or 'skip'" unless TypesSupport::EXISTING_POLICIES.include?(existing)

  super(
    formats: formats,
    output_dir: output_dir.nil? ? nil : TypesSupport.path(output_dir, field: "output_dir"),
    existing: TypesSupport.immutable(existing),
    profile_json: profile_json.nil? ? nil : TypesSupport.path(profile_json, field: "profile_json")
  )
end

Instance Attribute Details

#existingObject (readonly)

Returns the value of attribute existing

Returns:

  • (Object)

    the current value of existing



85
86
87
# File 'lib/cohere/transcribe/types.rb', line 85

def existing
  @existing
end

#formatsObject (readonly)

Returns the value of attribute formats

Returns:

  • (Object)

    the current value of formats



85
86
87
# File 'lib/cohere/transcribe/types.rb', line 85

def formats
  @formats
end

#output_dirObject (readonly)

Returns the value of attribute output_dir

Returns:

  • (Object)

    the current value of output_dir



85
86
87
# File 'lib/cohere/transcribe/types.rb', line 85

def output_dir
  @output_dir
end

#profile_jsonObject (readonly)

Returns the value of attribute profile_json

Returns:

  • (Object)

    the current value of profile_json



85
86
87
# File 'lib/cohere/transcribe/types.rb', line 85

def profile_json
  @profile_json
end

Class Method Details

.newObject



27
# File 'sig/cohere/transcribe.rbs', line 27

def self.new: (?formats: Array[output_format]?, ?output_dir: path_input?, ?existing: String,