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)


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cohere/transcribe/types.rb', line 72

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),
    existing: TypesSupport.immutable(existing),
    profile_json: profile_json.nil? ? nil : TypesSupport.path(profile_json)
  )
end

Instance Attribute Details

#existingObject (readonly)

Returns the value of attribute existing

Returns:

  • (Object)

    the current value of existing



71
72
73
# File 'lib/cohere/transcribe/types.rb', line 71

def existing
  @existing
end

#formatsObject (readonly)

Returns the value of attribute formats

Returns:

  • (Object)

    the current value of formats



71
72
73
# File 'lib/cohere/transcribe/types.rb', line 71

def formats
  @formats
end

#output_dirObject (readonly)

Returns the value of attribute output_dir

Returns:

  • (Object)

    the current value of output_dir



71
72
73
# File 'lib/cohere/transcribe/types.rb', line 71

def output_dir
  @output_dir
end

#profile_jsonObject (readonly)

Returns the value of attribute profile_json

Returns:

  • (Object)

    the current value of profile_json



71
72
73
# File 'lib/cohere/transcribe/types.rb', line 71

def profile_json
  @profile_json
end

Class Method Details

.newObject



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

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