llamaparserb 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1761244b0d8ac8c6ee13eb10b50d3eadcb182d8e7bad24828ba70a290bc7507
4
- data.tar.gz: cf7908683f630f17ef39b4c7e6393cb4637e350ea89c674c78a03a68b1bdf1c5
3
+ metadata.gz: ba81bbf8d24dc79b57a29c8c40764c42d700012e6608d1a494075dd63900d06f
4
+ data.tar.gz: 1ce8846e182bf7025d90e8722148554fe2e65d47d82e1671e19f7e6386d30ce9
5
5
  SHA512:
6
- metadata.gz: 7bc3f4c44814c1cf63ad480882ee7f2b647af3ee8b34b46d95da7ae90c372b656c0f69fd224ba1c03d26cfa5185ee89a356f05e080169375945fc0f8d3548d8d
7
- data.tar.gz: 5e8d6c3d234e298836f2f373d515321337d1f1ab1904a38e9dfb8a1e6076b6307e69e84d93b5fd27fd02f3f0642e19f8adc38b9de20e5d0ac87b47600b13de90
6
+ metadata.gz: b5c86e77644210049df9a1095049e2a276f70e40208637e80fd14283fded8eee45ec034cc9bd7c205b802ef24be252989bbd5be671ac50981c0acb998876131b
7
+ data.tar.gz: 91ea52459cc1fc38f15dd5b050a2c25449147f8905d24af34c76986f48c84f54d0187bad3c0d3b4da81061e8d593982252229611592948deffdc7a6d6d6c066f
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.3] - 2024-11-28
10
+ ### Added
11
+ - Add support for all supported optional llamaparsse parameters to `parse_file`
12
+
9
13
  ## [0.2.2] - 2024-11-28
10
14
  ### Fixed
11
15
  - Fix issue with handling file path
data/README.md CHANGED
@@ -75,19 +75,112 @@ client.parse_file(temp_file, 'pdf')
75
75
  client = Llamaparserb::Client.new(
76
76
  ENV['LLAMA_CLOUD_API_KEY'],
77
77
  {
78
- result_type: "markdown", # Output format: "text" or "markdown"
79
- num_workers: 4, # Number of workers for concurrent processing
80
- check_interval: 1, # How often to check job status (seconds)
81
- max_timeout: 2000, # Maximum time to wait for parsing (seconds)
82
- verbose: true, # Enable detailed logging
83
- language: :en, # Target language
84
- parsing_instruction: "", # Custom parsing instructions
85
- premium_mode: false, # Enable premium parsing features
86
- split_by_page: true # Split result by pages
78
+ # Basic Configuration
79
+ result_type: "markdown", # Output format: "text" or "markdown"
80
+ num_workers: 4, # Number of workers for concurrent processing
81
+ check_interval: 1, # How often to check job status (seconds)
82
+ max_timeout: 2000, # Maximum time to wait for parsing (seconds)
83
+ verbose: true, # Enable detailed logging
84
+ show_progress: true, # Show progress during parsing
85
+ ignore_errors: true, # Return nil instead of raising errors
86
+
87
+ # Language and Parsing Options
88
+ language: :en, # Target language for parsing
89
+ parsing_instruction: "", # Custom parsing instructions
90
+ skip_diagonal_text: false, # Skip diagonal text in documents
91
+ invalidate_cache: false, # Force reprocessing of cached documents
92
+ do_not_cache: false, # Disable caching of results
93
+
94
+ # Processing Modes
95
+ fast_mode: false, # Enable faster processing (may reduce quality)
96
+ premium_mode: false, # Enable premium parsing features
97
+ continuous_mode: false, # Process document as continuous text
98
+ do_not_unroll_columns: false, # Keep columnar text structure
99
+
100
+ # Page Handling
101
+ split_by_page: true, # Split result by pages
102
+ page_separator: "\n\n", # Custom page separator
103
+ page_prefix: "Page ", # Text to prepend to each page
104
+ page_suffix: "\n", # Text to append to each page
105
+ target_pages: [1,2,3], # Array of specific pages to process
106
+ bounding_box: { # Specify area to parse (coordinates in pixels)
107
+ x1: 0, y1: 0, # Top-left corner
108
+ x2: 612, y2: 792 # Bottom-right corner
109
+ },
110
+
111
+ # OCR and Image Processing
112
+ disable_ocr: false, # Disable Optical Character Recognition
113
+ take_screenshot: false, # Capture screenshot of document
114
+
115
+ # Advanced Processing Features
116
+ gpt4o_mode: false, # Enable GPT-4 Optimization mode
117
+ gpt4o_api_key: "key", # API key for GPT-4 Optimization
118
+ guess_xlsx_sheet_names: false, # Attempt to guess Excel sheet names
119
+ is_formatting_instruction: false, # Use formatting instructions
120
+ annotate_links: false, # Include link annotations in output
121
+
122
+ # Multimodal Processing
123
+ vendor_multimodal_api_key: "key", # API key for multimodal processing
124
+ use_vendor_multimodal_model: false, # Enable multimodal model
125
+ vendor_multimodal_model_name: "model", # Specify multimodal model
126
+
127
+ # Integration Options
128
+ webhook_url: "https://...", # URL for webhook notifications
129
+ http_proxy: "http://...", # HTTP proxy configuration
130
+
131
+ # Azure OpenAI Configuration
132
+ azure_openai_deployment_name: "deployment", # Azure OpenAI deployment name
133
+ azure_openai_endpoint: "endpoint", # Azure OpenAI endpoint
134
+ azure_openai_api_version: "2023-05-15", # Azure OpenAI API version
135
+ azure_openai_key: "key" # Azure OpenAI API key
87
136
  }
88
137
  )
89
138
  ```
90
139
 
140
+ ### Feature-Specific Options
141
+
142
+ #### Page Processing
143
+ - `split_by_page`: Split the document into separate pages
144
+ - `page_separator`: Custom text to insert between pages
145
+ - `page_prefix`/`page_suffix`: Add custom text before/after each page
146
+ - `target_pages`: Process only specific pages
147
+ - `bounding_box`: Parse only a specific area of the document
148
+
149
+ #### OCR and Image Processing
150
+ - `disable_ocr`: Turn off Optical Character Recognition
151
+ - `take_screenshot`: Generate document screenshots
152
+ - `skip_diagonal_text`: Ignore text at diagonal angles
153
+
154
+ #### Advanced Processing
155
+ - `continuous_mode`: Process text as a continuous stream
156
+ - `do_not_unroll_columns`: Preserve column structure
157
+ - `guess_xlsx_sheet_names`: Auto-detect Excel sheet names
158
+ - `annotate_links`: Include document hyperlinks in output
159
+ - `is_formatting_instruction`: Use special formatting instructions
160
+
161
+ #### Performance Options
162
+ - `fast_mode`: Faster processing with potential quality trade-offs
163
+ - `premium_mode`: Access to premium features
164
+ - `invalidate_cache`/`do_not_cache`: Control result caching
165
+ - `num_workers`: Configure concurrent processing
166
+
167
+ #### Integration Features
168
+ - `webhook_url`: Receive processing notifications
169
+ - `http_proxy`: Configure proxy settings
170
+
171
+ #### Azure OpenAI Integration
172
+ Configure Azure OpenAI services with:
173
+ - `azure_openai_deployment_name`
174
+ - `azure_openai_endpoint`
175
+ - `azure_openai_api_version`
176
+ - `azure_openai_key`
177
+
178
+ #### Multimodal Processing
179
+ Enable advanced multimodal processing with:
180
+ - `vendor_multimodal_api_key`
181
+ - `use_vendor_multimodal_model`
182
+ - `vendor_multimodal_model_name`
183
+
91
184
  ### Supported File Types
92
185
 
93
186
  The client supports a wide range of file formats including:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Llamaparserb
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/llamaparserb.rb CHANGED
@@ -100,7 +100,20 @@ module Llamaparserb
100
100
  bounding_box: nil,
101
101
  target_pages: nil,
102
102
  ignore_errors: true,
103
- split_by_page: true
103
+ split_by_page: true,
104
+ vendor_multimodal_api_key: nil,
105
+ use_vendor_multimodal_model: false,
106
+ vendor_multimodal_model_name: nil,
107
+ take_screenshot: false,
108
+ disable_ocr: false,
109
+ is_formatting_instruction: false,
110
+ annotate_links: false,
111
+ webhook_url: nil,
112
+ azure_openai_deployment_name: nil,
113
+ azure_openai_endpoint: nil,
114
+ azure_openai_api_version: nil,
115
+ azure_openai_key: nil,
116
+ http_proxy: nil
104
117
  }
105
118
  end
106
119
 
@@ -237,7 +250,7 @@ module Llamaparserb
237
250
  end
238
251
 
239
252
  def upload_params(file)
240
- {
253
+ params = {
241
254
  file: file,
242
255
  language: @options[:language].to_s,
243
256
  parsing_instruction: @options[:parsing_instruction],
@@ -250,8 +263,30 @@ module Llamaparserb
250
263
  do_not_unroll_columns: @options[:do_not_unroll_columns],
251
264
  gpt4o_mode: @options[:gpt4o_mode],
252
265
  gpt4o_api_key: @options[:gpt4o_api_key],
266
+ vendor_multimodal_api_key: @options[:vendor_multimodal_api_key],
267
+ use_vendor_multimodal_model: @options[:use_vendor_multimodal_model],
268
+ vendor_multimodal_model_name: @options[:vendor_multimodal_model_name],
269
+ take_screenshot: @options[:take_screenshot],
270
+ disable_ocr: @options[:disable_ocr],
271
+ guess_xlsx_sheet_names: @options[:guess_xlsx_sheet_names],
272
+ is_formatting_instruction: @options[:is_formatting_instruction],
273
+ annotate_links: @options[:annotate_links],
253
274
  from_ruby_package: true
254
- }.compact
275
+ }
276
+
277
+ params[:page_separator] = @options[:page_separator] if @options[:page_separator]
278
+ params[:page_prefix] = @options[:page_prefix] if @options[:page_prefix]
279
+ params[:page_suffix] = @options[:page_suffix] if @options[:page_suffix]
280
+ params[:bounding_box] = @options[:bounding_box] if @options[:bounding_box]
281
+ params[:target_pages] = @options[:target_pages] if @options[:target_pages]
282
+ params[:webhook_url] = @options[:webhook_url] if @options[:webhook_url]
283
+ params[:azure_openai_deployment_name] = @options[:azure_openai_deployment_name] if @options[:azure_openai_deployment_name]
284
+ params[:azure_openai_endpoint] = @options[:azure_openai_endpoint] if @options[:azure_openai_endpoint]
285
+ params[:azure_openai_api_version] = @options[:azure_openai_api_version] if @options[:azure_openai_api_version]
286
+ params[:azure_openai_key] = @options[:azure_openai_key] if @options[:azure_openai_key]
287
+ params[:http_proxy] = @options[:http_proxy] if @options[:http_proxy]
288
+
289
+ params.compact
255
290
  end
256
291
 
257
292
  def get_job_status(job_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llamaparserb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heidar Bernhardsson