docHandler4AISDK 0.0.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.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: docHandler4AISDK
3
+ Version: 0.0.1
4
+ Summary: SDK for docHandler4AI
5
+ Author: Mohamed Hasnaoui
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: httpx
File without changes
@@ -0,0 +1,10 @@
1
+ from .client import DocHandler4AIClient
2
+ from .pdf import PDFAPI
3
+
4
+
5
+ class DocHandler4AI:
6
+
7
+ def __init__(self,base_url:str,api_key: str,):
8
+ client = DocHandler4AIClient(base_url,api_key)
9
+ self.pdf = PDFAPI(client)
10
+
@@ -0,0 +1,38 @@
1
+ import httpx
2
+
3
+
4
+ class DocHandler4AIClient:
5
+
6
+ def __init__(
7
+ self,
8
+ base_url: str,
9
+ api_key: str,
10
+ timeout: int = 300
11
+ ):
12
+ self.base_url = base_url.rstrip("/")
13
+ self.api_key = api_key
14
+ self.timeout = timeout
15
+
16
+ async def post(
17
+ self,
18
+ endpoint: str,
19
+ json: dict
20
+ ):
21
+
22
+ headers = {
23
+ "Authorization": f"Bearer {self.api_key}"
24
+ }
25
+
26
+ async with httpx.AsyncClient(
27
+ timeout=self.timeout
28
+ ) as client:
29
+
30
+ response = await client.post(
31
+ f"{self.base_url}{endpoint}",
32
+ json=json,
33
+ headers=headers
34
+ )
35
+
36
+ response.raise_for_status()
37
+
38
+ return response.json()
File without changes
File without changes
@@ -0,0 +1,29 @@
1
+ from .client import DocHandler4AIClient
2
+ from typing import Literal
3
+
4
+ class PDFAPI:
5
+
6
+ def __init__(self, client: DocHandler4AIClient):
7
+ self.client = client
8
+
9
+ async def process(
10
+ self,
11
+ pdf_url: str,
12
+ response_output: Literal['chunks','markdown'] = "chunks",
13
+ max_tokens: int = 500,
14
+ image_to_text_model: str | None = None,
15
+ formula_to_latex_model: str | None = None,
16
+ id: str | None = None
17
+ )->str | list[str]:
18
+
19
+ payload = {
20
+ "id": id,
21
+ "pdf_url": pdf_url,
22
+ "max_tokens": max_tokens,
23
+ "image_to_text_model": image_to_text_model,
24
+ "formula_to_latex_model": formula_to_latex_model
25
+ }
26
+
27
+ return await self.client.post(f"/pdf/{response_output}",payload)
28
+
29
+
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: docHandler4AISDK
3
+ Version: 0.0.1
4
+ Summary: SDK for docHandler4AI
5
+ Author: Mohamed Hasnaoui
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: httpx
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ docHandler4AISDK/__init__.py
5
+ docHandler4AISDK/client.py
6
+ docHandler4AISDK/exceptions.py
7
+ docHandler4AISDK/models.py
8
+ docHandler4AISDK/pdf.py
9
+ docHandler4AISDK.egg-info/PKG-INFO
10
+ docHandler4AISDK.egg-info/SOURCES.txt
11
+ docHandler4AISDK.egg-info/dependency_links.txt
12
+ docHandler4AISDK.egg-info/requires.txt
13
+ docHandler4AISDK.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ docHandler4AISDK
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "docHandler4AISDK"
7
+ version = "0.0.1"
8
+ description = "SDK for docHandler4AI"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+
12
+ authors = [
13
+ { name="Mohamed Hasnaoui" }
14
+ ]
15
+
16
+ dependencies = [
17
+ "httpx"
18
+ ]
19
+
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "Operating System :: OS Independent"
23
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="docHandler4AISDK",
5
+ version="0.0.1",
6
+ packages=find_packages(),
7
+ install_requires=[
8
+ "httpx"
9
+ ],
10
+ )