erdo 0.1.4__py3-none-any.whl → 0.1.6__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 +13 -13
- erdo/_generated/actions/__init__.py +3 -1
- erdo/_generated/actions/analysis.py +116 -4
- erdo/_generated/actions/bot.py +61 -5
- erdo/_generated/actions/codeexec.py +53 -28
- erdo/_generated/actions/llm.py +44 -5
- erdo/_generated/actions/memory.py +252 -57
- erdo/_generated/actions/pdfextractor.py +97 -0
- erdo/_generated/actions/resource_definitions.py +114 -12
- erdo/_generated/actions/sqlexec.py +86 -0
- erdo/_generated/actions/utils.py +178 -56
- erdo/_generated/actions/webparser.py +15 -5
- erdo/_generated/actions/websearch.py +15 -5
- erdo/_generated/condition/__init__.py +137 -127
- erdo/_generated/internal_actions.py +14 -2
- erdo/_generated/types.py +92 -48
- erdo/actions/__init__.py +8 -8
- erdo/bot_permissions.py +266 -0
- erdo/config/__init__.py +5 -0
- erdo/config/config.py +140 -0
- erdo/invoke/__init__.py +10 -0
- erdo/invoke/client.py +213 -0
- erdo/invoke/invoke.py +244 -0
- erdo/sync/__init__.py +17 -0
- erdo/sync/client.py +95 -0
- erdo/sync/extractor.py +482 -0
- erdo/sync/sync.py +327 -0
- erdo/types.py +516 -18
- {erdo-0.1.4.dist-info → erdo-0.1.6.dist-info}/METADATA +4 -1
- erdo-0.1.6.dist-info/RECORD +45 -0
- erdo-0.1.4.dist-info/RECORD +0 -33
- {erdo-0.1.4.dist-info → erdo-0.1.6.dist-info}/WHEEL +0 -0
- {erdo-0.1.4.dist-info → erdo-0.1.6.dist-info}/entry_points.txt +0 -0
- {erdo-0.1.4.dist-info → erdo-0.1.6.dist-info}/licenses/LICENSE +0 -0
erdo/__init__.py
CHANGED
|
@@ -4,32 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
# Import all condition functions from generated condition module
|
|
6
6
|
from ._generated.condition import * # noqa: F403,F401
|
|
7
|
-
from ._generated.condition import __all__ as condition_all
|
|
8
7
|
|
|
9
|
-
# Import all generated types
|
|
8
|
+
# Import all generated types automatically
|
|
10
9
|
from ._generated.types import * # noqa: F403,F401
|
|
11
|
-
from ._generated.types import __all__ as generated_all
|
|
12
10
|
|
|
13
11
|
# Import state object for template support
|
|
14
12
|
from .state import state # noqa: F401
|
|
15
13
|
|
|
16
|
-
# Import all handwritten SDK classes
|
|
17
|
-
from .types import * # noqa: F403,F401
|
|
18
|
-
from .types import __all__ as handwritten_all
|
|
14
|
+
# Import all handwritten SDK classes automatically
|
|
15
|
+
from .types import * # noqa: F403,F401
|
|
19
16
|
|
|
20
17
|
__version__ = "0.1.0"
|
|
21
18
|
|
|
22
|
-
#
|
|
23
|
-
__all__
|
|
19
|
+
# Add all condition functions automatically
|
|
20
|
+
from ._generated.condition import __all__ as condition_all # noqa: E402
|
|
24
21
|
|
|
25
|
-
# Add generated types
|
|
26
|
-
__all__
|
|
22
|
+
# Add all generated types automatically
|
|
23
|
+
from ._generated.types import __all__ as generated_all # noqa: E402
|
|
27
24
|
|
|
28
|
-
# Add
|
|
29
|
-
__all__
|
|
25
|
+
# Add handwritten SDK classes
|
|
26
|
+
from .types import __all__ as handwritten_all # noqa: E402
|
|
30
27
|
|
|
31
|
-
#
|
|
28
|
+
# Build __all__ dynamically by combining all available types
|
|
29
|
+
__all__ = []
|
|
32
30
|
__all__.extend(handwritten_all)
|
|
31
|
+
__all__.extend(generated_all)
|
|
32
|
+
__all__.extend(condition_all)
|
|
33
33
|
|
|
34
34
|
# Add state to __all__ for explicit import
|
|
35
35
|
__all__.append("state")
|
|
@@ -16,17 +16,19 @@ from . import codeexec # noqa: F401
|
|
|
16
16
|
from . import llm # noqa: F401
|
|
17
17
|
from . import memory # noqa: F401
|
|
18
18
|
from . import resource_definitions # noqa: F401
|
|
19
|
+
from . import sqlexec # noqa: F401
|
|
19
20
|
from . import utils # noqa: F401
|
|
20
21
|
from . import webparser # noqa: F401
|
|
21
22
|
from . import websearch # noqa: F401
|
|
22
|
-
from .analysis import * # noqa: F403,F401
|
|
23
23
|
|
|
24
24
|
# Import all functions from service modules
|
|
25
|
+
from .analysis import * # noqa: F403,F401
|
|
25
26
|
from .bot import * # noqa: F403,F401
|
|
26
27
|
from .codeexec import * # noqa: F403,F401
|
|
27
28
|
from .llm import * # noqa: F403,F401
|
|
28
29
|
from .memory import * # noqa: F403,F401
|
|
29
30
|
from .resource_definitions import * # noqa: F403,F401
|
|
31
|
+
from .sqlexec import * # noqa: F403,F401
|
|
30
32
|
from .utils import * # noqa: F403,F401
|
|
31
33
|
from .webparser import * # noqa: F403,F401
|
|
32
34
|
from .websearch import * # noqa: F403,F401
|
|
@@ -11,10 +11,21 @@ from typing import Any, List, Optional, Union
|
|
|
11
11
|
from pydantic import BaseModel
|
|
12
12
|
|
|
13
13
|
from erdo.template import TemplateString
|
|
14
|
-
from erdo.types import StepMetadata
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
class
|
|
16
|
+
class BaseActionParams(BaseModel):
|
|
17
|
+
"""Base class for all action parameter classes.
|
|
18
|
+
|
|
19
|
+
Provides common fields that all actions support:
|
|
20
|
+
- name: The action type identifier
|
|
21
|
+
- step_metadata: Optional configuration for the step created from this action
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
name: str
|
|
25
|
+
step_metadata: Optional[Any] = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CreateAnalysisParams(BaseActionParams):
|
|
18
29
|
"""Create an analysis for a dataset, resource, or dataset-resource combination parameters"""
|
|
19
30
|
|
|
20
31
|
name: str = "analysis.create_analysis" # Action type for roundtrip compatibility
|
|
@@ -23,6 +34,28 @@ class CreateAnalysisParams(BaseModel):
|
|
|
23
34
|
resource_id: Optional[Union[str, TemplateString]] = None # resource_id parameter
|
|
24
35
|
|
|
25
36
|
|
|
37
|
+
class AnalyzeCsvParams(BaseActionParams):
|
|
38
|
+
"""Analyze CSV file using Go-based CSV analyzer (fast, no Python needed) parameters"""
|
|
39
|
+
|
|
40
|
+
name: str = "analysis.analyze_csv" # Action type for roundtrip compatibility
|
|
41
|
+
file: Optional[Any] = None # file parameter
|
|
42
|
+
columns: Optional[Any] = None # columns parameter
|
|
43
|
+
rows: Optional[Any] = None # rows parameter
|
|
44
|
+
encryption_key: Optional[Union[str, TemplateString]] = (
|
|
45
|
+
None # encryption_key parameter
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AnalyzeExcelParams(BaseActionParams):
|
|
50
|
+
"""Analyze Excel file using Go-based Excel analyzer (fast, no Python needed) parameters"""
|
|
51
|
+
|
|
52
|
+
name: str = "analysis.analyze_excel" # Action type for roundtrip compatibility
|
|
53
|
+
file: Optional[Any] = None # file parameter
|
|
54
|
+
encryption_key: Optional[Union[str, TemplateString]] = (
|
|
55
|
+
None # encryption_key parameter
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
26
59
|
class CreateAnalysisResult(BaseModel):
|
|
27
60
|
"""Create an analysis for a dataset, resource, or dataset-resource combination result type
|
|
28
61
|
|
|
@@ -34,11 +67,32 @@ class CreateAnalysisResult(BaseModel):
|
|
|
34
67
|
recommendations: Optional[List[str]]
|
|
35
68
|
|
|
36
69
|
|
|
70
|
+
class AnalyzeCsvResult(BaseModel):
|
|
71
|
+
"""Analyze CSV file using Go-based CSV analyzer (fast, no Python needed) result type
|
|
72
|
+
|
|
73
|
+
Result schema for analysis.analyze_csv action.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
summary: str
|
|
77
|
+
details: Any
|
|
78
|
+
dataset_file_name: str
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class AnalyzeExcelResult(BaseModel):
|
|
82
|
+
"""Analyze Excel file using Go-based Excel analyzer (fast, no Python needed) result type
|
|
83
|
+
|
|
84
|
+
Result schema for analysis.analyze_excel action.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
summary: str
|
|
88
|
+
details: Any
|
|
89
|
+
dataset_file_name: str
|
|
90
|
+
|
|
91
|
+
|
|
37
92
|
def create_analysis(
|
|
38
93
|
analysis: Optional[Any] = None,
|
|
39
94
|
dataset_id: Optional[Union[str, TemplateString]] = None,
|
|
40
95
|
resource_id: Optional[Union[str, TemplateString]] = None,
|
|
41
|
-
step_metadata: Optional[StepMetadata] = None,
|
|
42
96
|
**params: Any,
|
|
43
97
|
) -> CreateAnalysisParams:
|
|
44
98
|
"""Create an analysis for a dataset, resource, or dataset-resource combination
|
|
@@ -59,9 +113,67 @@ def create_analysis(
|
|
|
59
113
|
# Remove None values for optional parameters
|
|
60
114
|
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
61
115
|
param_dict.update(params)
|
|
116
|
+
params_obj = CreateAnalysisParams(**param_dict)
|
|
117
|
+
return params_obj
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def analyze_csv(
|
|
121
|
+
file: Optional[Any] = None,
|
|
122
|
+
columns: Optional[Any] = None,
|
|
123
|
+
rows: Optional[Any] = None,
|
|
124
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
125
|
+
**params: Any,
|
|
126
|
+
) -> AnalyzeCsvParams:
|
|
127
|
+
"""Analyze CSV file using Go-based CSV analyzer (fast, no Python needed)
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
file: file parameter
|
|
131
|
+
columns: columns parameter
|
|
132
|
+
rows: rows parameter
|
|
133
|
+
encryption_key: encryption_key parameter
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
AnalyzeCsvParams: Type-safe parameter object
|
|
137
|
+
"""
|
|
138
|
+
param_dict = {
|
|
139
|
+
"file": file,
|
|
140
|
+
"columns": columns,
|
|
141
|
+
"rows": rows,
|
|
142
|
+
"encryption_key": encryption_key,
|
|
143
|
+
}
|
|
144
|
+
# Remove None values for optional parameters
|
|
145
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
146
|
+
param_dict.update(params)
|
|
147
|
+
params_obj = AnalyzeCsvParams(**param_dict)
|
|
148
|
+
return params_obj
|
|
149
|
+
|
|
62
150
|
|
|
63
|
-
|
|
151
|
+
def analyze_excel(
|
|
152
|
+
file: Optional[Any] = None,
|
|
153
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
154
|
+
**params: Any,
|
|
155
|
+
) -> AnalyzeExcelParams:
|
|
156
|
+
"""Analyze Excel file using Go-based Excel analyzer (fast, no Python needed)
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
file: file parameter
|
|
160
|
+
encryption_key: encryption_key parameter
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
AnalyzeExcelParams: Type-safe parameter object
|
|
164
|
+
"""
|
|
165
|
+
param_dict = {
|
|
166
|
+
"file": file,
|
|
167
|
+
"encryption_key": encryption_key,
|
|
168
|
+
}
|
|
169
|
+
# Remove None values for optional parameters
|
|
170
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
171
|
+
param_dict.update(params)
|
|
172
|
+
params_obj = AnalyzeExcelParams(**param_dict)
|
|
173
|
+
return params_obj
|
|
64
174
|
|
|
65
175
|
|
|
66
176
|
# Associate parameter classes with their result types
|
|
67
177
|
CreateAnalysisParams._result = CreateAnalysisResult
|
|
178
|
+
AnalyzeCsvParams._result = AnalyzeCsvResult
|
|
179
|
+
AnalyzeExcelParams._result = AnalyzeExcelResult
|
erdo/_generated/actions/bot.py
CHANGED
|
@@ -17,10 +17,50 @@ from erdo.template import TemplateString
|
|
|
17
17
|
from erdo.types import StepMetadata
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class InvokeResult(BaseModel):
|
|
21
|
+
"""Bot invoke result type
|
|
22
|
+
|
|
23
|
+
Result schema for bot.invoke action.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
result: Any # The bot invocation result
|
|
27
|
+
messages: list # Messages from the bot invocation
|
|
28
|
+
resources: list # Resources created/used during invocation
|
|
29
|
+
final_state: Any # Final state after invocation
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AskResult(BaseModel):
|
|
33
|
+
"""Bot ask result type
|
|
34
|
+
|
|
35
|
+
Result schema for bot.ask action.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
success: bool # Whether the question was successfully processed
|
|
39
|
+
response: Optional[str] = None # The bot's response to the question
|
|
40
|
+
bot_id: Optional[str] = None # ID of the bot that answered
|
|
41
|
+
invocation_id: Optional[str] = None # ID of the invocation
|
|
42
|
+
error: Optional[str] = None # Error message if ask failed
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BaseActionParams(BaseModel):
|
|
46
|
+
"""Base class for all action parameter classes.
|
|
47
|
+
|
|
48
|
+
Provides common fields that all actions support:
|
|
49
|
+
- name: The action type identifier
|
|
50
|
+
- step_metadata: Optional configuration for the step created from this action
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
name: str
|
|
54
|
+
step_metadata: Optional[Any] = None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class InvokeParams(BaseActionParams):
|
|
21
58
|
"""Invoke a bot with specified parameters and return the result parameters"""
|
|
22
59
|
|
|
23
60
|
name: str = "bot.invoke" # Action type for roundtrip compatibility
|
|
61
|
+
bot_key: Optional[Union[str, TemplateString]] = (
|
|
62
|
+
None # bot_key parameter (unique bot identifier like "erdo.security-checker")
|
|
63
|
+
)
|
|
24
64
|
bot_name: Optional[Union[str, TemplateString]] = (
|
|
25
65
|
None # bot_name parameter (backend expects this, not bot_id)
|
|
26
66
|
)
|
|
@@ -38,7 +78,7 @@ class InvokeParams(BaseModel):
|
|
|
38
78
|
)
|
|
39
79
|
|
|
40
80
|
|
|
41
|
-
class AskParams(
|
|
81
|
+
class AskParams(BaseActionParams):
|
|
42
82
|
"""Ask a bot a question and get a response parameters"""
|
|
43
83
|
|
|
44
84
|
name: str = "bot.ask" # Action type for roundtrip compatibility
|
|
@@ -51,6 +91,7 @@ class AskParams(BaseModel):
|
|
|
51
91
|
|
|
52
92
|
|
|
53
93
|
def invoke(
|
|
94
|
+
bot_key: Optional[Union[str, TemplateString]] = None,
|
|
54
95
|
bot_name: Optional[Union[str, TemplateString]] = None,
|
|
55
96
|
parameters: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
56
97
|
bot_output_visibility_behaviour: Optional[Union[str, TemplateString]] = None,
|
|
@@ -61,11 +102,12 @@ def invoke(
|
|
|
61
102
|
) -> InvokeParams:
|
|
62
103
|
"""Invoke a bot with specified parameters and return the result
|
|
63
104
|
|
|
64
|
-
The bot.invoke action expects
|
|
65
|
-
The backend will look up the bot
|
|
105
|
+
The bot.invoke action expects bot_key or bot_name as the parameter.
|
|
106
|
+
The backend will look up the bot and convert to bot_id internally.
|
|
66
107
|
|
|
67
108
|
Args:
|
|
68
|
-
|
|
109
|
+
bot_key: Unique key of the bot to invoke (e.g., "erdo.security-checker")
|
|
110
|
+
bot_name: Name of the bot to invoke (alternative to bot_key)
|
|
69
111
|
parameters: Parameters to pass to the bot
|
|
70
112
|
bot_output_visibility_behaviour: Output visibility behaviour
|
|
71
113
|
transparent: Whether the invocation is transparent
|
|
@@ -75,6 +117,7 @@ def invoke(
|
|
|
75
117
|
InvokeParams: Type-safe parameter object
|
|
76
118
|
"""
|
|
77
119
|
params_dict = {
|
|
120
|
+
"bot_key": bot_key,
|
|
78
121
|
"bot_name": bot_name,
|
|
79
122
|
"parameters": parameters,
|
|
80
123
|
"bot_output_visibility_behaviour": bot_output_visibility_behaviour,
|
|
@@ -86,6 +129,10 @@ def invoke(
|
|
|
86
129
|
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
87
130
|
params_dict.update(params)
|
|
88
131
|
|
|
132
|
+
# Include step_metadata in params_dict since it's a field on BaseActionParams
|
|
133
|
+
if step_metadata is not None:
|
|
134
|
+
params_dict["step_metadata"] = step_metadata
|
|
135
|
+
|
|
89
136
|
# Use normal constructor for proper validation
|
|
90
137
|
return InvokeParams(**params_dict)
|
|
91
138
|
|
|
@@ -120,5 +167,14 @@ def ask(
|
|
|
120
167
|
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
121
168
|
params_dict.update(params)
|
|
122
169
|
|
|
170
|
+
# Include step_metadata in params_dict since it's a field on BaseActionParams
|
|
171
|
+
if step_metadata is not None:
|
|
172
|
+
params_dict["step_metadata"] = step_metadata
|
|
173
|
+
|
|
123
174
|
# Use normal constructor for proper validation
|
|
124
175
|
return AskParams(**params_dict)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# Associate parameter classes with their result types
|
|
179
|
+
InvokeParams._result = InvokeResult
|
|
180
|
+
AskParams._result = AskResult
|
|
@@ -6,28 +6,43 @@ Provides type-safe action definitions for codeexec service.
|
|
|
6
6
|
Actual execution happens in the Go backend after syncing.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
from typing import Any,
|
|
9
|
+
from typing import Any, Optional, Union
|
|
10
10
|
|
|
11
11
|
from pydantic import BaseModel
|
|
12
12
|
|
|
13
13
|
from erdo.template import TemplateString
|
|
14
|
-
from erdo.types import StepMetadata
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
class
|
|
16
|
+
class BaseActionParams(BaseModel):
|
|
17
|
+
"""Base class for all action parameter classes.
|
|
18
|
+
|
|
19
|
+
Provides common fields that all actions support:
|
|
20
|
+
- name: The action type identifier
|
|
21
|
+
- step_metadata: Optional configuration for the step created from this action
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
name: str
|
|
25
|
+
step_metadata: Optional[Any] = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ExecuteParams(BaseActionParams):
|
|
18
29
|
"""Execute code in a sandboxed environment and return the results parameters"""
|
|
19
30
|
|
|
20
31
|
name: str = "codeexec.execute" # Action type for roundtrip compatibility
|
|
21
32
|
entrypoint: Optional[Union[str, TemplateString]] = None # entrypoint parameter
|
|
22
33
|
code_files: Optional[Any] = None # code_files parameter
|
|
23
|
-
resources: Optional[
|
|
24
|
-
encrypted_secrets: Optional[Union[str, TemplateString]] = (
|
|
25
|
-
None # encrypted_secrets parameter
|
|
26
|
-
)
|
|
34
|
+
resources: Optional[Union[str, TemplateString]] = None # resources parameter
|
|
27
35
|
parameters: Optional[Union[str, TemplateString]] = None # parameters parameter
|
|
36
|
+
encryption_key: Optional[Union[str, TemplateString]] = (
|
|
37
|
+
None # encryption_key parameter
|
|
38
|
+
)
|
|
39
|
+
timeout_seconds: Optional[Union[int, TemplateString]] = (
|
|
40
|
+
None # timeout_seconds parameter
|
|
41
|
+
)
|
|
42
|
+
storage_config: Optional[Any] = None # storage_config parameter
|
|
28
43
|
|
|
29
44
|
|
|
30
|
-
class ParseFileAsBotResourceParams(
|
|
45
|
+
class ParseFileAsBotResourceParams(BaseActionParams):
|
|
31
46
|
"""Parse a file from code execution results into a bot resource with dataset and analysis parameters"""
|
|
32
47
|
|
|
33
48
|
name: str = (
|
|
@@ -36,9 +51,12 @@ class ParseFileAsBotResourceParams(BaseModel):
|
|
|
36
51
|
file: Optional[Any] = None # file parameter
|
|
37
52
|
files_analysis: Optional[Any] = None # files_analysis parameter
|
|
38
53
|
files_metadata: Optional[Any] = None # files_metadata parameter
|
|
54
|
+
encryption_key: Optional[Union[str, TemplateString]] = (
|
|
55
|
+
None # encryption_key parameter
|
|
56
|
+
)
|
|
39
57
|
|
|
40
58
|
|
|
41
|
-
class ParseFileAsJsonParams(
|
|
59
|
+
class ParseFileAsJsonParams(BaseActionParams):
|
|
42
60
|
"""Parse a file from code execution results as JSON data parameters"""
|
|
43
61
|
|
|
44
62
|
name: str = "codeexec.parse_file_as_json" # Action type for roundtrip compatibility
|
|
@@ -61,10 +79,13 @@ class ExecuteResult(BaseModel):
|
|
|
61
79
|
class ParseFileAsBotResourceResult(BaseModel):
|
|
62
80
|
"""Parse a file from code execution results into a bot resource with dataset and analysis result type
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
Generic result schema for codeexec.parse_file_as_bot_resource action.
|
|
65
83
|
"""
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
success: bool = True # Whether the action was successful
|
|
86
|
+
|
|
87
|
+
class Config:
|
|
88
|
+
extra = "allow" # Allow additional fields dynamically
|
|
68
89
|
|
|
69
90
|
|
|
70
91
|
class ParseFileAsJsonResult(BaseModel):
|
|
@@ -73,16 +94,17 @@ class ParseFileAsJsonResult(BaseModel):
|
|
|
73
94
|
Result schema for codeexec.parse_file_as_json action.
|
|
74
95
|
"""
|
|
75
96
|
|
|
76
|
-
|
|
97
|
+
json: Any
|
|
77
98
|
|
|
78
99
|
|
|
79
100
|
def execute(
|
|
80
101
|
entrypoint: Optional[Union[str, TemplateString]] = None,
|
|
81
102
|
code_files: Optional[Any] = None,
|
|
82
|
-
resources: Optional[
|
|
83
|
-
encrypted_secrets: Optional[Union[str, TemplateString]] = None,
|
|
103
|
+
resources: Optional[Union[str, TemplateString]] = None,
|
|
84
104
|
parameters: Optional[Union[str, TemplateString]] = None,
|
|
85
|
-
|
|
105
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
106
|
+
timeout_seconds: Optional[Union[int, TemplateString]] = None,
|
|
107
|
+
storage_config: Optional[Any] = None,
|
|
86
108
|
**params: Any,
|
|
87
109
|
) -> ExecuteParams:
|
|
88
110
|
"""Execute code in a sandboxed environment and return the results
|
|
@@ -91,8 +113,10 @@ def execute(
|
|
|
91
113
|
entrypoint: entrypoint parameter
|
|
92
114
|
code_files: code_files parameter
|
|
93
115
|
resources: resources parameter
|
|
94
|
-
encrypted_secrets: encrypted_secrets parameter
|
|
95
116
|
parameters: parameters parameter
|
|
117
|
+
encryption_key: encryption_key parameter
|
|
118
|
+
timeout_seconds: timeout_seconds parameter
|
|
119
|
+
storage_config: storage_config parameter
|
|
96
120
|
|
|
97
121
|
Returns:
|
|
98
122
|
ExecuteParams: Type-safe parameter object
|
|
@@ -101,21 +125,23 @@ def execute(
|
|
|
101
125
|
"entrypoint": entrypoint,
|
|
102
126
|
"code_files": code_files,
|
|
103
127
|
"resources": resources,
|
|
104
|
-
"encrypted_secrets": encrypted_secrets,
|
|
105
128
|
"parameters": parameters,
|
|
129
|
+
"encryption_key": encryption_key,
|
|
130
|
+
"timeout_seconds": timeout_seconds,
|
|
131
|
+
"storage_config": storage_config,
|
|
106
132
|
}
|
|
107
133
|
# Remove None values for optional parameters
|
|
108
134
|
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
109
135
|
param_dict.update(params)
|
|
110
|
-
|
|
111
|
-
return
|
|
136
|
+
params_obj = ExecuteParams(**param_dict)
|
|
137
|
+
return params_obj
|
|
112
138
|
|
|
113
139
|
|
|
114
140
|
def parse_file_as_bot_resource(
|
|
115
141
|
file: Optional[Any] = None,
|
|
116
142
|
files_analysis: Optional[Any] = None,
|
|
117
143
|
files_metadata: Optional[Any] = None,
|
|
118
|
-
|
|
144
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
119
145
|
**params: Any,
|
|
120
146
|
) -> ParseFileAsBotResourceParams:
|
|
121
147
|
"""Parse a file from code execution results into a bot resource with dataset and analysis
|
|
@@ -124,6 +150,7 @@ def parse_file_as_bot_resource(
|
|
|
124
150
|
file: file parameter
|
|
125
151
|
files_analysis: files_analysis parameter
|
|
126
152
|
files_metadata: files_metadata parameter
|
|
153
|
+
encryption_key: encryption_key parameter
|
|
127
154
|
|
|
128
155
|
Returns:
|
|
129
156
|
ParseFileAsBotResourceParams: Type-safe parameter object
|
|
@@ -132,19 +159,17 @@ def parse_file_as_bot_resource(
|
|
|
132
159
|
"file": file,
|
|
133
160
|
"files_analysis": files_analysis,
|
|
134
161
|
"files_metadata": files_metadata,
|
|
162
|
+
"encryption_key": encryption_key,
|
|
135
163
|
}
|
|
136
164
|
# Remove None values for optional parameters
|
|
137
165
|
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
138
166
|
param_dict.update(params)
|
|
139
|
-
|
|
140
|
-
return
|
|
167
|
+
params_obj = ParseFileAsBotResourceParams(**param_dict)
|
|
168
|
+
return params_obj
|
|
141
169
|
|
|
142
170
|
|
|
143
171
|
def parse_file_as_json(
|
|
144
|
-
file: Optional[Any] = None,
|
|
145
|
-
thread_id: Optional[Any] = None,
|
|
146
|
-
step_metadata: Optional[StepMetadata] = None,
|
|
147
|
-
**params: Any,
|
|
172
|
+
file: Optional[Any] = None, thread_id: Optional[Any] = None, **params: Any
|
|
148
173
|
) -> ParseFileAsJsonParams:
|
|
149
174
|
"""Parse a file from code execution results as JSON data
|
|
150
175
|
|
|
@@ -162,8 +187,8 @@ def parse_file_as_json(
|
|
|
162
187
|
# Remove None values for optional parameters
|
|
163
188
|
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
164
189
|
param_dict.update(params)
|
|
165
|
-
|
|
166
|
-
return
|
|
190
|
+
params_obj = ParseFileAsJsonParams(**param_dict)
|
|
191
|
+
return params_obj
|
|
167
192
|
|
|
168
193
|
|
|
169
194
|
# Associate parameter classes with their result types
|
erdo/_generated/actions/llm.py
CHANGED
|
@@ -13,13 +13,36 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
13
13
|
|
|
14
14
|
from pydantic import BaseModel
|
|
15
15
|
|
|
16
|
+
from erdo._generated.types import Tool
|
|
16
17
|
from erdo.template import TemplateString
|
|
17
18
|
from erdo.types import StepMetadata
|
|
18
19
|
|
|
19
|
-
from ..types import Tool
|
|
20
20
|
|
|
21
|
+
class MessageResult(BaseModel):
|
|
22
|
+
"""LLM message result type
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Result schema for llm.message action.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
content: str # The generated response content
|
|
28
|
+
tool_calls: Optional[List[Any]] = None # Tool calls made by the LLM
|
|
29
|
+
usage: Optional[Any] = None # Token usage information
|
|
30
|
+
finish_reason: Optional[str] = None # Reason the generation finished
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BaseActionParams(BaseModel):
|
|
34
|
+
"""Base class for all action parameter classes.
|
|
35
|
+
|
|
36
|
+
Provides common fields that all actions support:
|
|
37
|
+
- name: The action type identifier
|
|
38
|
+
- step_metadata: Optional configuration for the step created from this action
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
name: str
|
|
42
|
+
step_metadata: Optional[StepMetadata] = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class MessageParams(BaseActionParams):
|
|
23
46
|
"""LLM message parameters (bot-compatible)"""
|
|
24
47
|
|
|
25
48
|
name: str = "llm.message" # Action type for roundtrip compatibility
|
|
@@ -49,6 +72,9 @@ class MessageParams(BaseModel):
|
|
|
49
72
|
disable_tools: Optional[Union[bool, TemplateString]] = (
|
|
50
73
|
None # Whether to disable tools for this message
|
|
51
74
|
)
|
|
75
|
+
reasoning: Optional[Union[Dict[str, Any], TemplateString]] = (
|
|
76
|
+
None # Reasoning configuration for extended thinking
|
|
77
|
+
)
|
|
52
78
|
|
|
53
79
|
|
|
54
80
|
def message(
|
|
@@ -62,7 +88,9 @@ def message(
|
|
|
62
88
|
max_tokens: Optional[Union[int, TemplateString]] = None,
|
|
63
89
|
metadata: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
64
90
|
disable_tools: Optional[Union[bool, TemplateString]] = None,
|
|
91
|
+
reasoning: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
65
92
|
step_metadata: Optional[StepMetadata] = None,
|
|
93
|
+
**params: Any,
|
|
66
94
|
) -> MessageParams:
|
|
67
95
|
"""Generate LLM message with bot-compatible parameters
|
|
68
96
|
|
|
@@ -80,11 +108,12 @@ def message(
|
|
|
80
108
|
max_tokens: Maximum tokens in response
|
|
81
109
|
metadata: Additional metadata
|
|
82
110
|
disable_tools: Whether to disable tools for this message
|
|
111
|
+
reasoning: Reasoning configuration for extended thinking
|
|
83
112
|
|
|
84
113
|
Returns:
|
|
85
114
|
MessageParams: Type-safe parameter object
|
|
86
115
|
"""
|
|
87
|
-
|
|
116
|
+
params_dict = {
|
|
88
117
|
"system_prompt": system_prompt,
|
|
89
118
|
"message_history": message_history,
|
|
90
119
|
"query": query,
|
|
@@ -95,10 +124,20 @@ def message(
|
|
|
95
124
|
"max_tokens": max_tokens,
|
|
96
125
|
"metadata": metadata,
|
|
97
126
|
"disable_tools": disable_tools,
|
|
127
|
+
"reasoning": reasoning,
|
|
98
128
|
}
|
|
99
129
|
|
|
100
130
|
# Remove None values for optional parameters
|
|
101
|
-
|
|
131
|
+
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
132
|
+
params_dict.update(params)
|
|
133
|
+
|
|
134
|
+
# Include step_metadata in params_dict since it's a field on BaseActionParams
|
|
135
|
+
if step_metadata is not None:
|
|
136
|
+
params_dict["step_metadata"] = step_metadata
|
|
102
137
|
|
|
103
138
|
# Use normal constructor for proper validation
|
|
104
|
-
return MessageParams(**
|
|
139
|
+
return MessageParams(**params_dict)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Associate parameter classes with their result types
|
|
143
|
+
MessageParams._result = MessageResult
|