erdo 0.1.10__py3-none-any.whl → 0.1.12__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.

Potentially problematic release.


This version of erdo might be problematic. Click here for more details.

erdo/__init__.py CHANGED
@@ -10,8 +10,8 @@ from ._generated.condition import __all__ as condition_all
10
10
  from ._generated.types import * # noqa: F403,F401
11
11
  from ._generated.types import __all__ as generated_all
12
12
 
13
- # Import invoke function for production and testing
14
- from .invoke import invoke # noqa: F401
13
+ # Import invoke functions
14
+ from .invoke.invoke import invoke, invoke_agent, invoke_by_key # noqa: F401
15
15
 
16
16
  # Import state object for template support
17
17
  from .state import state # noqa: F401
@@ -28,6 +28,6 @@ __all__.extend(handwritten_all)
28
28
  __all__.extend(generated_all)
29
29
  __all__.extend(condition_all)
30
30
 
31
- # Add state and invoke to __all__ for explicit import
31
+ # Add state and invoke functions to __all__ for explicit import
32
32
  __all__.append("state")
33
- __all__.append("invoke")
33
+ __all__.extend(["invoke", "invoke_agent", "invoke_by_key"])
@@ -9,6 +9,8 @@ NOTE: This module is hardcoded because bot.invoke requires bot_name parameter
9
9
  but the Go struct uses bot_id. The backend converts bot_name -> bot_id internally.
10
10
  """
11
11
 
12
+ from __future__ import annotations
13
+
12
14
  from typing import Any, Dict, Optional, Union
13
15
 
14
16
  from pydantic import BaseModel
@@ -175,6 +177,10 @@ def ask(
175
177
  return AskParams(**params_dict)
176
178
 
177
179
 
180
+ # Rebuild models to resolve forward references (needed for Python 3.10+)
181
+ InvokeParams.model_rebuild()
182
+ AskParams.model_rebuild()
183
+
178
184
  # Associate parameter classes with their result types
179
185
  InvokeParams._result = InvokeResult
180
186
  AskParams._result = AskResult
@@ -8,7 +8,7 @@ Actual execution happens in the Go backend after syncing.
8
8
 
9
9
  from typing import Any, Optional, Union
10
10
 
11
- from pydantic import BaseModel, Field
11
+ from pydantic import BaseModel, Field, model_serializer
12
12
 
13
13
  from erdo.template import TemplateString
14
14
 
@@ -41,6 +41,37 @@ class ExecuteParams(BaseActionParams):
41
41
  )
42
42
  storage_config: Optional[Any] = None # storage_config parameter
43
43
 
44
+ @model_serializer
45
+ def _serialize_model(self) -> dict:
46
+ """Custom serializer to preserve PythonFile._type marker in code_files."""
47
+ # Serialize code_files first
48
+ serialized_code_files = None
49
+ if self.code_files is not None and isinstance(self.code_files, list):
50
+ serialized_code_files = []
51
+ for item in self.code_files:
52
+ if hasattr(item, "model_dump") and callable(
53
+ getattr(item, "model_dump")
54
+ ):
55
+ # Use Pydantic's serialization which respects @model_serializer
56
+ serialized_code_files.append(item.model_dump())
57
+ elif hasattr(item, "to_dict") and callable(getattr(item, "to_dict")):
58
+ serialized_code_files.append(item.to_dict())
59
+ else:
60
+ serialized_code_files.append(item)
61
+
62
+ # Build full serialization
63
+ return {
64
+ "name": self.name,
65
+ "step_metadata": self.step_metadata,
66
+ "entrypoint": self.entrypoint,
67
+ "code_files": serialized_code_files,
68
+ "resources": self.resources,
69
+ "parameters": self.parameters,
70
+ "encryption_key": self.encryption_key,
71
+ "timeout_seconds": self.timeout_seconds,
72
+ "storage_config": self.storage_config,
73
+ }
74
+
44
75
 
45
76
  class ParseFileAsBotResourceParams(BaseActionParams):
46
77
  """Parse a file from code execution results into a bot resource with dataset and analysis parameters"""
@@ -9,6 +9,8 @@ NOTE: This module is hardcoded to provide bot-compatible parameter names
9
9
  that match the exported bot code format.
10
10
  """
11
11
 
12
+ from __future__ import annotations
13
+
12
14
  from typing import Any, Dict, List, Optional, Union
13
15
 
14
16
  from pydantic import BaseModel
@@ -139,5 +141,8 @@ def message(
139
141
  return MessageParams(**params_dict)
140
142
 
141
143
 
144
+ # Rebuild models to resolve forward references (needed for Python 3.10+)
145
+ MessageParams.model_rebuild()
146
+
142
147
  # Associate parameter classes with their result types
143
148
  MessageParams._result = MessageResult