Class: ContextDev::Models::ParseHandleParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/context_dev/models/parse_handle_params.rb,
sig/context_dev/models/parse_handle_params.rbs

Overview

See Also:

  • ContextDev::Resources::Parse#handle

Defined Under Namespace

Modules: Extension Classes: Pdf

Constant Summary

Constants included from Internal::Type::RequestParameters

Internal::Type::RequestParameters::ContextDev

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(body:, extension: nil, include_images: nil, include_links: nil, ocr: nil, pdf: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {}) ⇒ Object

Some parameter documentations has been truncated, see ContextDev::Models::ParseHandleParams for more details.

Parameters:

  • body (Pathname, StringIO, IO, String, ContextDev::FilePart)
  • extension (Symbol, ContextDev::Models::ParseHandleParams::Extension) (defaults to: nil)

    Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.

  • include_images (Boolean) (defaults to: nil)

    Include image references in Markdown output

  • include_links (Boolean) (defaults to: nil)

    Preserve hyperlinks in Markdown output

  • ocr (Boolean) (defaults to: nil)

    Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted

  • pdf (ContextDev::Models::ParseHandleParams::Pdf) (defaults to: nil)

    PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)

  • shorten_base64_images (Boolean) (defaults to: nil)

    Shorten base64-encoded image data in the Markdown output

  • use_main_content_only (Boolean) (defaults to: nil)

    Extract only the main content from HTML-like inputs

  • request_options (ContextDev::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


# File 'lib/context_dev/models/parse_handle_params.rb', line 65

Instance Attribute Details

#bodyPathname, ...

Parameters:

  • value (ContextDev::Internal::file_input)

Returns:



13
# File 'lib/context_dev/models/parse_handle_params.rb', line 13

required :body, ContextDev::Internal::Type::FileInput

#extensionSymbol, ...

Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf").



20
# File 'lib/context_dev/models/parse_handle_params.rb', line 20

optional :extension, enum: -> { ContextDev::ParseHandleParams::Extension }

#include_imagesBoolean?

Include image references in Markdown output

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


26
# File 'lib/context_dev/models/parse_handle_params.rb', line 26

optional :include_images, ContextDev::Internal::Type::Boolean

Preserve hyperlinks in Markdown output

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


32
# File 'lib/context_dev/models/parse_handle_params.rb', line 32

optional :include_links, ContextDev::Internal::Type::Boolean

#ocrBoolean?

Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


44
# File 'lib/context_dev/models/parse_handle_params.rb', line 44

optional :ocr, ContextDev::Internal::Type::Boolean

#pdfContextDev::Models::ParseHandleParams::Pdf?

PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range.



51
# File 'lib/context_dev/models/parse_handle_params.rb', line 51

optional :pdf, -> { ContextDev::ParseHandleParams::Pdf }

#shorten_base64_imagesBoolean?

Shorten base64-encoded image data in the Markdown output

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


57
# File 'lib/context_dev/models/parse_handle_params.rb', line 57

optional :shorten_base64_images, ContextDev::Internal::Type::Boolean

#use_main_content_onlyBoolean?

Extract only the main content from HTML-like inputs

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


63
# File 'lib/context_dev/models/parse_handle_params.rb', line 63

optional :use_main_content_only, ContextDev::Internal::Type::Boolean

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/context_dev/models/parse_handle_params.rb', line 163

Instance Method Details

#to_hash{

Returns:

  • ({)


66
# File 'sig/context_dev/models/parse_handle_params.rbs', line 66

def to_hash: -> {