Module: RagieRubySdk::Mode

Defined in:
lib/ragie_ruby_sdk/models/mode.rb

Overview

Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are ‘’hi_res’‘ or `’fast’‘. When set to `’hi_res’‘, images and tables will be extracted from the document. `’fast’‘ will only extract text. `’fast’‘ may be up to 20x faster than `’hi_res’‘. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `’audio_only’‘, `’video_only’‘, `’audio_video’‘. `’audio_only’‘ will extract just the audio part of the video. `’video_only’‘ will similarly just extract the video part, ignoring audio. `’audio_video’‘ will extract both audio and video. To process all media types at the highest quality, use `’all’‘. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key "static". If you omit a key, that document type won’t be processd. See examples below. Examples Textual documents only "fast" Video documents only { "video": "audio_video" } Specify multiple document types { "static": "hi_res", "audio": true, "video": "video_only" } Specify only textual or audio document types { "static": "fast", "audio": true } Highest quality processing for all media types "all"

Class Method Summary collapse

Class Method Details

.build(data) ⇒ Object

Builds the object

Parameters:

  • Data (Mixed)

    to be matched against the list of anyOf items

Returns:

  • (Object)

    Returns the model or the data itself



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ragie_ruby_sdk/models/mode.rb', line 31

def build(data)
  # Go through the list of anyOf items and attempt to identify the appropriate one.
  # Note:
  # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
  #   due to the way the deserialization is made in the base_object template (it just casts without verifying).
  # - TODO: scalar values are de facto behaving as if they were nullable.
  # - TODO: logging when debugging is set.
  openapi_any_of.each do |klass|
    begin
      next if klass == :AnyType # "nullable: true"
      return find_and_cast_into_type(klass, data)
    rescue # rescue all errors so we keep iterating even if the current item lookup raises
    end
  end

  openapi_any_of.include?(:AnyType) ? data : nil
end

.openapi_any_ofObject

List of class defined in anyOf (OpenAPI v3)



21
22
23
24
25
26
# File 'lib/ragie_ruby_sdk/models/mode.rb', line 21

def openapi_any_of
  [
    :'MediaModeParam',
    :'String'
  ]
end