Class: ContextDev::Resources::Parse
- Inherits:
-
Object
- Object
- ContextDev::Resources::Parse
- Defined in:
- lib/context_dev/resources/parse.rb,
sig/context_dev/resources/parse.rbs
Instance Method Summary collapse
-
#handle(body:, extension: nil, include_images: nil, include_links: nil, ocr: nil, pdf: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {}) ⇒ ContextDev::Models::ParseHandleResponse
Some parameter documentations has been truncated, see Models::ParseHandleParams for more details.
-
#initialize(client:) ⇒ Parse
constructor
private
A new instance of Parse.
Constructor Details
#initialize(client:) ⇒ Parse
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parse.
54 55 56 |
# File 'lib/context_dev/resources/parse.rb', line 54 def initialize(client:) @client = client end |
Instance Method Details
#handle(body:, extension: nil, include_images: nil, include_links: nil, ocr: nil, pdf: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {}) ⇒ ContextDev::Models::ParseHandleResponse
Some parameter documentations has been truncated, see Models::ParseHandleParams for more details.
Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/context_dev/resources/parse.rb', line 37 def handle(params) parsed, = ContextDev::ParseHandleParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed.except(:body)) @client.request( method: :post, path: "parse", query: query, headers: {"content-type" => "application/octet-stream"}, body: parsed[:body], model: ContextDev::Models::ParseHandleResponse, options: ) end |