HowdenParser 0.1.8__tar.gz → 0.1.12__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.
@@ -2,6 +2,7 @@ from abc import ABC, abstractmethod
2
2
  from dotenv import load_dotenv
3
3
  import os
4
4
  from pathlib import Path
5
+ import logging
5
6
 
6
7
  load_dotenv()
7
8
 
@@ -58,24 +59,34 @@ class LangChainParser(BaseParser):
58
59
 
59
60
 
60
61
  class LlamaParser(BaseParser):
61
- def __init__(self, result_type: str, mode: bool, **kwargs) -> None:
62
+ def __init__(self, result_type: str, mode: bool) -> None:
63
+ logging.info("Initializing LlamaParser...")
64
+ logging.info("Loading LlamaParse package...")
65
+
62
66
  from llama_parse import LlamaParse, ResultType
67
+
63
68
  if result_type.lower() == "md" or result_type.lower() == "markdown":
64
69
  self.result_type = ResultType.MD
70
+
65
71
  name = "LLAMA-PARSER-API-TOKEN"
66
- self.api_key = os.getenv(name)
67
- if not self.api_key:
72
+ api_key = os.getenv(name)
73
+ if not api_key:
68
74
  raise EnvironmentError(f"Missing {name} in .env file.")
69
75
 
76
+ logging.info("Initializing LlamaParse parser...")
70
77
  self.parser = LlamaParse(
71
- api_key=self.api_key,
78
+ api_key=api_key,
72
79
  result_type=self.result_type,
73
80
  premium_mode=mode
74
81
  )
82
+ logging.info("LlamaParser initialized successfully.")
75
83
 
76
84
  def parse(self, file_path: Path) -> str:
85
+ logging.info(f"Parsing file: {file_path}")
77
86
  documents = self.parser.load_data(str(file_path))
78
- return "\n".join(doc.text for doc in documents)
87
+ text = "\n".join(doc.text for doc in documents)
88
+ logging.info(f"Parsing completed. Extracted {len(documents)} documents.")
89
+ return text
79
90
 
80
91
  class HuggingFaceParser(BaseParser):
81
92
  def __init__(self, result_type: str, mode: bool, **kwargs) -> None:
@@ -127,7 +138,7 @@ class ParserFactory:
127
138
  if provider == "langchain":
128
139
  return LangChainParser(model_name=model)
129
140
  elif provider == "llamaparser":
130
- return LlamaParser(**kwargs)
141
+ return LlamaParser(kwargs["result_type"], kwargs["mode"])
131
142
  elif provider == "huggingface":
132
143
  return HuggingFaceParser(model_name=model, **kwargs)
133
144
  elif provider == "mistralocr":
@@ -1,25 +1,22 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: HowdenParser
3
- Version: 0.1.8
3
+ Version: 0.1.12
4
4
  Summary: A simple configuration manager with Pydantic and JSON export.
5
5
  License: MIT
6
6
  Keywords: config,configuration,pydantic,json
7
7
  Author: JesperThoftIllemannJ
8
8
  Author-email: jesper.jaeger@howdendanmark.dk
9
+ Requires-Python: >=3.12,<4.0
9
10
  Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 2
11
- Classifier: Programming Language :: Python :: 2.7
12
11
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.4
14
- Classifier: Programming Language :: Python :: 3.5
15
- Classifier: Programming Language :: Python :: 3.6
16
- Classifier: Programming Language :: Python :: 3.7
17
- Classifier: Programming Language :: Python :: 3.8
18
- Classifier: Programming Language :: Python :: 3.9
19
- Classifier: Programming Language :: Python :: 3.10
20
- Classifier: Programming Language :: Python :: 3.11
21
12
  Classifier: Programming Language :: Python :: 3.12
22
13
  Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: fitz (>=0.0.1.dev2,<0.0.2)
15
+ Requires-Dist: howdenconfig (>=0.1.13,<0.2.0)
16
+ Requires-Dist: langchain (>=0.3.27,<0.4.0)
17
+ Requires-Dist: llama-parse (>=0.6.58,<0.7.0)
18
+ Requires-Dist: mistralai (>=1.9.3,<2.0.0)
19
+ Requires-Dist: transformers (>=4.55.2,<5.0.0)
23
20
  Project-URL: Documentation, https://github.com/yourusername/config
24
21
  Project-URL: Homepage, https://github.com/yourusername/config
25
22
  Project-URL: Repository, https://github.com/yourusername/config
@@ -1,10 +1,20 @@
1
+ [project]
2
+ name = "HowdenParser"
3
+ description = ""
4
+ readme = "README.md"
5
+ requires-python = ">=3.12,<4.0"
6
+ dependencies = [ "mistralai (>=1.9.3,<2.0.0)", "llama-parse (>=0.6.58,<0.7.0)", "langchain (>=0.3.27,<0.4.0)", "transformers (>=4.55.2,<5.0.0)", "fitz (>=0.0.1.dev2,<0.0.2)", "howdenconfig (>=0.1.13,<0.2.0)",]
7
+ [[project.authors]]
8
+ name = "JesperThoftIllemannJ"
9
+ email = "jesper.jaeger@howdendanmark.dk"
10
+
1
11
  [build-system]
2
12
  requires = [ "poetry-core>=2.0.0,<3.0.0",]
3
13
  build-backend = "poetry.core.masonry.api"
4
14
 
5
15
  [tool.poetry]
6
16
  name = "HowdenParser"
7
- version = "0.1.8"
17
+ version = "0.1.12"
8
18
  description = "A simple configuration manager with Pydantic and JSON export."
9
19
  authors = [ "JesperThoftIllemannJ <jesper.jaeger@howdendanmark.dk>",]
10
20
  readme = "README.md"
File without changes