chunkr-ai 0.0.30__tar.gz → 0.0.32__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.0.30/src/chunkr_ai.egg-info → chunkr_ai-0.0.32}/PKG-INFO +1 -1
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/pyproject.toml +1 -1
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/decorators.py +8 -1
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/misc.py +1 -1
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32/src/chunkr_ai.egg-info}/PKG-INFO +1 -1
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/tests/test_chunkr.py +11 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/LICENSE +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/README.md +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/setup.cfg +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/__init__.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/__init__.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/auth.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/chunkr.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/chunkr_base.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/configuration.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/protocol.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/api/task_response.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai/models.py +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai.egg-info/SOURCES.txt +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai.egg-info/dependency_links.txt +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai.egg-info/requires.txt +0 -0
- {chunkr_ai-0.0.30 → chunkr_ai-0.0.32}/src/chunkr_ai.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "chunkr-ai"
|
7
|
-
version = "0.0.
|
7
|
+
version = "0.0.32"
|
8
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"
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import functools
|
2
1
|
import asyncio
|
2
|
+
import functools
|
3
3
|
import httpx
|
4
|
+
import nest_asyncio
|
4
5
|
from typing import Callable, Any, TypeVar, Awaitable, Union, overload
|
5
6
|
try:
|
6
7
|
from typing import ParamSpec
|
@@ -21,6 +22,12 @@ def anywhere():
|
|
21
22
|
@functools.wraps(async_func)
|
22
23
|
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Union[Awaitable[T], T]:
|
23
24
|
global _sync_loop
|
25
|
+
|
26
|
+
try:
|
27
|
+
nest_asyncio.apply()
|
28
|
+
except ImportError:
|
29
|
+
pass
|
30
|
+
|
24
31
|
try:
|
25
32
|
asyncio.get_running_loop()
|
26
33
|
return async_func(*args, **kwargs)
|
@@ -32,7 +32,7 @@ async def prepare_file(file: Union[str, Path, BinaryIO, Image.Image], client: ht
|
|
32
32
|
):
|
33
33
|
if not client:
|
34
34
|
raise ValueError("Client must be provided to download files from URLs")
|
35
|
-
response = client.get(file)
|
35
|
+
response = await client.get(file)
|
36
36
|
response.raise_for_status()
|
37
37
|
|
38
38
|
# Try to get filename from Content-Disposition header first
|
@@ -24,6 +24,10 @@ def sample_path():
|
|
24
24
|
def sample_image():
|
25
25
|
return Image.open("tests/files/test.jpg")
|
26
26
|
|
27
|
+
@pytest.fixture
|
28
|
+
def sample_url():
|
29
|
+
return "https://chunkr-web.s3.us-east-1.amazonaws.com/landing_page/input/science.pdf"
|
30
|
+
|
27
31
|
@pytest.fixture
|
28
32
|
def client():
|
29
33
|
client = Chunkr()
|
@@ -36,6 +40,13 @@ async def test_send_file_path(client, sample_path):
|
|
36
40
|
assert response.status == "Succeeded"
|
37
41
|
assert response.output is not None
|
38
42
|
|
43
|
+
@pytest.mark.asyncio
|
44
|
+
async def test_send_file_url(client, sample_url):
|
45
|
+
response = await client.upload(sample_url)
|
46
|
+
assert response.task_id is not None
|
47
|
+
assert response.status == "Succeeded"
|
48
|
+
assert response.output is not None
|
49
|
+
|
39
50
|
@pytest.mark.asyncio
|
40
51
|
async def test_send_file_path_str(client, sample_path):
|
41
52
|
response = await client.upload(str(sample_path))
|
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
|