groundx 3.7.2__tar.gz → 3.7.4__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.
Files changed (193) hide show
  1. {groundx-3.7.2 → groundx-3.7.4}/PKG-INFO +1 -1
  2. {groundx-3.7.2 → groundx-3.7.4}/pyproject.toml +1 -1
  3. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/client_wrapper.py +2 -2
  4. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/agents/agent.py +132 -3
  5. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/settings/settings.py +1 -0
  6. {groundx-3.7.2 → groundx-3.7.4}/LICENSE +0 -0
  7. {groundx-3.7.2 → groundx-3.7.4}/README.md +0 -0
  8. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/__init__.py +0 -0
  9. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/_default_clients.py +0 -0
  10. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/api_key/__init__.py +0 -0
  11. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/api_key/client.py +0 -0
  12. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/api_key/raw_client.py +0 -0
  13. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/buckets/__init__.py +0 -0
  14. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/buckets/client.py +0 -0
  15. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/buckets/raw_client.py +0 -0
  16. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/client.py +0 -0
  17. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/__init__.py +0 -0
  18. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/api_error.py +0 -0
  19. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/datetime_utils.py +0 -0
  20. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/file.py +0 -0
  21. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/force_multipart.py +0 -0
  22. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_client.py +0 -0
  23. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_response.py +0 -0
  24. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_sse/__init__.py +0 -0
  25. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_sse/_api.py +0 -0
  26. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_sse/_decoders.py +0 -0
  27. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_sse/_exceptions.py +0 -0
  28. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/http_sse/_models.py +0 -0
  29. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/jsonable_encoder.py +0 -0
  30. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/logging.py +0 -0
  31. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/parse_error.py +0 -0
  32. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/pydantic_utilities.py +0 -0
  33. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/query_encoder.py +0 -0
  34. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/remove_none_from_dict.py +0 -0
  35. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/request_options.py +0 -0
  36. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/core/serialization.py +0 -0
  37. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/csv_splitter.py +0 -0
  38. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/customer/__init__.py +0 -0
  39. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/customer/client.py +0 -0
  40. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/customer/raw_client.py +0 -0
  41. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/documents/__init__.py +0 -0
  42. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/documents/client.py +0 -0
  43. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/documents/raw_client.py +0 -0
  44. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/environment.py +0 -0
  45. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/errors/__init__.py +0 -0
  46. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/errors/bad_request_error.py +0 -0
  47. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/errors/unauthorized_error.py +0 -0
  48. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/__init__.py +0 -0
  49. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/agents/__init__.py +0 -0
  50. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/__init__.py +0 -0
  51. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/agent.py +0 -0
  52. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/api.py +0 -0
  53. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/document.py +0 -0
  54. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/element.py +0 -0
  55. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/field.py +0 -0
  56. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/groundx.py +0 -0
  57. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/group.py +0 -0
  58. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/prompt.py +0 -0
  59. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/classes/testing.py +0 -0
  60. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/post_process/__init__.py +0 -0
  61. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/post_process/post_process.py +0 -0
  62. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/prompt/__init__.py +0 -0
  63. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/prompt/manager.py +0 -0
  64. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/prompt/object_store.py +0 -0
  65. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/prompt/source.py +0 -0
  66. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/prompt/utility.py +0 -0
  67. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/.DS_Store +0 -0
  68. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/__init__.py +0 -0
  69. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/csv.py +0 -0
  70. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/logger.py +0 -0
  71. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/logging_cfg.py +0 -0
  72. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/ratelimit.py +0 -0
  73. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/sheets_client.py +0 -0
  74. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/status.py +0 -0
  75. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/upload.py +0 -0
  76. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/upload_minio.py +0 -0
  77. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/upload_s3.py +0 -0
  78. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/services/utility.py +0 -0
  79. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/settings/__init__.py +0 -0
  80. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/tasks/__init__.py +0 -0
  81. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/tasks/utility.py +0 -0
  82. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/utility/__init__.py +0 -0
  83. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/utility/utility.py +0 -0
  84. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/extract/workflows.py +0 -0
  85. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/groups/__init__.py +0 -0
  86. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/groups/client.py +0 -0
  87. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/groups/raw_client.py +0 -0
  88. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/health/__init__.py +0 -0
  89. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/health/client.py +0 -0
  90. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/health/raw_client.py +0 -0
  91. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/ingest.py +0 -0
  92. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/py.typed +0 -0
  93. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/search/__init__.py +0 -0
  94. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/search/client.py +0 -0
  95. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/search/raw_client.py +0 -0
  96. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/search/types/__init__.py +0 -0
  97. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/search/types/search_content_request_id.py +0 -0
  98. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/__init__.py +0 -0
  99. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/api_key_detail.py +0 -0
  100. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/api_key_request.py +0 -0
  101. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/api_key_response.py +0 -0
  102. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bounding_box_detail.py +0 -0
  103. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bucket_detail.py +0 -0
  104. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bucket_list_response.py +0 -0
  105. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bucket_response.py +0 -0
  106. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bucket_update_detail.py +0 -0
  107. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/bucket_update_response.py +0 -0
  108. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_leaf_field.py +0 -0
  109. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_leaf_field_level.py +0 -0
  110. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_leaf_field_repetition_scope.py +0 -0
  111. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_output_map.py +0 -0
  112. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_output_route.py +0 -0
  113. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_output_route_level.py +0 -0
  114. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_output_route_output_map.py +0 -0
  115. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_step.py +0 -0
  116. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_step_config.py +0 -0
  117. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_step_element_config.py +0 -0
  118. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_step_kind.py +0 -0
  119. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/custom_workflow_step_level.py +0 -0
  120. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/customer_detail.py +0 -0
  121. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/customer_detail_status.py +0 -0
  122. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/customer_response.py +0 -0
  123. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document.py +0 -0
  124. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_detail.py +0 -0
  125. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_list_response.py +0 -0
  126. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_local_ingest_request.py +0 -0
  127. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_lookup_response.py +0 -0
  128. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_response.py +0 -0
  129. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_type.py +0 -0
  130. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_update.py +0 -0
  131. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_xray.py +0 -0
  132. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_xray_chunk.py +0 -0
  133. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/document_xray_page.py +0 -0
  134. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/group_detail.py +0 -0
  135. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/group_list_response.py +0 -0
  136. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/group_response.py +0 -0
  137. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/health_response.py +0 -0
  138. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/health_response_health.py +0 -0
  139. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/health_service.py +0 -0
  140. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/health_service_status.py +0 -0
  141. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_local_document.py +0 -0
  142. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_local_document_metadata.py +0 -0
  143. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_remote_document.py +0 -0
  144. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_response.py +0 -0
  145. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status.py +0 -0
  146. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_light.py +0 -0
  147. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress.py +0 -0
  148. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress_cancelled.py +0 -0
  149. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress_complete.py +0 -0
  150. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress_errors.py +0 -0
  151. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress_processing.py +0 -0
  152. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/ingest_status_progress_queued.py +0 -0
  153. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/message_response.py +0 -0
  154. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/meter_detail.py +0 -0
  155. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/process_level.py +0 -0
  156. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/processes_status_response.py +0 -0
  157. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/processing_status.py +0 -0
  158. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/search_response.py +0 -0
  159. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/search_response_search.py +0 -0
  160. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/search_result_item.py +0 -0
  161. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/search_result_item_pages_item.py +0 -0
  162. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/sort.py +0 -0
  163. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/sort_order.py +0 -0
  164. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/subscription_detail.py +0 -0
  165. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/subscription_detail_meters.py +0 -0
  166. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/website_source.py +0 -0
  167. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_apply_request.py +0 -0
  168. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_detail.py +0 -0
  169. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_detail_chunk_strategy.py +0 -0
  170. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_detail_relationships.py +0 -0
  171. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_detail_section_strategy.py +0 -0
  172. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_engine.py +0 -0
  173. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_engine_reasoning_effort.py +0 -0
  174. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_engine_service.py +0 -0
  175. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_prompt.py +0 -0
  176. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_prompt_group.py +0 -0
  177. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_prompt_role.py +0 -0
  178. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_request.py +0 -0
  179. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_request_chunk_strategy.py +0 -0
  180. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_request_section_strategy.py +0 -0
  181. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_response.py +0 -0
  182. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_step.py +0 -0
  183. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_step_config.py +0 -0
  184. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_step_config_field.py +0 -0
  185. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_steps.py +0 -0
  186. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflow_template.py +0 -0
  187. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/types/workflows_response.py +0 -0
  188. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/version.py +0 -0
  189. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/workflows/__init__.py +0 -0
  190. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/workflows/client.py +0 -0
  191. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/workflows/raw_client.py +0 -0
  192. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/workflows/types/__init__.py +0 -0
  193. {groundx-3.7.2 → groundx-3.7.4}/src/groundx/workflows/types/workflows_get_request_id.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: groundx
3
- Version: 3.7.2
3
+ Version: 3.7.4
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.10,<4.0
@@ -4,7 +4,7 @@ dynamic = ["version"]
4
4
 
5
5
  [tool.poetry]
6
6
  name = "groundx"
7
- version = "3.7.2"
7
+ version = "3.7.4"
8
8
  description = ""
9
9
  readme = "README.md"
10
10
  authors = []
@@ -27,12 +27,12 @@ class BaseClientWrapper:
27
27
  import platform
28
28
 
29
29
  headers: typing.Dict[str, str] = {
30
- "User-Agent": "groundx/3.7.2",
30
+ "User-Agent": "groundx/3.7.4",
31
31
  "X-Fern-Language": "Python",
32
32
  "X-Fern-Runtime": f"python/{platform.python_version()}",
33
33
  "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
34
34
  "X-Fern-SDK-Name": "groundx",
35
- "X-Fern-SDK-Version": "3.7.2",
35
+ "X-Fern-SDK-Version": "3.7.4",
36
36
  **(self.get_custom_headers() or {}),
37
37
  }
38
38
  headers["X-API-Key"] = self.api_key
@@ -1,13 +1,22 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json, traceback, typing
4
+ from dataclasses import dataclass, field
5
+ from urllib.parse import urlparse
4
6
 
5
7
  from smolagents import ( # pyright: ignore[reportMissingTypeStubs]
6
8
  CodeAgent,
7
9
  Tool,
8
10
  ToolCallingAgent,
9
11
  )
12
+ from smolagents.memory import ( # pyright: ignore[reportMissingTypeStubs]
13
+ FinalAnswerStep,
14
+ SystemPromptStep,
15
+ TaskStep,
16
+ )
10
17
  from smolagents.models import ( # pyright: ignore[reportMissingTypeStubs]
18
+ ChatMessage,
19
+ MessageRole,
11
20
  OpenAIServerModel,
12
21
  )
13
22
 
@@ -27,6 +36,37 @@ Return only your response using the `final_answer` tool format:
27
36
  ```
28
37
  """
29
38
 
39
+ SUPPORTED_IMAGE_TRANSPORTS = {"pil", "data_url", "remote_url"}
40
+
41
+
42
+ @dataclass
43
+ class RemoteImageTaskStep(TaskStep):
44
+ image_urls: typing.List[str] = field(default_factory=list)
45
+
46
+ def to_messages(self, summary_mode: bool = False) -> typing.List[ChatMessage]:
47
+ content: typing.List[typing.Dict[str, typing.Any]] = [
48
+ {"type": "text", "text": f"New task:\n{self.task}"}
49
+ ]
50
+ content.extend(
51
+ {"type": "image_url", "image_url": {"url": image_url}}
52
+ for image_url in self.image_urls
53
+ )
54
+ return [ChatMessage(role=MessageRole.USER, content=content)]
55
+
56
+ def dict(self) -> typing.Dict[str, typing.Any]:
57
+ return {
58
+ "task": self.task,
59
+ "task_images": None,
60
+ "image_urls": [_sanitize_image_url(image_url) for image_url in self.image_urls],
61
+ }
62
+
63
+
64
+ def _sanitize_image_url(image_url: str) -> str:
65
+ parsed = urlparse(image_url)
66
+ if not parsed.scheme or not parsed.netloc:
67
+ return "<invalid-image-url>"
68
+ return f"{parsed.scheme}://{parsed.netloc}{parsed.path}"
69
+
30
70
 
31
71
  def extract_response(res: typing.Dict[str, typing.Any]) -> typing.Any:
32
72
  if "answer" in res and "type" in res["answer"]:
@@ -209,6 +249,7 @@ class AgentTool(ToolCallingAgent):
209
249
  )
210
250
 
211
251
  self.log = log
252
+ self.image_transport = settings.image_transport
212
253
 
213
254
  def process(
214
255
  self,
@@ -217,11 +258,26 @@ class AgentTool(ToolCallingAgent):
217
258
  expected_types: typing.Union[type, typing.Tuple[type, ...]] = dict,
218
259
  attempt: int = 0,
219
260
  type: str = "",
261
+ image_urls: typing.Optional[typing.Sequence[str]] = None,
262
+ image_transport: typing.Optional[str] = None,
220
263
  ) -> typing.Any:
221
- res = super().run( # pyright: ignore[reportUnknownMemberType]
222
- conflict + prompt_suffix,
264
+ selected_image_transport = image_transport or self.image_transport
265
+ transport = self._validate_image_inputs(
223
266
  images=images,
267
+ image_urls=image_urls,
268
+ image_transport=selected_image_transport,
224
269
  )
270
+ if transport in {"data_url", "remote_url"} and image_urls:
271
+ res = self._run_with_image_urls(
272
+ conflict + prompt_suffix,
273
+ list(image_urls or []),
274
+ image_transport=transport,
275
+ )
276
+ else:
277
+ res = super().run( # pyright: ignore[reportUnknownMemberType]
278
+ conflict + prompt_suffix,
279
+ images=images,
280
+ )
225
281
 
226
282
  try:
227
283
  return process_response(res=res, expected_types=expected_types)
@@ -236,4 +292,77 @@ class AgentTool(ToolCallingAgent):
236
292
  f"agent process result is not of expected type(s) {expected_types!r}: [{e}], attempting again [{attempt+1}]\n\n{res}"
237
293
  )
238
294
 
239
- return self.process(conflict, images, expected_types, attempt + 1)
295
+ return self.process(
296
+ conflict,
297
+ images,
298
+ expected_types,
299
+ attempt + 1,
300
+ type,
301
+ image_urls=image_urls,
302
+ image_transport=transport,
303
+ )
304
+
305
+ def _run_with_image_urls(
306
+ self,
307
+ task: str,
308
+ image_urls: typing.List[str],
309
+ *,
310
+ image_transport: str,
311
+ ) -> typing.Any:
312
+ self.task = task
313
+ self.interrupt_switch = False
314
+ self.memory.system_prompt = SystemPromptStep(system_prompt=self.system_prompt)
315
+ self.memory.reset()
316
+ self.monitor.reset()
317
+ self.memory.steps.append(
318
+ RemoteImageTaskStep(task=self.task, task_images=None, image_urls=image_urls)
319
+ )
320
+
321
+ try:
322
+ try:
323
+ steps = list(self._run_stream(task=self.task, max_steps=self.max_steps, images=None))
324
+ except Exception as exc:
325
+ raise RuntimeError(f"{image_transport} image transport failed: {exc}") from exc
326
+ assert isinstance(steps[-1], FinalAnswerStep)
327
+ return steps[-1].output
328
+ finally:
329
+ self._sanitize_remote_image_urls_in_memory()
330
+
331
+ def _validate_image_inputs(
332
+ self,
333
+ *,
334
+ images: typing.Sequence[Image],
335
+ image_urls: typing.Optional[typing.Sequence[str]],
336
+ image_transport: str,
337
+ ) -> str:
338
+ if image_transport not in SUPPORTED_IMAGE_TRANSPORTS:
339
+ raise ValueError(
340
+ "unsupported image_transport "
341
+ f"[{image_transport}]; expected one of {sorted(SUPPORTED_IMAGE_TRANSPORTS)}"
342
+ )
343
+ if image_urls and image_transport not in {"data_url", "remote_url"}:
344
+ raise ValueError("image_urls require image_transport='data_url' or 'remote_url'")
345
+ if image_transport == "data_url" and image_urls and images:
346
+ raise ValueError("data_url transport does not accept PIL images when image_urls are provided")
347
+ if image_transport == "remote_url":
348
+ if images:
349
+ raise ValueError("remote_url transport does not accept PIL images")
350
+ if not image_urls:
351
+ raise ValueError("remote_url transport requires image_urls")
352
+ return image_transport
353
+
354
+ def _sanitize_remote_image_urls_in_memory(self) -> None:
355
+ for step in self.memory.steps:
356
+ model_input_messages = getattr(step, "model_input_messages", None)
357
+ if not model_input_messages:
358
+ continue
359
+ for message in model_input_messages:
360
+ content = getattr(message, "content", None)
361
+ if not isinstance(content, list):
362
+ continue
363
+ for item in content:
364
+ if not isinstance(item, dict) or item.get("type") != "image_url":
365
+ continue
366
+ image_url = item.get("image_url")
367
+ if isinstance(image_url, dict) and isinstance(image_url.get("url"), str):
368
+ image_url["url"] = _sanitize_image_url(image_url["url"])
@@ -43,6 +43,7 @@ class AgentSettings(BaseModel):
43
43
  max_steps: int = 7
44
44
  model_id: str = "gpt-5-mini"
45
45
  reasoning_effort: typing.Optional[str] = "medium"
46
+ image_transport: str = "pil"
46
47
  model_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None
47
48
 
48
49
  def get_api_key(self) -> str:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes