asteroid-odyssey 1.0.3__py3-none-any.whl → 1.2.0__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 (77) hide show
  1. asteroid_odyssey/__init__.py +10 -2
  2. asteroid_odyssey/agents_v1_gen/__init__.py +87 -0
  3. asteroid_odyssey/agents_v1_gen/api/__init__.py +7 -0
  4. asteroid_odyssey/agents_v1_gen/api/agent_profile_api.py +1696 -0
  5. asteroid_odyssey/{openapi_client → agents_v1_gen}/api/api_api.py +4 -4
  6. asteroid_odyssey/{openapi_client/api/sdk_api.py → agents_v1_gen/api/execution_api.py} +314 -14
  7. asteroid_odyssey/{openapi_client → agents_v1_gen}/api_client.py +6 -6
  8. asteroid_odyssey/{openapi_client → agents_v1_gen}/configuration.py +2 -2
  9. asteroid_odyssey/agents_v1_gen/models/__init__.py +34 -0
  10. asteroid_odyssey/agents_v1_gen/models/agent_profile.py +118 -0
  11. asteroid_odyssey/agents_v1_gen/models/country_code.py +44 -0
  12. asteroid_odyssey/agents_v1_gen/models/create_agent_profile_request.py +112 -0
  13. asteroid_odyssey/agents_v1_gen/models/credential.py +95 -0
  14. asteroid_odyssey/agents_v1_gen/models/delete_agent_profile200_response.py +87 -0
  15. asteroid_odyssey/{openapi_client → agents_v1_gen}/models/execution_result_response.py +2 -2
  16. asteroid_odyssey/{openapi_client → agents_v1_gen}/models/execution_status_response.py +1 -1
  17. asteroid_odyssey/agents_v1_gen/models/proxy_type.py +37 -0
  18. asteroid_odyssey/agents_v1_gen/models/update_agent_profile_request.py +112 -0
  19. asteroid_odyssey/{openapi_client → agents_v1_gen}/rest.py +1 -1
  20. asteroid_odyssey/agents_v2_gen/__init__.py +99 -0
  21. asteroid_odyssey/agents_v2_gen/api/__init__.py +5 -0
  22. asteroid_odyssey/agents_v2_gen/api/execution_api.py +625 -0
  23. asteroid_odyssey/agents_v2_gen/api_client.py +801 -0
  24. asteroid_odyssey/agents_v2_gen/api_response.py +21 -0
  25. asteroid_odyssey/agents_v2_gen/configuration.py +612 -0
  26. asteroid_odyssey/agents_v2_gen/exceptions.py +216 -0
  27. asteroid_odyssey/agents_v2_gen/models/__init__.py +42 -0
  28. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_completed.py +100 -0
  29. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_failed.py +100 -0
  30. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_started.py +100 -0
  31. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_generic.py +100 -0
  32. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_status_changed.py +100 -0
  33. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_completed.py +100 -0
  34. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_started.py +100 -0
  35. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_terminal.py +100 -0
  36. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_transitioned_node.py +100 -0
  37. asteroid_odyssey/agents_v2_gen/models/activity_payload_union_user_message_received.py +100 -0
  38. asteroid_odyssey/agents_v2_gen/models/error.py +89 -0
  39. asteroid_odyssey/agents_v2_gen/models/execution_activity.py +98 -0
  40. asteroid_odyssey/agents_v2_gen/models/execution_activity_action_completed_payload.py +87 -0
  41. asteroid_odyssey/agents_v2_gen/models/execution_activity_action_failed_payload.py +87 -0
  42. asteroid_odyssey/agents_v2_gen/models/execution_activity_action_started_payload.py +87 -0
  43. asteroid_odyssey/agents_v2_gen/models/execution_activity_generic_payload.py +87 -0
  44. asteroid_odyssey/agents_v2_gen/models/execution_activity_payload_union.py +252 -0
  45. asteroid_odyssey/agents_v2_gen/models/execution_activity_status_changed_payload.py +88 -0
  46. asteroid_odyssey/agents_v2_gen/models/execution_activity_step_completed_payload.py +87 -0
  47. asteroid_odyssey/agents_v2_gen/models/execution_activity_step_started_payload.py +87 -0
  48. asteroid_odyssey/agents_v2_gen/models/execution_activity_transitioned_node_payload.py +89 -0
  49. asteroid_odyssey/agents_v2_gen/models/execution_activity_user_message_received_payload.py +89 -0
  50. asteroid_odyssey/agents_v2_gen/models/execution_status.py +43 -0
  51. asteroid_odyssey/agents_v2_gen/models/execution_terminal_payload.py +96 -0
  52. asteroid_odyssey/agents_v2_gen/models/execution_user_messages_add_text_body.py +87 -0
  53. asteroid_odyssey/agents_v2_gen/models/versions.py +37 -0
  54. asteroid_odyssey/agents_v2_gen/py.typed +0 -0
  55. asteroid_odyssey/agents_v2_gen/rest.py +258 -0
  56. asteroid_odyssey/client.py +640 -131
  57. {asteroid_odyssey-1.0.3.dist-info → asteroid_odyssey-1.2.0.dist-info}/METADATA +2 -1
  58. asteroid_odyssey-1.2.0.dist-info/RECORD +72 -0
  59. asteroid_odyssey/openapi_client/__init__.py +0 -73
  60. asteroid_odyssey/openapi_client/api/__init__.py +0 -7
  61. asteroid_odyssey/openapi_client/api/execution_api.py +0 -335
  62. asteroid_odyssey/openapi_client/models/__init__.py +0 -27
  63. asteroid_odyssey-1.0.3.dist-info/RECORD +0 -29
  64. /asteroid_odyssey/{openapi_client → agents_v1_gen}/api_response.py +0 -0
  65. /asteroid_odyssey/{openapi_client → agents_v1_gen}/exceptions.py +0 -0
  66. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/browser_session_recording_response.py +0 -0
  67. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/error_response.py +0 -0
  68. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/execution_response.py +0 -0
  69. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/execution_result.py +0 -0
  70. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/health_check200_response.py +0 -0
  71. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/health_check500_response.py +0 -0
  72. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/status.py +0 -0
  73. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/structured_agent_execution_request.py +0 -0
  74. /asteroid_odyssey/{openapi_client → agents_v1_gen}/models/upload_execution_files200_response.py +0 -0
  75. /asteroid_odyssey/{openapi_client → agents_v1_gen}/py.typed +0 -0
  76. {asteroid_odyssey-1.0.3.dist-info → asteroid_odyssey-1.2.0.dist-info}/WHEEL +0 -0
  77. {asteroid_odyssey-1.0.3.dist-info → asteroid_odyssey-1.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,216 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Service
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from typing import Any, Optional
15
+ from typing_extensions import Self
16
+
17
+ class OpenApiException(Exception):
18
+ """The base exception class for all OpenAPIExceptions"""
19
+
20
+
21
+ class ApiTypeError(OpenApiException, TypeError):
22
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
23
+ key_type=None) -> None:
24
+ """ Raises an exception for TypeErrors
25
+
26
+ Args:
27
+ msg (str): the exception message
28
+
29
+ Keyword Args:
30
+ path_to_item (list): a list of keys an indices to get to the
31
+ current_item
32
+ None if unset
33
+ valid_classes (tuple): the primitive classes that current item
34
+ should be an instance of
35
+ None if unset
36
+ key_type (bool): False if our value is a value in a dict
37
+ True if it is a key in a dict
38
+ False if our item is an item in a list
39
+ None if unset
40
+ """
41
+ self.path_to_item = path_to_item
42
+ self.valid_classes = valid_classes
43
+ self.key_type = key_type
44
+ full_msg = msg
45
+ if path_to_item:
46
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
47
+ super(ApiTypeError, self).__init__(full_msg)
48
+
49
+
50
+ class ApiValueError(OpenApiException, ValueError):
51
+ def __init__(self, msg, path_to_item=None) -> None:
52
+ """
53
+ Args:
54
+ msg (str): the exception message
55
+
56
+ Keyword Args:
57
+ path_to_item (list) the path to the exception in the
58
+ received_data dict. None if unset
59
+ """
60
+
61
+ self.path_to_item = path_to_item
62
+ full_msg = msg
63
+ if path_to_item:
64
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
65
+ super(ApiValueError, self).__init__(full_msg)
66
+
67
+
68
+ class ApiAttributeError(OpenApiException, AttributeError):
69
+ def __init__(self, msg, path_to_item=None) -> None:
70
+ """
71
+ Raised when an attribute reference or assignment fails.
72
+
73
+ Args:
74
+ msg (str): the exception message
75
+
76
+ Keyword Args:
77
+ path_to_item (None/list) the path to the exception in the
78
+ received_data dict
79
+ """
80
+ self.path_to_item = path_to_item
81
+ full_msg = msg
82
+ if path_to_item:
83
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
84
+ super(ApiAttributeError, self).__init__(full_msg)
85
+
86
+
87
+ class ApiKeyError(OpenApiException, KeyError):
88
+ def __init__(self, msg, path_to_item=None) -> None:
89
+ """
90
+ Args:
91
+ msg (str): the exception message
92
+
93
+ Keyword Args:
94
+ path_to_item (None/list) the path to the exception in the
95
+ received_data dict
96
+ """
97
+ self.path_to_item = path_to_item
98
+ full_msg = msg
99
+ if path_to_item:
100
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
101
+ super(ApiKeyError, self).__init__(full_msg)
102
+
103
+
104
+ class ApiException(OpenApiException):
105
+
106
+ def __init__(
107
+ self,
108
+ status=None,
109
+ reason=None,
110
+ http_resp=None,
111
+ *,
112
+ body: Optional[str] = None,
113
+ data: Optional[Any] = None,
114
+ ) -> None:
115
+ self.status = status
116
+ self.reason = reason
117
+ self.body = body
118
+ self.data = data
119
+ self.headers = None
120
+
121
+ if http_resp:
122
+ if self.status is None:
123
+ self.status = http_resp.status
124
+ if self.reason is None:
125
+ self.reason = http_resp.reason
126
+ if self.body is None:
127
+ try:
128
+ self.body = http_resp.data.decode('utf-8')
129
+ except Exception:
130
+ pass
131
+ self.headers = http_resp.getheaders()
132
+
133
+ @classmethod
134
+ def from_response(
135
+ cls,
136
+ *,
137
+ http_resp,
138
+ body: Optional[str],
139
+ data: Optional[Any],
140
+ ) -> Self:
141
+ if http_resp.status == 400:
142
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
143
+
144
+ if http_resp.status == 401:
145
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
146
+
147
+ if http_resp.status == 403:
148
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
149
+
150
+ if http_resp.status == 404:
151
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
+
153
+ # Added new conditions for 409 and 422
154
+ if http_resp.status == 409:
155
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
156
+
157
+ if http_resp.status == 422:
158
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
+
160
+ if 500 <= http_resp.status <= 599:
161
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
162
+ raise ApiException(http_resp=http_resp, body=body, data=data)
163
+
164
+ def __str__(self):
165
+ """Custom error messages for exception"""
166
+ error_message = "({0})\n"\
167
+ "Reason: {1}\n".format(self.status, self.reason)
168
+ if self.headers:
169
+ error_message += "HTTP response headers: {0}\n".format(
170
+ self.headers)
171
+
172
+ if self.data or self.body:
173
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
174
+
175
+ return error_message
176
+
177
+
178
+ class BadRequestException(ApiException):
179
+ pass
180
+
181
+
182
+ class NotFoundException(ApiException):
183
+ pass
184
+
185
+
186
+ class UnauthorizedException(ApiException):
187
+ pass
188
+
189
+
190
+ class ForbiddenException(ApiException):
191
+ pass
192
+
193
+
194
+ class ServiceException(ApiException):
195
+ pass
196
+
197
+
198
+ class ConflictException(ApiException):
199
+ """Exception for HTTP 409 Conflict."""
200
+ pass
201
+
202
+
203
+ class UnprocessableEntityException(ApiException):
204
+ """Exception for HTTP 422 Unprocessable Entity."""
205
+ pass
206
+
207
+
208
+ def render_path(path_to_item):
209
+ """Returns a string representation of a path"""
210
+ result = ""
211
+ for pth in path_to_item:
212
+ if isinstance(pth, int):
213
+ result += "[{0}]".format(pth)
214
+ else:
215
+ result += "['{0}']".format(pth)
216
+ return result
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ Agent Service
6
+
7
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+
9
+ The version of the OpenAPI document: v2
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_action_completed import ActivityPayloadUnionActionCompleted
18
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_action_failed import ActivityPayloadUnionActionFailed
19
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_action_started import ActivityPayloadUnionActionStarted
20
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_generic import ActivityPayloadUnionGeneric
21
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_status_changed import ActivityPayloadUnionStatusChanged
22
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_step_completed import ActivityPayloadUnionStepCompleted
23
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_step_started import ActivityPayloadUnionStepStarted
24
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_terminal import ActivityPayloadUnionTerminal
25
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_transitioned_node import ActivityPayloadUnionTransitionedNode
26
+ from asteroid_odyssey.agents_v2_gen.models.activity_payload_union_user_message_received import ActivityPayloadUnionUserMessageReceived
27
+ from asteroid_odyssey.agents_v2_gen.models.error import Error
28
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity import ExecutionActivity
29
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_completed_payload import ExecutionActivityActionCompletedPayload
30
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_failed_payload import ExecutionActivityActionFailedPayload
31
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_started_payload import ExecutionActivityActionStartedPayload
32
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_generic_payload import ExecutionActivityGenericPayload
33
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_payload_union import ExecutionActivityPayloadUnion
34
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_status_changed_payload import ExecutionActivityStatusChangedPayload
35
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_completed_payload import ExecutionActivityStepCompletedPayload
36
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_started_payload import ExecutionActivityStepStartedPayload
37
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_transitioned_node_payload import ExecutionActivityTransitionedNodePayload
38
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_user_message_received_payload import ExecutionActivityUserMessageReceivedPayload
39
+ from asteroid_odyssey.agents_v2_gen.models.execution_status import ExecutionStatus
40
+ from asteroid_odyssey.agents_v2_gen.models.execution_terminal_payload import ExecutionTerminalPayload
41
+ from asteroid_odyssey.agents_v2_gen.models.execution_user_messages_add_text_body import ExecutionUserMessagesAddTextBody
42
+ from asteroid_odyssey.agents_v2_gen.models.versions import Versions
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Service
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_completed_payload import ExecutionActivityActionCompletedPayload
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ActivityPayloadUnionActionCompleted(BaseModel):
27
+ """
28
+ ActivityPayloadUnionActionCompleted
29
+ """ # noqa: E501
30
+ activity_type: StrictStr = Field(alias="activityType")
31
+ data: ExecutionActivityActionCompletedPayload
32
+ __properties: ClassVar[List[str]] = ["activityType", "data"]
33
+
34
+ @field_validator('activity_type')
35
+ def activity_type_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['action_completed']):
38
+ raise ValueError("must be one of enum values ('action_completed')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of ActivityPayloadUnionActionCompleted from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of data
81
+ if self.data:
82
+ _dict['data'] = self.data.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ActivityPayloadUnionActionCompleted from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "activityType": obj.get("activityType"),
96
+ "data": ExecutionActivityActionCompletedPayload.from_dict(obj["data"]) if obj.get("data") is not None else None
97
+ })
98
+ return _obj
99
+
100
+
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Service
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_failed_payload import ExecutionActivityActionFailedPayload
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ActivityPayloadUnionActionFailed(BaseModel):
27
+ """
28
+ ActivityPayloadUnionActionFailed
29
+ """ # noqa: E501
30
+ activity_type: StrictStr = Field(alias="activityType")
31
+ data: ExecutionActivityActionFailedPayload
32
+ __properties: ClassVar[List[str]] = ["activityType", "data"]
33
+
34
+ @field_validator('activity_type')
35
+ def activity_type_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['action_failed']):
38
+ raise ValueError("must be one of enum values ('action_failed')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of ActivityPayloadUnionActionFailed from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of data
81
+ if self.data:
82
+ _dict['data'] = self.data.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ActivityPayloadUnionActionFailed from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "activityType": obj.get("activityType"),
96
+ "data": ExecutionActivityActionFailedPayload.from_dict(obj["data"]) if obj.get("data") is not None else None
97
+ })
98
+ return _obj
99
+
100
+
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Service
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_action_started_payload import ExecutionActivityActionStartedPayload
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ActivityPayloadUnionActionStarted(BaseModel):
27
+ """
28
+ ActivityPayloadUnionActionStarted
29
+ """ # noqa: E501
30
+ activity_type: StrictStr = Field(alias="activityType")
31
+ data: ExecutionActivityActionStartedPayload
32
+ __properties: ClassVar[List[str]] = ["activityType", "data"]
33
+
34
+ @field_validator('activity_type')
35
+ def activity_type_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['action_started']):
38
+ raise ValueError("must be one of enum values ('action_started')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of ActivityPayloadUnionActionStarted from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of data
81
+ if self.data:
82
+ _dict['data'] = self.data.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ActivityPayloadUnionActionStarted from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "activityType": obj.get("activityType"),
96
+ "data": ExecutionActivityActionStartedPayload.from_dict(obj["data"]) if obj.get("data") is not None else None
97
+ })
98
+ return _obj
99
+
100
+
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Service
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from asteroid_odyssey.agents_v2_gen.models.execution_activity_generic_payload import ExecutionActivityGenericPayload
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ActivityPayloadUnionGeneric(BaseModel):
27
+ """
28
+ ActivityPayloadUnionGeneric
29
+ """ # noqa: E501
30
+ activity_type: StrictStr = Field(alias="activityType")
31
+ data: ExecutionActivityGenericPayload
32
+ __properties: ClassVar[List[str]] = ["activityType", "data"]
33
+
34
+ @field_validator('activity_type')
35
+ def activity_type_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['generic']):
38
+ raise ValueError("must be one of enum values ('generic')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of ActivityPayloadUnionGeneric from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of data
81
+ if self.data:
82
+ _dict['data'] = self.data.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ActivityPayloadUnionGeneric from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "activityType": obj.get("activityType"),
96
+ "data": ExecutionActivityGenericPayload.from_dict(obj["data"]) if obj.get("data") is not None else None
97
+ })
98
+ return _obj
99
+
100
+