chunkr-ai 0.3.2__tar.gz → 0.3.3__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.
- {chunkr_ai-0.3.2/src/chunkr_ai.egg-info → chunkr_ai-0.3.3}/PKG-INFO +1 -1
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/pyproject.toml +5 -8
- chunkr_ai-0.3.3/src/chunkr_ai/__init__.py +14 -0
- chunkr_ai-0.3.3/src/chunkr_ai/api/auth.py +42 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/configuration.py +1 -1
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3/src/chunkr_ai.egg-info}/PKG-INFO +1 -1
- chunkr_ai-0.3.2/src/chunkr_ai/__init__.py +0 -3
- chunkr_ai-0.3.2/src/chunkr_ai/api/auth.py +0 -13
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/LICENSE +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/README.md +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/setup.cfg +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/__init__.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/chunkr.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/chunkr_base.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/decorators.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/misc.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/protocol.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/api/task_response.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai/models.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai.egg-info/SOURCES.txt +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai.egg-info/dependency_links.txt +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai.egg-info/requires.txt +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/src/chunkr_ai.egg-info/top_level.txt +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/tests/test_chunkr.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/tests/test_excel.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/tests/test_file_handling.py +0 -0
- {chunkr_ai-0.3.2 → chunkr_ai-0.3.3}/tests/test_pages.py +0 -0
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "chunkr-ai"
|
7
|
-
version = "0.3.
|
8
|
-
authors = [{"name" = "Ishaan Kapoor", "email" = "ishaan@lumina.sh"}]
|
7
|
+
version = "0.3.3"
|
8
|
+
authors = [{ "name" = "Ishaan Kapoor", "email" = "ishaan@lumina.sh" }]
|
9
9
|
description = "Python client for Chunkr: open source document intelligence"
|
10
10
|
readme = "README.md"
|
11
|
-
license = {"file" = "LICENSE"}
|
12
|
-
urls = {Homepage = "https://chunkr.ai"}
|
11
|
+
license = { "file" = "LICENSE" }
|
12
|
+
urls = { Homepage = "https://chunkr.ai" }
|
13
13
|
dependencies = [
|
14
14
|
"httpx>=0.25.0",
|
15
15
|
"matplotlib>=3.10.3",
|
@@ -28,7 +28,4 @@ test = [
|
|
28
28
|
]
|
29
29
|
|
30
30
|
[dependency-groups]
|
31
|
-
dev = [
|
32
|
-
"mypy>=1.17.1",
|
33
|
-
]
|
34
|
-
|
31
|
+
dev = ["mypy>=1.17.1"]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from .api.chunkr import Chunkr
|
2
|
+
import tomllib
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
# Read version from pyproject.toml
|
6
|
+
try:
|
7
|
+
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
|
8
|
+
with open(pyproject_path, "rb") as f:
|
9
|
+
pyproject_data = tomllib.load(f)
|
10
|
+
__version__ = pyproject_data["project"]["version"]
|
11
|
+
except Exception:
|
12
|
+
__version__ = "unknown"
|
13
|
+
|
14
|
+
__all__ = ["Chunkr", "__version__"]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import platform
|
2
|
+
import sys
|
3
|
+
import tomllib
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
def _find_pyproject_toml(start_path: Path) -> Path | None:
|
7
|
+
"""Search for pyproject.toml in current and parent directories."""
|
8
|
+
for parent in [start_path, *start_path.parents]:
|
9
|
+
candidate = parent / "pyproject.toml"
|
10
|
+
if candidate.is_file():
|
11
|
+
return candidate
|
12
|
+
return None
|
13
|
+
|
14
|
+
# Read version from pyproject.toml
|
15
|
+
try:
|
16
|
+
pyproject_path = _find_pyproject_toml(Path(__file__).resolve().parent)
|
17
|
+
if pyproject_path is not None:
|
18
|
+
with open(pyproject_path, "rb") as f:
|
19
|
+
pyproject_data = tomllib.load(f)
|
20
|
+
__version__ = pyproject_data["project"]["version"]
|
21
|
+
else:
|
22
|
+
__version__ = "unknown"
|
23
|
+
except Exception:
|
24
|
+
__version__ = "unknown"
|
25
|
+
|
26
|
+
class HeadersMixin:
|
27
|
+
"""Mixin class for handling authorization headers"""
|
28
|
+
_api_key: str = ""
|
29
|
+
|
30
|
+
def get_api_key(self) -> str:
|
31
|
+
"""Get the API key"""
|
32
|
+
if not hasattr(self, "_api_key") or not self._api_key:
|
33
|
+
raise ValueError("API key not set")
|
34
|
+
return self._api_key
|
35
|
+
|
36
|
+
def _headers(self) -> dict:
|
37
|
+
"""Generate authorization headers and version information"""
|
38
|
+
user_agent = f"chunkr-ai/{__version__} (Python/{sys.version.split()[0]}; {platform.system()}/{platform.release()})"
|
39
|
+
return {
|
40
|
+
"Authorization": self.get_api_key(),
|
41
|
+
"User-Agent": user_agent
|
42
|
+
}
|
@@ -85,7 +85,7 @@ class TokenizerType(BaseModel):
|
|
85
85
|
return {}
|
86
86
|
|
87
87
|
class ChunkProcessing(BaseModel):
|
88
|
-
ignore_headers_and_footers: Optional[bool] =
|
88
|
+
ignore_headers_and_footers: Optional[bool] = None # Deprecated
|
89
89
|
target_length: Optional[int] = None
|
90
90
|
tokenizer: Optional[Union[TokenizerType, Tokenizer, str]] = None
|
91
91
|
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class HeadersMixin:
|
2
|
-
"""Mixin class for handling authorization headers"""
|
3
|
-
_api_key: str = ""
|
4
|
-
|
5
|
-
def get_api_key(self) -> str:
|
6
|
-
"""Get the API key"""
|
7
|
-
if not hasattr(self, "_api_key") or not self._api_key:
|
8
|
-
raise ValueError("API key not set")
|
9
|
-
return self._api_key
|
10
|
-
|
11
|
-
def _headers(self) -> dict:
|
12
|
-
"""Generate authorization headers"""
|
13
|
-
return {"Authorization": self.get_api_key()}
|
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
|