erdo 0.1.31__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.
- erdo/__init__.py +35 -0
- erdo/_generated/__init__.py +18 -0
- erdo/_generated/actions/__init__.py +34 -0
- erdo/_generated/actions/analysis.py +179 -0
- erdo/_generated/actions/bot.py +186 -0
- erdo/_generated/actions/codeexec.py +199 -0
- erdo/_generated/actions/llm.py +148 -0
- erdo/_generated/actions/memory.py +463 -0
- erdo/_generated/actions/pdfextractor.py +97 -0
- erdo/_generated/actions/resource_definitions.py +296 -0
- erdo/_generated/actions/sqlexec.py +90 -0
- erdo/_generated/actions/utils.py +475 -0
- erdo/_generated/actions/webparser.py +119 -0
- erdo/_generated/actions/websearch.py +85 -0
- erdo/_generated/condition/__init__.py +556 -0
- erdo/_generated/internal.py +51 -0
- erdo/_generated/internal_actions.py +91 -0
- erdo/_generated/parameters.py +17 -0
- erdo/_generated/secrets.py +17 -0
- erdo/_generated/template_functions.py +55 -0
- erdo/_generated/types.py +3907 -0
- erdo/actions/__init__.py +40 -0
- erdo/bot_permissions.py +266 -0
- erdo/cli_entry.py +73 -0
- erdo/conditions/__init__.py +11 -0
- erdo/config/__init__.py +5 -0
- erdo/config/config.py +140 -0
- erdo/formatting.py +279 -0
- erdo/install_cli.py +140 -0
- erdo/integrations.py +131 -0
- erdo/invoke/__init__.py +11 -0
- erdo/invoke/client.py +234 -0
- erdo/invoke/invoke.py +555 -0
- erdo/state.py +376 -0
- erdo/sync/__init__.py +17 -0
- erdo/sync/client.py +95 -0
- erdo/sync/extractor.py +492 -0
- erdo/sync/sync.py +327 -0
- erdo/template.py +136 -0
- erdo/test/__init__.py +41 -0
- erdo/test/evaluate.py +272 -0
- erdo/test/runner.py +263 -0
- erdo/types.py +1431 -0
- erdo-0.1.31.dist-info/METADATA +471 -0
- erdo-0.1.31.dist-info/RECORD +48 -0
- erdo-0.1.31.dist-info/WHEEL +4 -0
- erdo-0.1.31.dist-info/entry_points.txt +2 -0
- erdo-0.1.31.dist-info/licenses/LICENSE +22 -0
erdo/__init__.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""Erdo Agent SDK - Build AI agents with Python."""
|
|
4
|
+
|
|
5
|
+
# Import all condition functions from generated condition module
|
|
6
|
+
from ._generated.condition import * # noqa: F403,F401
|
|
7
|
+
from ._generated.condition import __all__ as condition_all
|
|
8
|
+
|
|
9
|
+
# Import all generated types automatically
|
|
10
|
+
from ._generated.types import * # noqa: F403,F401
|
|
11
|
+
from ._generated.types import __all__ as generated_all
|
|
12
|
+
|
|
13
|
+
# Import invoke functions
|
|
14
|
+
from .invoke.invoke import invoke, invoke_agent, invoke_by_key # noqa: F401
|
|
15
|
+
|
|
16
|
+
# Import state object for template support
|
|
17
|
+
from .state import state # noqa: F401
|
|
18
|
+
|
|
19
|
+
# Import all handwritten SDK classes automatically
|
|
20
|
+
from .types import * # noqa: F403,F401
|
|
21
|
+
from .types import __all__ as handwritten_all
|
|
22
|
+
|
|
23
|
+
__version__ = "0.1.0"
|
|
24
|
+
|
|
25
|
+
# Build __all__ dynamically by combining all available types
|
|
26
|
+
__all__ = []
|
|
27
|
+
__all__.extend(handwritten_all)
|
|
28
|
+
__all__.extend(generated_all)
|
|
29
|
+
__all__.extend(condition_all)
|
|
30
|
+
|
|
31
|
+
# Add state to __all__ for explicit import
|
|
32
|
+
__all__.append("state")
|
|
33
|
+
|
|
34
|
+
# Add invoke functions to __all__
|
|
35
|
+
__all__.extend(["invoke", "invoke_agent", "invoke_by_key"])
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""
|
|
4
|
+
Re-exports for generated code.
|
|
5
|
+
|
|
6
|
+
This module provides clean access to all generated types and actions.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Re-export actions module
|
|
10
|
+
from . import actions # noqa: F401
|
|
11
|
+
|
|
12
|
+
# Re-export internal actions
|
|
13
|
+
from .internal_actions import * # noqa: F403,F401
|
|
14
|
+
|
|
15
|
+
# Re-export all generated types
|
|
16
|
+
from .parameters import * # noqa: F403,F401
|
|
17
|
+
from .secrets import * # noqa: F403,F401
|
|
18
|
+
from .types import * # noqa: F403,F401
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""
|
|
4
|
+
Action functions for type-safe parameter generation.
|
|
5
|
+
|
|
6
|
+
Import individual functions or entire modules:
|
|
7
|
+
- from erdo.actions import memory, codeexec
|
|
8
|
+
- from erdo.actions.memory import search, store
|
|
9
|
+
- from erdo.actions.codeexec import execute
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Module-level imports for convenient access
|
|
13
|
+
from . import analysis # noqa: F401
|
|
14
|
+
from . import bot # noqa: F401
|
|
15
|
+
from . import codeexec # noqa: F401
|
|
16
|
+
from . import llm # noqa: F401
|
|
17
|
+
from . import memory # noqa: F401
|
|
18
|
+
from . import resource_definitions # noqa: F401
|
|
19
|
+
from . import sqlexec # noqa: F401
|
|
20
|
+
from . import utils # noqa: F401
|
|
21
|
+
from . import webparser # noqa: F401
|
|
22
|
+
from . import websearch # noqa: F401
|
|
23
|
+
|
|
24
|
+
# Import all functions from service modules
|
|
25
|
+
from .analysis import * # noqa: F403,F401
|
|
26
|
+
from .bot import * # noqa: F403,F401
|
|
27
|
+
from .codeexec import * # noqa: F403,F401
|
|
28
|
+
from .llm import * # noqa: F403,F401
|
|
29
|
+
from .memory import * # noqa: F403,F401
|
|
30
|
+
from .resource_definitions import * # noqa: F403,F401
|
|
31
|
+
from .sqlexec import * # noqa: F403,F401
|
|
32
|
+
from .utils import * # noqa: F403,F401
|
|
33
|
+
from .webparser import * # noqa: F403,F401
|
|
34
|
+
from .websearch import * # noqa: F403,F401
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Analysis actions for creating and managing data analysis service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for analysis service.
|
|
6
|
+
Actual execution happens in the Go backend after syncing.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any, List, Optional, Union
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel
|
|
12
|
+
|
|
13
|
+
from erdo.template import TemplateString
|
|
14
|
+
|
|
15
|
+
|
|
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):
|
|
29
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination parameters"""
|
|
30
|
+
|
|
31
|
+
name: str = "analysis.create_analysis" # Action type for roundtrip compatibility
|
|
32
|
+
analysis: Optional[Any] = None # analysis parameter
|
|
33
|
+
dataset_slug: Optional[Union[str, TemplateString]] = None # dataset_slug parameter
|
|
34
|
+
resource_id: Optional[Union[str, TemplateString]] = None # resource_id parameter
|
|
35
|
+
|
|
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
|
+
|
|
59
|
+
class CreateAnalysisResult(BaseModel):
|
|
60
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination result type
|
|
61
|
+
|
|
62
|
+
Result schema for analysis.create_analysis action.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
analysis: Any
|
|
66
|
+
insights: Optional[List[str]]
|
|
67
|
+
recommendations: Optional[List[str]]
|
|
68
|
+
|
|
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
|
+
|
|
92
|
+
def create_analysis(
|
|
93
|
+
analysis: Optional[Any] = None,
|
|
94
|
+
dataset_slug: Optional[Union[str, TemplateString]] = None,
|
|
95
|
+
resource_id: Optional[Union[str, TemplateString]] = None,
|
|
96
|
+
**params: Any,
|
|
97
|
+
) -> CreateAnalysisParams:
|
|
98
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
analysis: analysis parameter
|
|
102
|
+
dataset_slug: dataset_slug parameter
|
|
103
|
+
resource_id: resource_id parameter
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
CreateAnalysisParams: Type-safe parameter object
|
|
107
|
+
"""
|
|
108
|
+
param_dict = {
|
|
109
|
+
"analysis": analysis,
|
|
110
|
+
"dataset_slug": dataset_slug,
|
|
111
|
+
"resource_id": resource_id,
|
|
112
|
+
}
|
|
113
|
+
# Remove None values for optional parameters
|
|
114
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
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
|
+
|
|
150
|
+
|
|
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
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# Associate parameter classes with their result types
|
|
177
|
+
CreateAnalysisParams._result = CreateAnalysisResult
|
|
178
|
+
AnalyzeCsvParams._result = AnalyzeCsvResult
|
|
179
|
+
AnalyzeExcelParams._result = AnalyzeExcelResult
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Bot service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for Bot service with correct parameter names.
|
|
6
|
+
Actual execution happens in the Go backend after syncing.
|
|
7
|
+
|
|
8
|
+
NOTE: This module is hardcoded because bot.invoke requires bot_name parameter
|
|
9
|
+
but the Go struct uses bot_id. The backend converts bot_name -> bot_id internally.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from typing import Any, Dict, Optional, Union
|
|
15
|
+
|
|
16
|
+
from pydantic import BaseModel
|
|
17
|
+
|
|
18
|
+
from erdo.template import TemplateString
|
|
19
|
+
from erdo.types import StepMetadata
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class InvokeResult(BaseModel):
|
|
23
|
+
"""Bot invoke result type
|
|
24
|
+
|
|
25
|
+
Result schema for bot.invoke action.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
result: Any # The bot invocation result
|
|
29
|
+
messages: list # Messages from the bot invocation
|
|
30
|
+
resources: list # Resources created/used during invocation
|
|
31
|
+
final_state: Any # Final state after invocation
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AskResult(BaseModel):
|
|
35
|
+
"""Bot ask result type
|
|
36
|
+
|
|
37
|
+
Result schema for bot.ask action.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
success: bool # Whether the question was successfully processed
|
|
41
|
+
response: Optional[str] = None # The bot's response to the question
|
|
42
|
+
bot_id: Optional[str] = None # ID of the bot that answered
|
|
43
|
+
invocation_id: Optional[str] = None # ID of the invocation
|
|
44
|
+
error: Optional[str] = None # Error message if ask failed
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class BaseActionParams(BaseModel):
|
|
48
|
+
"""Base class for all action parameter classes.
|
|
49
|
+
|
|
50
|
+
Provides common fields that all actions support:
|
|
51
|
+
- name: The action type identifier
|
|
52
|
+
- step_metadata: Optional configuration for the step created from this action
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
name: str
|
|
56
|
+
step_metadata: Optional[Any] = None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class InvokeParams(BaseActionParams):
|
|
60
|
+
"""Invoke a bot with specified parameters and return the result parameters"""
|
|
61
|
+
|
|
62
|
+
name: str = "bot.invoke" # Action type for roundtrip compatibility
|
|
63
|
+
bot_key: Optional[Union[str, TemplateString]] = (
|
|
64
|
+
None # bot_key parameter (unique bot identifier like "erdo.security-checker")
|
|
65
|
+
)
|
|
66
|
+
bot_name: Optional[Union[str, TemplateString]] = (
|
|
67
|
+
None # bot_name parameter (backend expects this, not bot_id)
|
|
68
|
+
)
|
|
69
|
+
parameters: Optional[Union[Dict[str, Any], TemplateString]] = (
|
|
70
|
+
None # parameters parameter
|
|
71
|
+
)
|
|
72
|
+
bot_output_visibility_behaviour: Optional[Union[str, TemplateString]] = (
|
|
73
|
+
None # Output visibility behaviour
|
|
74
|
+
)
|
|
75
|
+
transparent: Optional[Union[bool, TemplateString]] = (
|
|
76
|
+
None # Whether the invocation is transparent
|
|
77
|
+
)
|
|
78
|
+
disable_tools: Optional[Union[bool, TemplateString]] = (
|
|
79
|
+
None # Whether to disable tools for this invocation
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class AskParams(BaseActionParams):
|
|
84
|
+
"""Ask a bot a question and get a response parameters"""
|
|
85
|
+
|
|
86
|
+
name: str = "bot.ask" # Action type for roundtrip compatibility
|
|
87
|
+
query: Optional[Union[str, TemplateString]] = None # query parameter
|
|
88
|
+
bot_name: Optional[Union[str, TemplateString]] = None # bot_name parameter
|
|
89
|
+
bot_id: Optional[Union[str, TemplateString]] = None # bot_id parameter
|
|
90
|
+
invocation_id: Optional[Union[str, TemplateString]] = (
|
|
91
|
+
None # invocation_id parameter
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def invoke(
|
|
96
|
+
bot_key: Optional[Union[str, TemplateString]] = None,
|
|
97
|
+
bot_name: Optional[Union[str, TemplateString]] = None,
|
|
98
|
+
parameters: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
99
|
+
bot_output_visibility_behaviour: Optional[Union[str, TemplateString]] = None,
|
|
100
|
+
transparent: Optional[Union[bool, TemplateString]] = None,
|
|
101
|
+
disable_tools: Optional[Union[bool, TemplateString]] = None,
|
|
102
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
103
|
+
**params: Any,
|
|
104
|
+
) -> InvokeParams:
|
|
105
|
+
"""Invoke a bot with specified parameters and return the result
|
|
106
|
+
|
|
107
|
+
The bot.invoke action expects bot_key or bot_name as the parameter.
|
|
108
|
+
The backend will look up the bot and convert to bot_id internally.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
bot_key: Unique key of the bot to invoke (e.g., "erdo.security-checker")
|
|
112
|
+
bot_name: Name of the bot to invoke (alternative to bot_key)
|
|
113
|
+
parameters: Parameters to pass to the bot
|
|
114
|
+
bot_output_visibility_behaviour: Output visibility behaviour
|
|
115
|
+
transparent: Whether the invocation is transparent
|
|
116
|
+
disable_tools: Whether to disable tools for this invocation
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
InvokeParams: Type-safe parameter object
|
|
120
|
+
"""
|
|
121
|
+
params_dict = {
|
|
122
|
+
"bot_key": bot_key,
|
|
123
|
+
"bot_name": bot_name,
|
|
124
|
+
"parameters": parameters,
|
|
125
|
+
"bot_output_visibility_behaviour": bot_output_visibility_behaviour,
|
|
126
|
+
"transparent": transparent,
|
|
127
|
+
"disable_tools": disable_tools,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
# Remove None values for optional parameters
|
|
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
|
|
137
|
+
|
|
138
|
+
# Use normal constructor for proper validation
|
|
139
|
+
return InvokeParams(**params_dict)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def ask(
|
|
143
|
+
query: Optional[Union[str, TemplateString]] = None,
|
|
144
|
+
bot_name: Optional[Union[str, TemplateString]] = None,
|
|
145
|
+
bot_id: Optional[Union[str, TemplateString]] = None,
|
|
146
|
+
invocation_id: Optional[Union[str, TemplateString]] = None,
|
|
147
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
148
|
+
**params: Any,
|
|
149
|
+
) -> AskParams:
|
|
150
|
+
"""Ask a bot a question and get a response
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
query: Question to ask the bot
|
|
154
|
+
bot_name: Name of the bot to ask
|
|
155
|
+
bot_id: ID of the bot to ask (alternative to bot_name)
|
|
156
|
+
invocation_id: Invocation ID for tracking
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
AskParams: Type-safe parameter object
|
|
160
|
+
"""
|
|
161
|
+
params_dict = {
|
|
162
|
+
"query": query,
|
|
163
|
+
"bot_name": bot_name,
|
|
164
|
+
"bot_id": bot_id,
|
|
165
|
+
"invocation_id": invocation_id,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# Remove None values for optional parameters
|
|
169
|
+
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
170
|
+
params_dict.update(params)
|
|
171
|
+
|
|
172
|
+
# Include step_metadata in params_dict since it's a field on BaseActionParams
|
|
173
|
+
if step_metadata is not None:
|
|
174
|
+
params_dict["step_metadata"] = step_metadata
|
|
175
|
+
|
|
176
|
+
# Use normal constructor for proper validation
|
|
177
|
+
return AskParams(**params_dict)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# Rebuild models to resolve forward references (needed for Python 3.10+)
|
|
181
|
+
InvokeParams.model_rebuild()
|
|
182
|
+
AskParams.model_rebuild()
|
|
183
|
+
|
|
184
|
+
# Associate parameter classes with their result types
|
|
185
|
+
InvokeParams._result = InvokeResult
|
|
186
|
+
AskParams._result = AskResult
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Code execution actions for running and processing code in sandboxed environments service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for codeexec service.
|
|
6
|
+
Actual execution happens in the Go backend after syncing.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any, Optional, Union
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel, Field
|
|
12
|
+
|
|
13
|
+
from erdo.template import TemplateString
|
|
14
|
+
|
|
15
|
+
|
|
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):
|
|
29
|
+
"""Execute code in a sandboxed environment and return the results parameters"""
|
|
30
|
+
|
|
31
|
+
name: str = "codeexec.execute" # Action type for roundtrip compatibility
|
|
32
|
+
entrypoint: Optional[Union[str, TemplateString]] = None # entrypoint parameter
|
|
33
|
+
code_files: Optional[Any] = None # code_files parameter
|
|
34
|
+
resources: Optional[Union[str, TemplateString]] = None # resources parameter
|
|
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
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ParseFileAsBotResourceParams(BaseActionParams):
|
|
46
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis parameters"""
|
|
47
|
+
|
|
48
|
+
name: str = (
|
|
49
|
+
"codeexec.parse_file_as_bot_resource" # Action type for roundtrip compatibility
|
|
50
|
+
)
|
|
51
|
+
file: Optional[Any] = None # file parameter
|
|
52
|
+
files_analysis: Optional[Any] = None # files_analysis parameter
|
|
53
|
+
files_metadata: Optional[Any] = None # files_metadata parameter
|
|
54
|
+
encryption_key: Optional[Union[str, TemplateString]] = (
|
|
55
|
+
None # encryption_key parameter
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ParseFileAsJsonParams(BaseActionParams):
|
|
60
|
+
"""Parse a file from code execution results as JSON data parameters"""
|
|
61
|
+
|
|
62
|
+
name: str = "codeexec.parse_file_as_json" # Action type for roundtrip compatibility
|
|
63
|
+
file: Optional[Any] = None # file parameter
|
|
64
|
+
thread_id: Optional[Any] = None # thread_id parameter
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ExecuteResult(BaseModel):
|
|
68
|
+
"""Execute code in a sandboxed environment and return the results result type
|
|
69
|
+
|
|
70
|
+
Result schema for codeexec.execute action.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
output: str
|
|
74
|
+
error: Optional[str]
|
|
75
|
+
exit_code: Optional[float]
|
|
76
|
+
files: Optional[Any]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ParseFileAsBotResourceResult(BaseModel):
|
|
80
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis result type
|
|
81
|
+
|
|
82
|
+
Generic result schema for codeexec.parse_file_as_bot_resource action.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
success: bool = True # Whether the action was successful
|
|
86
|
+
|
|
87
|
+
class Config:
|
|
88
|
+
extra = "allow" # Allow additional fields dynamically
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class ParseFileAsJsonResult(BaseModel):
|
|
92
|
+
"""Parse a file from code execution results as JSON data result type
|
|
93
|
+
|
|
94
|
+
Result schema for codeexec.parse_file_as_json action.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
model_config = {"populate_by_name": True} # Allow both field names and aliases
|
|
98
|
+
|
|
99
|
+
json_data: Any = Field(alias="json")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def execute(
|
|
103
|
+
entrypoint: Optional[Union[str, TemplateString]] = None,
|
|
104
|
+
code_files: Optional[Any] = None,
|
|
105
|
+
resources: Optional[Union[str, TemplateString]] = None,
|
|
106
|
+
parameters: Optional[Union[str, TemplateString]] = None,
|
|
107
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
108
|
+
timeout_seconds: Optional[Union[int, TemplateString]] = None,
|
|
109
|
+
storage_config: Optional[Any] = None,
|
|
110
|
+
**params: Any,
|
|
111
|
+
) -> ExecuteParams:
|
|
112
|
+
"""Execute code in a sandboxed environment and return the results
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
entrypoint: entrypoint parameter
|
|
116
|
+
code_files: code_files parameter
|
|
117
|
+
resources: resources parameter
|
|
118
|
+
parameters: parameters parameter
|
|
119
|
+
encryption_key: encryption_key parameter
|
|
120
|
+
timeout_seconds: timeout_seconds parameter
|
|
121
|
+
storage_config: storage_config parameter
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
ExecuteParams: Type-safe parameter object
|
|
125
|
+
"""
|
|
126
|
+
param_dict = {
|
|
127
|
+
"entrypoint": entrypoint,
|
|
128
|
+
"code_files": code_files,
|
|
129
|
+
"resources": resources,
|
|
130
|
+
"parameters": parameters,
|
|
131
|
+
"encryption_key": encryption_key,
|
|
132
|
+
"timeout_seconds": timeout_seconds,
|
|
133
|
+
"storage_config": storage_config,
|
|
134
|
+
}
|
|
135
|
+
# Remove None values for optional parameters
|
|
136
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
137
|
+
param_dict.update(params)
|
|
138
|
+
params_obj = ExecuteParams(**param_dict)
|
|
139
|
+
return params_obj
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def parse_file_as_bot_resource(
|
|
143
|
+
file: Optional[Any] = None,
|
|
144
|
+
files_analysis: Optional[Any] = None,
|
|
145
|
+
files_metadata: Optional[Any] = None,
|
|
146
|
+
encryption_key: Optional[Union[str, TemplateString]] = None,
|
|
147
|
+
**params: Any,
|
|
148
|
+
) -> ParseFileAsBotResourceParams:
|
|
149
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
file: file parameter
|
|
153
|
+
files_analysis: files_analysis parameter
|
|
154
|
+
files_metadata: files_metadata parameter
|
|
155
|
+
encryption_key: encryption_key parameter
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
ParseFileAsBotResourceParams: Type-safe parameter object
|
|
159
|
+
"""
|
|
160
|
+
param_dict = {
|
|
161
|
+
"file": file,
|
|
162
|
+
"files_analysis": files_analysis,
|
|
163
|
+
"files_metadata": files_metadata,
|
|
164
|
+
"encryption_key": encryption_key,
|
|
165
|
+
}
|
|
166
|
+
# Remove None values for optional parameters
|
|
167
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
168
|
+
param_dict.update(params)
|
|
169
|
+
params_obj = ParseFileAsBotResourceParams(**param_dict)
|
|
170
|
+
return params_obj
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def parse_file_as_json(
|
|
174
|
+
file: Optional[Any] = None, thread_id: Optional[Any] = None, **params: Any
|
|
175
|
+
) -> ParseFileAsJsonParams:
|
|
176
|
+
"""Parse a file from code execution results as JSON data
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
file: file parameter
|
|
180
|
+
thread_id: thread_id parameter
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
ParseFileAsJsonParams: Type-safe parameter object
|
|
184
|
+
"""
|
|
185
|
+
param_dict = {
|
|
186
|
+
"file": file,
|
|
187
|
+
"thread_id": thread_id,
|
|
188
|
+
}
|
|
189
|
+
# Remove None values for optional parameters
|
|
190
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
191
|
+
param_dict.update(params)
|
|
192
|
+
params_obj = ParseFileAsJsonParams(**param_dict)
|
|
193
|
+
return params_obj
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# Associate parameter classes with their result types
|
|
197
|
+
ExecuteParams._result = ExecuteResult
|
|
198
|
+
ParseFileAsBotResourceParams._result = ParseFileAsBotResourceResult
|
|
199
|
+
ParseFileAsJsonParams._result = ParseFileAsJsonResult
|