groundx 2.5.1__tar.gz → 2.5.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.
Potentially problematic release.
This version of groundx might be problematic. Click here for more details.
- {groundx-2.5.1 → groundx-2.5.3}/PKG-INFO +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/pyproject.toml +5 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/client_wrapper.py +2 -2
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/__init__.py +14 -4
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/agents/agent.py +2 -2
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/__init__.py +7 -10
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/document.py +11 -3
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/prompt.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/test_document.py +4 -29
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/test_groundx.py +26 -0
- groundx-2.5.3/src/groundx/extract/post_process/__init__.py +7 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/ratelimit.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/sheets_client.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/status.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/upload.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/upload_minio.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/upload_s3.py +1 -1
- groundx-2.5.3/src/groundx/extract/settings/__init__.py +15 -0
- groundx-2.5.3/src/groundx/extract/tasks/__init__.py +6 -0
- groundx-2.5.3/src/groundx/extract/tasks/utility.py +27 -0
- groundx-2.5.3/src/groundx/extract/utility/__init__.py +15 -0
- groundx-2.5.1/src/groundx/extract/classes/utility.py → groundx-2.5.3/src/groundx/extract/utility/classes.py +1 -1
- {groundx-2.5.1/src/groundx/extract/classes → groundx-2.5.3/src/groundx/extract/utility}/test_utility.py +1 -1
- {groundx-2.5.1 → groundx-2.5.3}/LICENSE +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/README.md +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/buckets/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/buckets/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/buckets/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/api_error.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/datetime_utils.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/file.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/force_multipart.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/http_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/http_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/jsonable_encoder.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/pydantic_utilities.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/query_encoder.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/remove_none_from_dict.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/request_options.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/core/serialization.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/csv_splitter.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/customer/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/customer/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/customer/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/documents/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/documents/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/documents/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/environment.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/errors/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/errors/bad_request_error.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/errors/unauthorized_error.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/agents/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/agent.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/api.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/field.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/groundx.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/test_field.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/classes/test_prompt.py +0 -0
- {groundx-2.5.1/src/groundx/extract/classes → groundx-2.5.3/src/groundx/extract/post_process}/post_process.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/.DS_Store +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/csv.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/logger.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/logging_cfg.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/extract/services/utility.py +0 -0
- {groundx-2.5.1/src/groundx/extract/classes → groundx-2.5.3/src/groundx/extract/settings}/settings.py +0 -0
- {groundx-2.5.1/src/groundx/extract/classes → groundx-2.5.3/src/groundx/extract/settings}/test_settings.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/groups/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/groups/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/groups/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/health/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/health/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/health/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/ingest.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/py.typed +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/search/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/search/client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/search/raw_client.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/search/types/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/search/types/search_content_request_id.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/__init__.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bounding_box_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bucket_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bucket_list_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bucket_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bucket_update_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/bucket_update_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/customer_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/customer_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_list_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_local_ingest_request.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_lookup_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/document_type.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/group_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/group_list_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/group_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/health_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/health_response_health.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/health_service.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/health_service_status.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_local_document.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_local_document_metadata.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_remote_document.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_light.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_progress.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_progress_cancelled.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_progress_complete.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_progress_errors.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/ingest_status_progress_processing.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/message_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/meter_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/process_level.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/processes_status_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/processing_status.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/search_response.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/search_response_search.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/search_result_item.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/search_result_item_pages_item.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/sort.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/sort_order.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/subscription_detail.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/subscription_detail_meters.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/types/website_source.py +0 -0
- {groundx-2.5.1 → groundx-2.5.3}/src/groundx/version.py +0 -0
|
@@ -3,7 +3,7 @@ name = "groundx"
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "groundx"
|
|
6
|
-
version = "2.5.
|
|
6
|
+
version = "2.5.3"
|
|
7
7
|
description = ""
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
authors = []
|
|
@@ -136,3 +136,7 @@ ignore_missing_imports = true
|
|
|
136
136
|
[[tool.mypy.overrides]]
|
|
137
137
|
module = ["groundx.extract.classes.document"]
|
|
138
138
|
disable_error_code = ["call-arg"]
|
|
139
|
+
|
|
140
|
+
[[tool.mypy.overrides]]
|
|
141
|
+
module = ["groundx.extract.tasks.utility"]
|
|
142
|
+
disable_error_code = ["call-arg"]
|
|
@@ -14,10 +14,10 @@ class BaseClientWrapper:
|
|
|
14
14
|
|
|
15
15
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
|
17
|
-
"User-Agent": "groundx/2.5.
|
|
17
|
+
"User-Agent": "groundx/2.5.3",
|
|
18
18
|
"X-Fern-Language": "Python",
|
|
19
19
|
"X-Fern-SDK-Name": "groundx",
|
|
20
|
-
"X-Fern-SDK-Version": "2.5.
|
|
20
|
+
"X-Fern-SDK-Version": "2.5.3",
|
|
21
21
|
}
|
|
22
22
|
headers["X-API-Key"] = self.api_key
|
|
23
23
|
return headers
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
from .agents import AgentCode, AgentTool
|
|
2
2
|
from .classes import (
|
|
3
3
|
AgentRequest,
|
|
4
|
-
AgentSettings,
|
|
5
|
-
ContainerSettings,
|
|
6
|
-
ContainerUploadSettings,
|
|
7
4
|
Document,
|
|
8
5
|
DocumentRequest,
|
|
9
6
|
ExtractedField,
|
|
10
7
|
GroundXDocument,
|
|
11
|
-
GroundXSettings,
|
|
12
8
|
ProcessResponse,
|
|
13
9
|
Prompt,
|
|
10
|
+
TestChunk,
|
|
11
|
+
TestDocumentPage,
|
|
12
|
+
TestField,
|
|
13
|
+
TestXRay,
|
|
14
14
|
XRayDocument,
|
|
15
15
|
)
|
|
16
16
|
from .services import Logger, RateLimit, SheetsClient, Status, Upload
|
|
17
|
+
from .settings import (
|
|
18
|
+
AgentSettings,
|
|
19
|
+
ContainerSettings,
|
|
20
|
+
ContainerUploadSettings,
|
|
21
|
+
GroundXSettings,
|
|
22
|
+
)
|
|
17
23
|
|
|
18
24
|
__all__ = [
|
|
19
25
|
"AgentCode",
|
|
@@ -33,6 +39,10 @@ __all__ = [
|
|
|
33
39
|
"RateLimit",
|
|
34
40
|
"SheetsClient",
|
|
35
41
|
"Status",
|
|
42
|
+
"TestChunk",
|
|
43
|
+
"TestDocumentPage",
|
|
44
|
+
"TestField",
|
|
45
|
+
"TestXRay",
|
|
36
46
|
"Upload",
|
|
37
47
|
"XRayDocument",
|
|
38
48
|
]
|
|
@@ -13,9 +13,9 @@ from smolagents.models import ( # pyright: ignore[reportMissingTypeStubs]
|
|
|
13
13
|
OpenAIServerModel,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
from ..classes.settings import AgentSettings
|
|
17
|
-
from ..classes.utility import clean_json
|
|
18
16
|
from ..services.logger import Logger
|
|
17
|
+
from ..settings.settings import AgentSettings
|
|
18
|
+
from ..utility.classes import clean_json
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
prompt_suffix = """
|
|
@@ -4,24 +4,21 @@ from .document import Document, DocumentRequest
|
|
|
4
4
|
from .field import ExtractedField
|
|
5
5
|
from .groundx import GroundXDocument, XRayDocument
|
|
6
6
|
from .prompt import Prompt
|
|
7
|
-
from .
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ContainerUploadSettings,
|
|
11
|
-
GroundXSettings,
|
|
12
|
-
)
|
|
7
|
+
from .test_field import TestField
|
|
8
|
+
from .test_groundx import TestChunk, TestDocumentPage, TestXRay
|
|
9
|
+
|
|
13
10
|
|
|
14
11
|
__all__ = [
|
|
15
12
|
"AgentRequest",
|
|
16
|
-
"AgentSettings",
|
|
17
|
-
"ContainerSettings",
|
|
18
|
-
"ContainerUploadSettings",
|
|
19
13
|
"Document",
|
|
20
14
|
"DocumentRequest",
|
|
21
15
|
"ExtractedField",
|
|
22
16
|
"GroundXDocument",
|
|
23
|
-
"GroundXSettings",
|
|
24
17
|
"ProcessResponse",
|
|
25
18
|
"Prompt",
|
|
19
|
+
"TestChunk",
|
|
20
|
+
"TestDocumentPage",
|
|
21
|
+
"TestField",
|
|
22
|
+
"TestXRay",
|
|
26
23
|
"XRayDocument",
|
|
27
24
|
]
|
|
@@ -6,7 +6,7 @@ from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
|
|
6
6
|
|
|
7
7
|
from .groundx import GroundXDocument
|
|
8
8
|
from ..services.logger import Logger
|
|
9
|
-
from .
|
|
9
|
+
from ..utility.classes import clean_json
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
DocT = typing.TypeVar("DocT", bound="Document")
|
|
@@ -116,6 +116,14 @@ class Document(BaseModel):
|
|
|
116
116
|
self.logger.debug_msg(msg, self.file_name, self.document_id, self.task_id)
|
|
117
117
|
|
|
118
118
|
|
|
119
|
+
def _new_page_image_dict() -> typing.Dict[str, int]:
|
|
120
|
+
return {}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _new_page_images() -> typing.List[Image.Image]:
|
|
124
|
+
return []
|
|
125
|
+
|
|
126
|
+
|
|
119
127
|
class DocumentRequest(BaseModel):
|
|
120
128
|
model_config = ConfigDict(populate_by_name=True)
|
|
121
129
|
callback_url: str = Field(alias="callbackURL", default="")
|
|
@@ -131,10 +139,10 @@ class DocumentRequest(BaseModel):
|
|
|
131
139
|
_clear_cache: bool = PrivateAttr(default_factory=bool)
|
|
132
140
|
_debug_path: typing.Optional[str] = PrivateAttr(default=None)
|
|
133
141
|
_page_image_dict: typing.Dict[str, int] = PrivateAttr(
|
|
134
|
-
default_factory=
|
|
142
|
+
default_factory=_new_page_image_dict
|
|
135
143
|
)
|
|
136
144
|
_page_images: typing.List[Image.Image] = PrivateAttr(
|
|
137
|
-
default_factory=
|
|
145
|
+
default_factory=_new_page_images
|
|
138
146
|
)
|
|
139
147
|
_start: int = PrivateAttr(
|
|
140
148
|
default_factory=lambda: int(datetime.now(timezone.utc).timestamp())
|
|
@@ -7,6 +7,7 @@ from PIL import Image
|
|
|
7
7
|
from unittest.mock import patch
|
|
8
8
|
|
|
9
9
|
from .document import Document, DocumentRequest
|
|
10
|
+
from .test_groundx import TestXRay
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def DR(**data: typing.Any) -> DocumentRequest:
|
|
@@ -17,32 +18,6 @@ def test_request() -> DocumentRequest:
|
|
|
17
18
|
return DR(documentID="D", fileName="F", modelID=1, processorID=1, taskID="T")
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class DummyChunk:
|
|
21
|
-
def __init__(self, json_str: str):
|
|
22
|
-
self.sectionSummary = None
|
|
23
|
-
self.suggestedText = json_str
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class DummyDocumentPage:
|
|
27
|
-
def __init__(self, page_url: str):
|
|
28
|
-
self.pageUrl = page_url
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class DummyXRay:
|
|
32
|
-
def __init__(
|
|
33
|
-
self,
|
|
34
|
-
source_url: str,
|
|
35
|
-
chunks: typing.Optional[typing.List[DummyChunk]] = [],
|
|
36
|
-
document_pages: typing.Optional[typing.List[str]] = [],
|
|
37
|
-
):
|
|
38
|
-
self.chunks = chunks
|
|
39
|
-
self.documentPages: typing.List[DummyDocumentPage] = []
|
|
40
|
-
if document_pages is not None:
|
|
41
|
-
for p in document_pages:
|
|
42
|
-
self.documentPages.append(DummyDocumentPage(p))
|
|
43
|
-
self.sourceUrl = source_url
|
|
44
|
-
|
|
45
|
-
|
|
46
21
|
class TestDocument(unittest.TestCase):
|
|
47
22
|
def setUp(self) -> None:
|
|
48
23
|
patcher = patch(
|
|
@@ -50,7 +25,7 @@ class TestDocument(unittest.TestCase):
|
|
|
50
25
|
)
|
|
51
26
|
self.mock_xray = patcher.start()
|
|
52
27
|
self.addCleanup(patcher.stop)
|
|
53
|
-
self.mock_xray.return_value =
|
|
28
|
+
self.mock_xray.return_value = TestXRay("http://test.co", [])
|
|
54
29
|
|
|
55
30
|
def test_init_name(self) -> None:
|
|
56
31
|
st1: Document = Document.from_request(
|
|
@@ -101,13 +76,13 @@ class TestDocumentRequest(unittest.TestCase):
|
|
|
101
76
|
red_img.save(buf, format="PNG")
|
|
102
77
|
img_bytes = buf.getvalue()
|
|
103
78
|
|
|
104
|
-
class
|
|
79
|
+
class TestResp:
|
|
105
80
|
content = img_bytes
|
|
106
81
|
|
|
107
82
|
def raise_for_status(self) -> None:
|
|
108
83
|
pass
|
|
109
84
|
|
|
110
|
-
with patch("requests.get", return_value=
|
|
85
|
+
with patch("requests.get", return_value=TestResp()):
|
|
111
86
|
st = test_request()
|
|
112
87
|
st.load_images(urls)
|
|
113
88
|
|
|
@@ -12,6 +12,32 @@ from .groundx import (
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
class TestChunk:
|
|
16
|
+
def __init__(self, json_str: str):
|
|
17
|
+
self.sectionSummary = None
|
|
18
|
+
self.suggestedText = json_str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TestDocumentPage:
|
|
22
|
+
def __init__(self, page_url: str):
|
|
23
|
+
self.pageUrl = page_url
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class TestXRay:
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
source_url: str,
|
|
30
|
+
chunks: typing.Optional[typing.List[TestChunk]] = [],
|
|
31
|
+
document_pages: typing.Optional[typing.List[str]] = [],
|
|
32
|
+
):
|
|
33
|
+
self.chunks = chunks
|
|
34
|
+
self.documentPages: typing.List[TestDocumentPage] = []
|
|
35
|
+
if document_pages is not None:
|
|
36
|
+
for p in document_pages:
|
|
37
|
+
self.documentPages.append(TestDocumentPage(p))
|
|
38
|
+
self.sourceUrl = source_url
|
|
39
|
+
|
|
40
|
+
|
|
15
41
|
def GD(**data: typing.Any) -> GroundXDocument:
|
|
16
42
|
return GroundXDocument.model_validate(data)
|
|
17
43
|
|
|
@@ -7,9 +7,9 @@ from starlette.responses import JSONResponse, Response
|
|
|
7
7
|
from starlette.types import ASGIApp
|
|
8
8
|
|
|
9
9
|
from ..classes.api import ProcessResponse
|
|
10
|
-
from ..classes.settings import ContainerSettings
|
|
11
10
|
from .logger import Logger
|
|
12
11
|
from .status import Status
|
|
12
|
+
from ..settings.settings import ContainerSettings
|
|
13
13
|
from .utility import get_gunicorn_threads, get_thread_id, get_worker_id
|
|
14
14
|
|
|
15
15
|
|
|
@@ -7,7 +7,7 @@ from googleapiclient.discovery import (
|
|
|
7
7
|
)
|
|
8
8
|
import gspread
|
|
9
9
|
|
|
10
|
-
from ..
|
|
10
|
+
from ..settings.settings import ContainerSettings, GCP_CREDENTIALS
|
|
11
11
|
|
|
12
12
|
SPREADSHEET_MIME = "application/vnd.google-apps.spreadsheet"
|
|
13
13
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .settings import (
|
|
2
|
+
AgentSettings,
|
|
3
|
+
ContainerSettings,
|
|
4
|
+
ContainerUploadSettings,
|
|
5
|
+
GroundXSettings,
|
|
6
|
+
GCP_CREDENTIALS,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"AgentSettings",
|
|
11
|
+
"ContainerSettings",
|
|
12
|
+
"ContainerUploadSettings",
|
|
13
|
+
"GroundXSettings",
|
|
14
|
+
"GCP_CREDENTIALS",
|
|
15
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from ..classes.api import ErrorResponse
|
|
4
|
+
from ..classes.document import DocumentRequest
|
|
5
|
+
from ..classes.groundx import GroundXResponse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def error_response(req: DocumentRequest, msg: str) -> typing.Dict[str, typing.Any]:
|
|
9
|
+
return ErrorResponse(
|
|
10
|
+
code=500,
|
|
11
|
+
documentID=req.document_id,
|
|
12
|
+
message=msg,
|
|
13
|
+
taskID=req.task_id,
|
|
14
|
+
).model_dump(by_alias=True)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def success_response(
|
|
18
|
+
req: DocumentRequest, result_url: str
|
|
19
|
+
) -> typing.Dict[str, typing.Any]:
|
|
20
|
+
return GroundXResponse(
|
|
21
|
+
code=200,
|
|
22
|
+
documentID=req.document_id,
|
|
23
|
+
modelID=req.model_id,
|
|
24
|
+
processorID=req.processor_id,
|
|
25
|
+
resultURL=result_url,
|
|
26
|
+
taskID=req.task_id,
|
|
27
|
+
).model_dump(by_alias=True)
|
|
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
|
|
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
|
{groundx-2.5.1/src/groundx/extract/classes → groundx-2.5.3/src/groundx/extract/settings}/settings.py
RENAMED
|
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
|
|
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
|
|
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
|