groundx 2.0.15__py3-none-any.whl → 2.7.7__py3-none-any.whl

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.
Files changed (147) hide show
  1. groundx/__init__.py +73 -21
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +55 -388
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +22 -21
  6. groundx/core/__init__.py +5 -0
  7. groundx/core/api_error.py +13 -5
  8. groundx/core/client_wrapper.py +4 -3
  9. groundx/core/force_multipart.py +16 -0
  10. groundx/core/http_client.py +76 -32
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +71 -112
  14. groundx/core/serialization.py +7 -3
  15. groundx/csv_splitter.py +64 -0
  16. groundx/customer/__init__.py +2 -0
  17. groundx/customer/client.py +31 -43
  18. groundx/customer/raw_client.py +91 -0
  19. groundx/documents/__init__.py +1 -2
  20. groundx/documents/client.py +455 -953
  21. groundx/documents/raw_client.py +1450 -0
  22. groundx/errors/__init__.py +2 -0
  23. groundx/errors/bad_request_error.py +4 -3
  24. groundx/errors/unauthorized_error.py +4 -3
  25. groundx/extract/__init__.py +48 -0
  26. groundx/extract/agents/__init__.py +7 -0
  27. groundx/extract/agents/agent.py +202 -0
  28. groundx/extract/classes/__init__.py +24 -0
  29. groundx/extract/classes/agent.py +23 -0
  30. groundx/extract/classes/api.py +15 -0
  31. groundx/extract/classes/document.py +338 -0
  32. groundx/extract/classes/field.py +88 -0
  33. groundx/extract/classes/groundx.py +147 -0
  34. groundx/extract/classes/prompt.py +36 -0
  35. groundx/extract/classes/test_document.py +109 -0
  36. groundx/extract/classes/test_field.py +43 -0
  37. groundx/extract/classes/test_groundx.py +223 -0
  38. groundx/extract/classes/test_prompt.py +68 -0
  39. groundx/extract/post_process/__init__.py +7 -0
  40. groundx/extract/post_process/post_process.py +33 -0
  41. groundx/extract/services/.DS_Store +0 -0
  42. groundx/extract/services/__init__.py +14 -0
  43. groundx/extract/services/csv.py +76 -0
  44. groundx/extract/services/logger.py +126 -0
  45. groundx/extract/services/logging_cfg.py +53 -0
  46. groundx/extract/services/ratelimit.py +104 -0
  47. groundx/extract/services/sheets_client.py +160 -0
  48. groundx/extract/services/status.py +197 -0
  49. groundx/extract/services/upload.py +68 -0
  50. groundx/extract/services/upload_minio.py +122 -0
  51. groundx/extract/services/upload_s3.py +91 -0
  52. groundx/extract/services/utility.py +52 -0
  53. groundx/extract/settings/__init__.py +15 -0
  54. groundx/extract/settings/settings.py +212 -0
  55. groundx/extract/settings/test_settings.py +512 -0
  56. groundx/extract/tasks/__init__.py +6 -0
  57. groundx/extract/tasks/utility.py +27 -0
  58. groundx/extract/utility/__init__.py +15 -0
  59. groundx/extract/utility/classes.py +193 -0
  60. groundx/extract/utility/test_utility.py +81 -0
  61. groundx/groups/__init__.py +2 -0
  62. groundx/groups/client.py +63 -550
  63. groundx/groups/raw_client.py +901 -0
  64. groundx/health/__init__.py +2 -0
  65. groundx/health/client.py +35 -101
  66. groundx/health/raw_client.py +193 -0
  67. groundx/ingest.py +771 -0
  68. groundx/search/__init__.py +2 -0
  69. groundx/search/client.py +94 -227
  70. groundx/search/raw_client.py +442 -0
  71. groundx/search/types/__init__.py +2 -0
  72. groundx/types/__init__.py +68 -16
  73. groundx/types/bounding_box_detail.py +4 -4
  74. groundx/types/bucket_detail.py +5 -5
  75. groundx/types/bucket_list_response.py +17 -3
  76. groundx/types/bucket_response.py +3 -3
  77. groundx/types/bucket_update_detail.py +4 -4
  78. groundx/types/bucket_update_response.py +3 -3
  79. groundx/types/customer_detail.py +2 -2
  80. groundx/types/customer_response.py +3 -3
  81. groundx/types/document.py +54 -0
  82. groundx/types/document_detail.py +16 -4
  83. groundx/types/document_list_response.py +4 -4
  84. groundx/types/document_local_ingest_request.py +7 -0
  85. groundx/types/document_lookup_response.py +8 -3
  86. groundx/types/document_response.py +3 -3
  87. groundx/types/document_type.py +21 -1
  88. groundx/types/group_detail.py +4 -4
  89. groundx/types/group_list_response.py +17 -3
  90. groundx/types/group_response.py +3 -3
  91. groundx/types/health_response.py +3 -3
  92. groundx/types/health_response_health.py +3 -3
  93. groundx/types/health_service.py +5 -5
  94. groundx/types/ingest_local_document.py +25 -0
  95. groundx/types/ingest_local_document_metadata.py +51 -0
  96. groundx/types/ingest_remote_document.py +15 -6
  97. groundx/types/ingest_response.py +4 -4
  98. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  99. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  100. groundx/types/ingest_status_progress.py +26 -0
  101. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  102. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  103. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  104. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  105. groundx/types/message_response.py +2 -2
  106. groundx/types/meter_detail.py +2 -2
  107. groundx/types/process_level.py +5 -0
  108. groundx/types/{process_status_response.py → processes_status_response.py} +8 -5
  109. groundx/types/processing_status.py +3 -1
  110. groundx/types/search_response.py +3 -3
  111. groundx/types/search_response_search.py +3 -3
  112. groundx/types/search_result_item.py +7 -5
  113. groundx/types/search_result_item_pages_item.py +41 -0
  114. groundx/types/subscription_detail.py +3 -3
  115. groundx/types/subscription_detail_meters.py +5 -5
  116. groundx/{documents/types/website_crawl_request_websites_item.py → types/website_source.py} +7 -7
  117. groundx/types/workflow_apply_request.py +24 -0
  118. groundx/types/workflow_detail.py +59 -0
  119. groundx/types/workflow_detail_chunk_strategy.py +5 -0
  120. groundx/types/workflow_detail_relationships.py +36 -0
  121. groundx/types/workflow_engine.py +58 -0
  122. groundx/types/workflow_engine_reasoning_effort.py +5 -0
  123. groundx/types/workflow_engine_service.py +7 -0
  124. groundx/types/workflow_prompt.py +37 -0
  125. groundx/types/workflow_prompt_group.py +25 -0
  126. groundx/types/workflow_prompt_role.py +5 -0
  127. groundx/types/workflow_request.py +31 -0
  128. groundx/types/workflow_request_chunk_strategy.py +5 -0
  129. groundx/types/workflow_response.py +20 -0
  130. groundx/types/workflow_step.py +33 -0
  131. groundx/types/workflow_step_config.py +33 -0
  132. groundx/types/workflow_step_config_field.py +8 -0
  133. groundx/types/workflow_steps.py +38 -0
  134. groundx/types/workflows_response.py +20 -0
  135. groundx/workflows/__init__.py +7 -0
  136. groundx/workflows/client.py +736 -0
  137. groundx/workflows/raw_client.py +841 -0
  138. groundx/workflows/types/__init__.py +7 -0
  139. groundx/workflows/types/workflows_get_request_id.py +5 -0
  140. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/LICENSE +1 -1
  141. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/METADATA +39 -22
  142. groundx-2.7.7.dist-info/RECORD +155 -0
  143. groundx/documents/types/__init__.py +0 -6
  144. groundx/documents/types/documents_ingest_local_request_files_item.py +0 -43
  145. groundx/types/process_status_response_ingest_progress.py +0 -26
  146. groundx-2.0.15.dist-info/RECORD +0 -82
  147. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/WHEEL +0 -0
@@ -0,0 +1,212 @@
1
+ import json, typing, os
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ AWS_REGION: str = "AWS_REGION"
7
+ AWS_DEFAULT_REGION: str = "AWS_DEFAULT_REGION"
8
+
9
+
10
+ GX_AGENT_KEY: str = "GROUNDX_AGENT_API_KEY"
11
+ CALLBACK_KEY: str = "GROUNDX_CALLBACK_API_KEY"
12
+ GCP_CREDENTIALS: str = "GCP_CREDENTIALS"
13
+ GX_API_KEY: str = "GROUNDX_API_KEY"
14
+ GX_KEY: str = "GROUNDX_ACCESS_KEY_ID"
15
+ GX_REGION: str = "GROUNDX_REGION"
16
+ GX_DEFAULT_REGION: str = "GROUNDX_DEFAULT_REGION"
17
+ GX_SECRET: str = "GROUNDX_SECRET_ACCESS_KEY"
18
+ GX_TOKEN: str = "GROUNDX_SESSION_TOKEN"
19
+ VALID_KEYS: str = "GROUNDX_VALID_API_KEYS"
20
+ GX_ADMIN_API_KEY: str = "GROUNDX_ADMIN_API_KEY"
21
+ GX_ADMIN_USERNAME: str = "GROUNDX_ADMIN_USERNAME"
22
+
23
+
24
+ class AgentSettings(BaseModel):
25
+ api_base: typing.Optional[str] = None
26
+ api_key: typing.Optional[str] = None
27
+ imports: typing.List[str] = [
28
+ "csv",
29
+ "glob",
30
+ "io",
31
+ "json",
32
+ "markdown",
33
+ "numpy",
34
+ "os",
35
+ "pandas",
36
+ "posixpath",
37
+ "open",
38
+ "builtins.open",
39
+ "utils.safe_open",
40
+ "pydantic",
41
+ "typing",
42
+ ]
43
+ max_steps: int = 7
44
+ model_id: str = "gpt-5-mini"
45
+
46
+ def get_api_key(self) -> str:
47
+ if self.api_key:
48
+ return self.api_key
49
+
50
+ key = os.environ.get(GX_AGENT_KEY)
51
+ if key:
52
+ return key
53
+
54
+ raise Exception(f"you must set a valid agent api_key")
55
+
56
+
57
+ class ContainerSettings(BaseModel):
58
+ broker: str
59
+ cache_dir: str = "./cache"
60
+ cache_to: int = 300
61
+ google_sheets_drive_id: typing.Optional[str] = None
62
+ google_sheets_template_id: typing.Optional[str] = None
63
+ log_level: str = "info"
64
+ metrics_broker: typing.Optional[str] = None
65
+ refresh_to: int = 60
66
+ service: str
67
+ task_to: int = 600
68
+ upload: "ContainerUploadSettings"
69
+ workers: int
70
+
71
+ callback_api_key: typing.Optional[str] = None
72
+ valid_api_keys: typing.Optional[typing.List[str]] = None
73
+
74
+ def get_callback_api_key(self) -> str:
75
+ if self.callback_api_key:
76
+ return self.callback_api_key
77
+
78
+ key = os.environ.get(CALLBACK_KEY)
79
+ if key:
80
+ return key
81
+
82
+ key = os.environ.get(GX_ADMIN_API_KEY)
83
+ if key:
84
+ return key
85
+
86
+ key = os.environ.get(GX_ADMIN_USERNAME)
87
+ if key:
88
+ return key
89
+
90
+ key = os.environ.get(GX_API_KEY)
91
+ if key:
92
+ return key
93
+
94
+ raise Exception(f"you must set a callback_api_key")
95
+
96
+ def get_valid_api_keys(self) -> typing.List[str]:
97
+ keys: typing.List[str] = []
98
+
99
+ if self.valid_api_keys:
100
+ keys = self.valid_api_keys
101
+
102
+ env_keys: typing.Optional[str] = os.environ.get(VALID_KEYS)
103
+ if env_keys:
104
+ try:
105
+ data: typing.List[str] = json.loads(env_keys)
106
+ keys.extend(data)
107
+ except Exception as e:
108
+ raise Exception(f"you must set an array of valid_api_keys: {e}")
109
+
110
+ key = os.environ.get(CALLBACK_KEY)
111
+ if key:
112
+ keys.append(key)
113
+
114
+ key = os.environ.get(GX_ADMIN_API_KEY)
115
+ if key:
116
+ keys.append(key)
117
+
118
+ key = os.environ.get(GX_ADMIN_USERNAME)
119
+ if key:
120
+ keys.append(key)
121
+
122
+ key = os.environ.get(GX_API_KEY)
123
+ if key:
124
+ keys.append(key)
125
+
126
+ if len(keys) < 1:
127
+ raise Exception(f"you must set an array of valid_api_keys")
128
+
129
+ return keys
130
+
131
+ def loglevel(self) -> str:
132
+ return self.log_level.upper()
133
+
134
+ def status_broker(self) -> str:
135
+ if self.metrics_broker:
136
+ return self.metrics_broker
137
+
138
+ return self.broker
139
+
140
+
141
+ class ContainerUploadSettings(BaseModel):
142
+ base_domain: str
143
+ base_path: str = "layout/processed/"
144
+ bucket: str
145
+ ssl: bool = False
146
+ type: str
147
+ url: str
148
+
149
+ key: typing.Optional[str] = None
150
+ region: typing.Optional[str] = None
151
+ secret: typing.Optional[str] = None
152
+ token: typing.Optional[str] = None
153
+
154
+ def get_key(self) -> typing.Optional[str]:
155
+ if self.key:
156
+ return self.key
157
+
158
+ return os.environ.get(GX_KEY)
159
+
160
+ def get_region(self) -> typing.Optional[str]:
161
+ if self.region:
162
+ return self.region
163
+
164
+ key = os.environ.get(GX_REGION)
165
+ if key:
166
+ return key
167
+
168
+ key = os.environ.get(AWS_REGION)
169
+ if key:
170
+ return key
171
+
172
+ key = os.environ.get(GX_DEFAULT_REGION)
173
+ if key:
174
+ return key
175
+
176
+ return os.environ.get(AWS_DEFAULT_REGION)
177
+
178
+ def get_secret(self) -> typing.Optional[str]:
179
+ if self.secret:
180
+ return self.secret
181
+
182
+ return os.environ.get(GX_SECRET)
183
+
184
+ def get_token(self) -> typing.Optional[str]:
185
+ if self.token:
186
+ return self.token
187
+
188
+ return os.environ.get(GX_TOKEN)
189
+
190
+
191
+ class GroundXSettings(BaseModel):
192
+ api_key: typing.Optional[str] = None
193
+ base_url: typing.Optional[str] = None
194
+ upload_url: str = "https://upload.eyelevel.ai"
195
+
196
+ def get_api_key(self) -> str:
197
+ if self.api_key:
198
+ return self.api_key
199
+
200
+ key = os.environ.get(GX_API_KEY)
201
+ if key:
202
+ return key
203
+
204
+ key = os.environ.get(GX_ADMIN_API_KEY)
205
+ if key:
206
+ return key
207
+
208
+ key = os.environ.get(GX_ADMIN_USERNAME)
209
+ if key:
210
+ return key
211
+
212
+ raise Exception(f"you must set a valid GroundX api_key")