doctra 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {doctra-0.5.0/doctra.egg-info → doctra-0.5.1}/PKG-INFO +3 -3
  2. {doctra-0.5.0 → doctra-0.5.1}/README.md +2 -2
  3. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/vlm/provider.py +18 -3
  4. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/vlm/service.py +1 -1
  5. {doctra-0.5.0 → doctra-0.5.1}/doctra/version.py +1 -1
  6. {doctra-0.5.0 → doctra-0.5.1/doctra.egg-info}/PKG-INFO +3 -3
  7. {doctra-0.5.0 → doctra-0.5.1}/LICENSE +0 -0
  8. {doctra-0.5.0 → doctra-0.5.1}/MANIFEST.in +0 -0
  9. {doctra-0.5.0 → doctra-0.5.1}/doctra/__init__.py +0 -0
  10. {doctra-0.5.0 → doctra-0.5.1}/doctra/cli/__init__.py +0 -0
  11. {doctra-0.5.0 → doctra-0.5.1}/doctra/cli/main.py +0 -0
  12. {doctra-0.5.0 → doctra-0.5.1}/doctra/cli/utils.py +0 -0
  13. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/__init__.py +0 -0
  14. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/image_restoration/__init__.py +0 -0
  15. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/image_restoration/docres_engine.py +0 -0
  16. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/layout/__init__.py +0 -0
  17. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/layout/layout_models.py +0 -0
  18. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/layout/paddle_layout.py +0 -0
  19. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/ocr/__init__.py +0 -0
  20. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/ocr/api.py +0 -0
  21. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/ocr/path_resolver.py +0 -0
  22. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/ocr/pytesseract_engine.py +0 -0
  23. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/vlm/__init__.py +0 -0
  24. {doctra-0.5.0 → doctra-0.5.1}/doctra/engines/vlm/outlines_types.py +0 -0
  25. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/__init__.py +0 -0
  26. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/excel_writer.py +0 -0
  27. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/html_writer.py +0 -0
  28. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/image_saver.py +0 -0
  29. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/markdown_table.py +0 -0
  30. {doctra-0.5.0 → doctra-0.5.1}/doctra/exporters/markdown_writer.py +0 -0
  31. {doctra-0.5.0 → doctra-0.5.1}/doctra/parsers/__init__.py +0 -0
  32. {doctra-0.5.0 → doctra-0.5.1}/doctra/parsers/enhanced_pdf_parser.py +0 -0
  33. {doctra-0.5.0 → doctra-0.5.1}/doctra/parsers/layout_order.py +0 -0
  34. {doctra-0.5.0 → doctra-0.5.1}/doctra/parsers/structured_pdf_parser.py +0 -0
  35. {doctra-0.5.0 → doctra-0.5.1}/doctra/parsers/table_chart_extractor.py +0 -0
  36. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/MBD.py +0 -0
  37. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/MBD_utils.py +0 -0
  38. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/infer.py +0 -0
  39. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/aspp.py +0 -0
  40. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/backbone/__init__.py +0 -0
  41. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/backbone/drn.py +0 -0
  42. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/backbone/mobilenet.py +0 -0
  43. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/backbone/resnet.py +0 -0
  44. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/backbone/xception.py +0 -0
  45. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/decoder.py +0 -0
  46. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/deeplab.py +0 -0
  47. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/sync_batchnorm/__init__.py +0 -0
  48. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/sync_batchnorm/batchnorm.py +0 -0
  49. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/sync_batchnorm/comm.py +0 -0
  50. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/sync_batchnorm/replicate.py +0 -0
  51. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/MBD/model/deep_lab_model/sync_batchnorm/unittest.py +0 -0
  52. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/data/preprocess/crop_merge_image.py +0 -0
  53. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/inference.py +0 -0
  54. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/models/restormer_arch.py +0 -0
  55. {doctra-0.5.0 → doctra-0.5.1}/doctra/third_party/docres/utils.py +0 -0
  56. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/__init__.py +0 -0
  57. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/app.py +0 -0
  58. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/docres_ui.py +0 -0
  59. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/docres_wrapper.py +0 -0
  60. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/enhanced_parser_ui.py +0 -0
  61. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/full_parse_ui.py +0 -0
  62. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/tables_charts_ui.py +0 -0
  63. {doctra-0.5.0 → doctra-0.5.1}/doctra/ui/ui_helpers.py +0 -0
  64. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/__init__.py +0 -0
  65. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/bbox.py +0 -0
  66. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/constants.py +0 -0
  67. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/file_ops.py +0 -0
  68. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/io_utils.py +0 -0
  69. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/ocr_utils.py +0 -0
  70. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/pdf_io.py +0 -0
  71. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/progress.py +0 -0
  72. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/quiet.py +0 -0
  73. {doctra-0.5.0 → doctra-0.5.1}/doctra/utils/structured_utils.py +0 -0
  74. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/SOURCES.txt +0 -0
  75. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/dependency_links.txt +0 -0
  76. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/entry_points.txt +0 -0
  77. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/not-zip-safe +0 -0
  78. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/requires.txt +0 -0
  79. {doctra-0.5.0 → doctra-0.5.1}/doctra.egg-info/top_level.txt +0 -0
  80. {doctra-0.5.0 → doctra-0.5.1}/pyproject.toml +0 -0
  81. {doctra-0.5.0 → doctra-0.5.1}/requirements.txt +0 -0
  82. {doctra-0.5.0 → doctra-0.5.1}/setup.cfg +0 -0
  83. {doctra-0.5.0 → doctra-0.5.1}/setup.py +0 -0
  84. {doctra-0.5.0 → doctra-0.5.1}/tests/test_structured_pdf_parser.py +0 -0
  85. {doctra-0.5.0 → doctra-0.5.1}/tests/test_table_chart_extractor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doctra
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Parse, extract, and analyze documents with ease
5
5
  Home-page: https://github.com/AdemBoukhris457/Doctra
6
6
  Author: Adem Boukhris
@@ -362,7 +362,7 @@ parser = StructuredPDFParser()
362
362
  # Parser with VLM for structured data extraction
363
363
  parser = StructuredPDFParser(
364
364
  use_vlm=True,
365
- vlm_provider="openai", # or "gemini" or "anthropic" or "openrouter"
365
+ vlm_provider="openai", # or "gemini", "anthropic", "openrouter", "qianfan", "ollama"
366
366
  vlm_api_key="your_api_key_here"
367
367
  )
368
368
 
@@ -917,7 +917,7 @@ parser.display_pages_with_boxes("document.pdf")
917
917
 
918
918
  ### 🤖 VLM Integration
919
919
  - Vision Language Model support for structured data extraction
920
- - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter)
920
+ - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter, Qianfan, Ollama)
921
921
  - Automatic conversion of charts and tables to structured formats
922
922
 
923
923
  ### 📊 Multiple Output Formats
@@ -102,7 +102,7 @@ parser = StructuredPDFParser()
102
102
  # Parser with VLM for structured data extraction
103
103
  parser = StructuredPDFParser(
104
104
  use_vlm=True,
105
- vlm_provider="openai", # or "gemini" or "anthropic" or "openrouter"
105
+ vlm_provider="openai", # or "gemini", "anthropic", "openrouter", "qianfan", "ollama"
106
106
  vlm_api_key="your_api_key_here"
107
107
  )
108
108
 
@@ -657,7 +657,7 @@ parser.display_pages_with_boxes("document.pdf")
657
657
 
658
658
  ### 🤖 VLM Integration
659
659
  - Vision Language Model support for structured data extraction
660
- - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter)
660
+ - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter, Qianfan, Ollama)
661
661
  - Automatic conversion of charts and tables to structured formats
662
662
 
663
663
  ### 📊 Multiple Output Formats
@@ -22,10 +22,10 @@ def make_model(
22
22
  """
23
23
  Build a callable Outlines model for VLM processing.
24
24
 
25
- Creates an Outlines model instance configured for Gemini, OpenAI, Anthropic, OpenRouter, or Ollama
25
+ Creates an Outlines model instance configured for Gemini, OpenAI, Anthropic, OpenRouter, Qianfan, or Ollama
26
26
  providers. Only one backend is active at a time, with Gemini as the default.
27
27
 
28
- :param vlm_provider: VLM provider to use ("gemini", "openai", "anthropic", "openrouter", or "ollama", default: "gemini")
28
+ :param vlm_provider: VLM provider to use ("gemini", "openai", "anthropic", "openrouter", "qianfan", or "ollama", default: "gemini")
29
29
  :param vlm_model: Model name to use (defaults to provider-specific defaults)
30
30
  :param api_key: API key for the VLM provider (required for all providers except Ollama)
31
31
  :return: Configured Outlines model instance
@@ -43,6 +43,8 @@ def make_model(
43
43
  vlm_model = "claude-opus-4-1"
44
44
  elif vlm_provider == "openrouter":
45
45
  vlm_model = "x-ai/grok-4"
46
+ elif vlm_provider == "qianfan":
47
+ vlm_model = "ernie-4.5-turbo-vl-32k"
46
48
  elif vlm_provider == "ollama":
47
49
  vlm_model = "llava:latest"
48
50
 
@@ -87,11 +89,24 @@ def make_model(
87
89
  vlm_model
88
90
  )
89
91
 
92
+ if vlm_provider == "qianfan":
93
+ if not api_key:
94
+ raise ValueError("Qianfan provider requires api_key to be passed to make_model(...).")
95
+ # Create the Qianfan client with OpenAI-compatible interface
96
+ client = openai.OpenAI(
97
+ base_url="https://qianfan.baidubce.com/v2",
98
+ api_key=api_key,
99
+ )
100
+ return outlines.from_openai(
101
+ client,
102
+ vlm_model
103
+ )
104
+
90
105
  if vlm_provider == "ollama":
91
106
  # Ollama doesn't use Outlines, so we return a custom wrapper
92
107
  return OllamaModelWrapper(vlm_model)
93
108
 
94
- raise ValueError(f"Unsupported provider: {vlm_provider}. Use 'gemini', 'openai', 'anthropic', 'openrouter', or 'ollama'.")
109
+ raise ValueError(f"Unsupported provider: {vlm_provider}. Use 'gemini', 'openai', 'anthropic', 'openrouter', 'qianfan', or 'ollama'.")
95
110
 
96
111
 
97
112
  class OllamaModelWrapper:
@@ -32,7 +32,7 @@ class VLMStructuredExtractor:
32
32
  """
33
33
  Initialize the VLMStructuredExtractor with provider configuration.
34
34
 
35
- :param vlm_provider: VLM provider to use ("gemini", "openai", "anthropic", or "openrouter", default: "gemini")
35
+ :param vlm_provider: VLM provider to use ("gemini", "openai", "anthropic", "openrouter", "qianfan", or "ollama", default: "gemini")
36
36
  :param vlm_model: Model name to use (defaults to provider-specific defaults)
37
37
  :param api_key: API key for the VLM provider (required for all providers)
38
38
  """
@@ -1,2 +1,2 @@
1
1
  """Version information for Doctra."""
2
- __version__ = '0.5.0'
2
+ __version__ = '0.5.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doctra
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Parse, extract, and analyze documents with ease
5
5
  Home-page: https://github.com/AdemBoukhris457/Doctra
6
6
  Author: Adem Boukhris
@@ -362,7 +362,7 @@ parser = StructuredPDFParser()
362
362
  # Parser with VLM for structured data extraction
363
363
  parser = StructuredPDFParser(
364
364
  use_vlm=True,
365
- vlm_provider="openai", # or "gemini" or "anthropic" or "openrouter"
365
+ vlm_provider="openai", # or "gemini", "anthropic", "openrouter", "qianfan", "ollama"
366
366
  vlm_api_key="your_api_key_here"
367
367
  )
368
368
 
@@ -917,7 +917,7 @@ parser.display_pages_with_boxes("document.pdf")
917
917
 
918
918
  ### 🤖 VLM Integration
919
919
  - Vision Language Model support for structured data extraction
920
- - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter)
920
+ - Multiple provider options (OpenAI, Gemini, Anthropic, OpenRouter, Qianfan, Ollama)
921
921
  - Automatic conversion of charts and tables to structured formats
922
922
 
923
923
  ### 📊 Multiple Output Formats
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes