erdo 0.1.4__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 +35 -0
- erdo/_generated/__init__.py +18 -0
- erdo/_generated/actions/__init__.py +32 -0
- erdo/_generated/actions/analysis.py +67 -0
- erdo/_generated/actions/bot.py +124 -0
- erdo/_generated/actions/codeexec.py +172 -0
- erdo/_generated/actions/llm.py +104 -0
- erdo/_generated/actions/memory.py +252 -0
- erdo/_generated/actions/resource_definitions.py +194 -0
- erdo/_generated/actions/utils.py +397 -0
- erdo/_generated/actions/webparser.py +109 -0
- erdo/_generated/actions/websearch.py +75 -0
- erdo/_generated/condition/__init__.py +504 -0
- erdo/_generated/internal.py +51 -0
- erdo/_generated/internal_actions.py +79 -0
- erdo/_generated/parameters.py +17 -0
- erdo/_generated/secrets.py +17 -0
- erdo/_generated/template_functions.py +55 -0
- erdo/_generated/types.py +2514 -0
- erdo/actions/__init__.py +40 -0
- erdo/cli_entry.py +73 -0
- erdo/conditions/__init__.py +11 -0
- erdo/install_cli.py +140 -0
- erdo/integrations.py +131 -0
- erdo/py.typed +1 -0
- erdo/state.py +376 -0
- erdo/template.py +136 -0
- erdo/types.py +1142 -0
- erdo-0.1.4.dist-info/METADATA +344 -0
- erdo-0.1.4.dist-info/RECORD +33 -0
- erdo-0.1.4.dist-info/WHEEL +4 -0
- erdo-0.1.4.dist-info/entry_points.txt +2 -0
- erdo-0.1.4.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 first
|
|
10
|
+
from ._generated.types import * # noqa: F403,F401
|
|
11
|
+
from ._generated.types import __all__ as generated_all
|
|
12
|
+
|
|
13
|
+
# Import state object for template support
|
|
14
|
+
from .state import state # noqa: F401
|
|
15
|
+
|
|
16
|
+
# Import all handwritten SDK classes last (override generated ones)
|
|
17
|
+
from .types import * # noqa: F403,F401 # type: ignore[assignment]
|
|
18
|
+
from .types import __all__ as handwritten_all
|
|
19
|
+
|
|
20
|
+
__version__ = "0.1.0"
|
|
21
|
+
|
|
22
|
+
# Build __all__ dynamically by combining all available types
|
|
23
|
+
__all__ = []
|
|
24
|
+
|
|
25
|
+
# Add generated types first
|
|
26
|
+
__all__.extend(generated_all)
|
|
27
|
+
|
|
28
|
+
# Add all condition functions
|
|
29
|
+
__all__.extend(condition_all)
|
|
30
|
+
|
|
31
|
+
# Add handwritten SDK classes (may override generated ones in __all__)
|
|
32
|
+
__all__.extend(handwritten_all)
|
|
33
|
+
|
|
34
|
+
# Add state to __all__ for explicit import
|
|
35
|
+
__all__.append("state")
|
|
@@ -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,32 @@
|
|
|
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 utils # noqa: F401
|
|
20
|
+
from . import webparser # noqa: F401
|
|
21
|
+
from . import websearch # noqa: F401
|
|
22
|
+
from .analysis import * # noqa: F403,F401
|
|
23
|
+
|
|
24
|
+
# Import all functions from service modules
|
|
25
|
+
from .bot import * # noqa: F403,F401
|
|
26
|
+
from .codeexec import * # noqa: F403,F401
|
|
27
|
+
from .llm import * # noqa: F403,F401
|
|
28
|
+
from .memory import * # noqa: F403,F401
|
|
29
|
+
from .resource_definitions import * # noqa: F403,F401
|
|
30
|
+
from .utils import * # noqa: F403,F401
|
|
31
|
+
from .webparser import * # noqa: F403,F401
|
|
32
|
+
from .websearch import * # noqa: F403,F401
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
from erdo.types import StepMetadata
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CreateAnalysisParams(BaseModel):
|
|
18
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination parameters"""
|
|
19
|
+
|
|
20
|
+
name: str = "analysis.create_analysis" # Action type for roundtrip compatibility
|
|
21
|
+
analysis: Optional[Any] = None # analysis parameter
|
|
22
|
+
dataset_id: Optional[Union[str, TemplateString]] = None # dataset_id parameter
|
|
23
|
+
resource_id: Optional[Union[str, TemplateString]] = None # resource_id parameter
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CreateAnalysisResult(BaseModel):
|
|
27
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination result type
|
|
28
|
+
|
|
29
|
+
Result schema for analysis.create_analysis action.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
analysis: Any
|
|
33
|
+
insights: Optional[List[str]]
|
|
34
|
+
recommendations: Optional[List[str]]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def create_analysis(
|
|
38
|
+
analysis: Optional[Any] = None,
|
|
39
|
+
dataset_id: Optional[Union[str, TemplateString]] = None,
|
|
40
|
+
resource_id: Optional[Union[str, TemplateString]] = None,
|
|
41
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
42
|
+
**params: Any,
|
|
43
|
+
) -> CreateAnalysisParams:
|
|
44
|
+
"""Create an analysis for a dataset, resource, or dataset-resource combination
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
analysis: analysis parameter
|
|
48
|
+
dataset_id: dataset_id parameter
|
|
49
|
+
resource_id: resource_id parameter
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
CreateAnalysisParams: Type-safe parameter object
|
|
53
|
+
"""
|
|
54
|
+
param_dict = {
|
|
55
|
+
"analysis": analysis,
|
|
56
|
+
"dataset_id": dataset_id,
|
|
57
|
+
"resource_id": resource_id,
|
|
58
|
+
}
|
|
59
|
+
# Remove None values for optional parameters
|
|
60
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
61
|
+
param_dict.update(params)
|
|
62
|
+
|
|
63
|
+
return CreateAnalysisParams(**param_dict)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Associate parameter classes with their result types
|
|
67
|
+
CreateAnalysisParams._result = CreateAnalysisResult
|
|
@@ -0,0 +1,124 @@
|
|
|
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 typing import Any, Dict, Optional, Union
|
|
13
|
+
|
|
14
|
+
from pydantic import BaseModel
|
|
15
|
+
|
|
16
|
+
from erdo.template import TemplateString
|
|
17
|
+
from erdo.types import StepMetadata
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class InvokeParams(BaseModel):
|
|
21
|
+
"""Invoke a bot with specified parameters and return the result parameters"""
|
|
22
|
+
|
|
23
|
+
name: str = "bot.invoke" # Action type for roundtrip compatibility
|
|
24
|
+
bot_name: Optional[Union[str, TemplateString]] = (
|
|
25
|
+
None # bot_name parameter (backend expects this, not bot_id)
|
|
26
|
+
)
|
|
27
|
+
parameters: Optional[Union[Dict[str, Any], TemplateString]] = (
|
|
28
|
+
None # parameters parameter
|
|
29
|
+
)
|
|
30
|
+
bot_output_visibility_behaviour: Optional[Union[str, TemplateString]] = (
|
|
31
|
+
None # Output visibility behaviour
|
|
32
|
+
)
|
|
33
|
+
transparent: Optional[Union[bool, TemplateString]] = (
|
|
34
|
+
None # Whether the invocation is transparent
|
|
35
|
+
)
|
|
36
|
+
disable_tools: Optional[Union[bool, TemplateString]] = (
|
|
37
|
+
None # Whether to disable tools for this invocation
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class AskParams(BaseModel):
|
|
42
|
+
"""Ask a bot a question and get a response parameters"""
|
|
43
|
+
|
|
44
|
+
name: str = "bot.ask" # Action type for roundtrip compatibility
|
|
45
|
+
query: Optional[Union[str, TemplateString]] = None # query parameter
|
|
46
|
+
bot_name: Optional[Union[str, TemplateString]] = None # bot_name parameter
|
|
47
|
+
bot_id: Optional[Union[str, TemplateString]] = None # bot_id parameter
|
|
48
|
+
invocation_id: Optional[Union[str, TemplateString]] = (
|
|
49
|
+
None # invocation_id parameter
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def invoke(
|
|
54
|
+
bot_name: Optional[Union[str, TemplateString]] = None,
|
|
55
|
+
parameters: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
56
|
+
bot_output_visibility_behaviour: Optional[Union[str, TemplateString]] = None,
|
|
57
|
+
transparent: Optional[Union[bool, TemplateString]] = None,
|
|
58
|
+
disable_tools: Optional[Union[bool, TemplateString]] = None,
|
|
59
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
60
|
+
**params: Any,
|
|
61
|
+
) -> InvokeParams:
|
|
62
|
+
"""Invoke a bot with specified parameters and return the result
|
|
63
|
+
|
|
64
|
+
The bot.invoke action expects bot_name (not bot_id) as the parameter.
|
|
65
|
+
The backend will look up the bot by name and convert to bot_id internally.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
bot_name: Name of the bot to invoke
|
|
69
|
+
parameters: Parameters to pass to the bot
|
|
70
|
+
bot_output_visibility_behaviour: Output visibility behaviour
|
|
71
|
+
transparent: Whether the invocation is transparent
|
|
72
|
+
disable_tools: Whether to disable tools for this invocation
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
InvokeParams: Type-safe parameter object
|
|
76
|
+
"""
|
|
77
|
+
params_dict = {
|
|
78
|
+
"bot_name": bot_name,
|
|
79
|
+
"parameters": parameters,
|
|
80
|
+
"bot_output_visibility_behaviour": bot_output_visibility_behaviour,
|
|
81
|
+
"transparent": transparent,
|
|
82
|
+
"disable_tools": disable_tools,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# Remove None values for optional parameters
|
|
86
|
+
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
87
|
+
params_dict.update(params)
|
|
88
|
+
|
|
89
|
+
# Use normal constructor for proper validation
|
|
90
|
+
return InvokeParams(**params_dict)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def ask(
|
|
94
|
+
query: Optional[Union[str, TemplateString]] = None,
|
|
95
|
+
bot_name: Optional[Union[str, TemplateString]] = None,
|
|
96
|
+
bot_id: Optional[Union[str, TemplateString]] = None,
|
|
97
|
+
invocation_id: Optional[Union[str, TemplateString]] = None,
|
|
98
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
99
|
+
**params: Any,
|
|
100
|
+
) -> AskParams:
|
|
101
|
+
"""Ask a bot a question and get a response
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
query: Question to ask the bot
|
|
105
|
+
bot_name: Name of the bot to ask
|
|
106
|
+
bot_id: ID of the bot to ask (alternative to bot_name)
|
|
107
|
+
invocation_id: Invocation ID for tracking
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
AskParams: Type-safe parameter object
|
|
111
|
+
"""
|
|
112
|
+
params_dict = {
|
|
113
|
+
"query": query,
|
|
114
|
+
"bot_name": bot_name,
|
|
115
|
+
"bot_id": bot_id,
|
|
116
|
+
"invocation_id": invocation_id,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Remove None values for optional parameters
|
|
120
|
+
params_dict = {k: v for k, v in params_dict.items() if v is not None}
|
|
121
|
+
params_dict.update(params)
|
|
122
|
+
|
|
123
|
+
# Use normal constructor for proper validation
|
|
124
|
+
return AskParams(**params_dict)
|
|
@@ -0,0 +1,172 @@
|
|
|
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, Dict, Optional, Union
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel
|
|
12
|
+
|
|
13
|
+
from erdo.template import TemplateString
|
|
14
|
+
from erdo.types import StepMetadata
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ExecuteParams(BaseModel):
|
|
18
|
+
"""Execute code in a sandboxed environment and return the results parameters"""
|
|
19
|
+
|
|
20
|
+
name: str = "codeexec.execute" # Action type for roundtrip compatibility
|
|
21
|
+
entrypoint: Optional[Union[str, TemplateString]] = None # entrypoint parameter
|
|
22
|
+
code_files: Optional[Any] = None # code_files parameter
|
|
23
|
+
resources: Optional[Any] = None # resources parameter
|
|
24
|
+
encrypted_secrets: Optional[Union[str, TemplateString]] = (
|
|
25
|
+
None # encrypted_secrets parameter
|
|
26
|
+
)
|
|
27
|
+
parameters: Optional[Union[str, TemplateString]] = None # parameters parameter
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ParseFileAsBotResourceParams(BaseModel):
|
|
31
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis parameters"""
|
|
32
|
+
|
|
33
|
+
name: str = (
|
|
34
|
+
"codeexec.parse_file_as_bot_resource" # Action type for roundtrip compatibility
|
|
35
|
+
)
|
|
36
|
+
file: Optional[Any] = None # file parameter
|
|
37
|
+
files_analysis: Optional[Any] = None # files_analysis parameter
|
|
38
|
+
files_metadata: Optional[Any] = None # files_metadata parameter
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ParseFileAsJsonParams(BaseModel):
|
|
42
|
+
"""Parse a file from code execution results as JSON data parameters"""
|
|
43
|
+
|
|
44
|
+
name: str = "codeexec.parse_file_as_json" # Action type for roundtrip compatibility
|
|
45
|
+
file: Optional[Any] = None # file parameter
|
|
46
|
+
thread_id: Optional[Any] = None # thread_id parameter
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ExecuteResult(BaseModel):
|
|
50
|
+
"""Execute code in a sandboxed environment and return the results result type
|
|
51
|
+
|
|
52
|
+
Result schema for codeexec.execute action.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
output: str
|
|
56
|
+
error: Optional[str]
|
|
57
|
+
exit_code: Optional[float]
|
|
58
|
+
files: Optional[Any]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ParseFileAsBotResourceResult(BaseModel):
|
|
62
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis result type
|
|
63
|
+
|
|
64
|
+
Result schema for codeexec.parse_file_as_bot_resource action.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class ParseFileAsJsonResult(BaseModel):
|
|
71
|
+
"""Parse a file from code execution results as JSON data result type
|
|
72
|
+
|
|
73
|
+
Result schema for codeexec.parse_file_as_json action.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
data: Any
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def execute(
|
|
80
|
+
entrypoint: Optional[Union[str, TemplateString]] = None,
|
|
81
|
+
code_files: Optional[Any] = None,
|
|
82
|
+
resources: Optional[Any] = None,
|
|
83
|
+
encrypted_secrets: Optional[Union[str, TemplateString]] = None,
|
|
84
|
+
parameters: Optional[Union[str, TemplateString]] = None,
|
|
85
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
86
|
+
**params: Any,
|
|
87
|
+
) -> ExecuteParams:
|
|
88
|
+
"""Execute code in a sandboxed environment and return the results
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
entrypoint: entrypoint parameter
|
|
92
|
+
code_files: code_files parameter
|
|
93
|
+
resources: resources parameter
|
|
94
|
+
encrypted_secrets: encrypted_secrets parameter
|
|
95
|
+
parameters: parameters parameter
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
ExecuteParams: Type-safe parameter object
|
|
99
|
+
"""
|
|
100
|
+
param_dict = {
|
|
101
|
+
"entrypoint": entrypoint,
|
|
102
|
+
"code_files": code_files,
|
|
103
|
+
"resources": resources,
|
|
104
|
+
"encrypted_secrets": encrypted_secrets,
|
|
105
|
+
"parameters": parameters,
|
|
106
|
+
}
|
|
107
|
+
# Remove None values for optional parameters
|
|
108
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
109
|
+
param_dict.update(params)
|
|
110
|
+
|
|
111
|
+
return ExecuteParams(**param_dict)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def parse_file_as_bot_resource(
|
|
115
|
+
file: Optional[Any] = None,
|
|
116
|
+
files_analysis: Optional[Any] = None,
|
|
117
|
+
files_metadata: Optional[Any] = None,
|
|
118
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
119
|
+
**params: Any,
|
|
120
|
+
) -> ParseFileAsBotResourceParams:
|
|
121
|
+
"""Parse a file from code execution results into a bot resource with dataset and analysis
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
file: file parameter
|
|
125
|
+
files_analysis: files_analysis parameter
|
|
126
|
+
files_metadata: files_metadata parameter
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
ParseFileAsBotResourceParams: Type-safe parameter object
|
|
130
|
+
"""
|
|
131
|
+
param_dict = {
|
|
132
|
+
"file": file,
|
|
133
|
+
"files_analysis": files_analysis,
|
|
134
|
+
"files_metadata": files_metadata,
|
|
135
|
+
}
|
|
136
|
+
# Remove None values for optional parameters
|
|
137
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
138
|
+
param_dict.update(params)
|
|
139
|
+
|
|
140
|
+
return ParseFileAsBotResourceParams(**param_dict)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
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,
|
|
148
|
+
) -> ParseFileAsJsonParams:
|
|
149
|
+
"""Parse a file from code execution results as JSON data
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
file: file parameter
|
|
153
|
+
thread_id: thread_id parameter
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
ParseFileAsJsonParams: Type-safe parameter object
|
|
157
|
+
"""
|
|
158
|
+
param_dict = {
|
|
159
|
+
"file": file,
|
|
160
|
+
"thread_id": thread_id,
|
|
161
|
+
}
|
|
162
|
+
# Remove None values for optional parameters
|
|
163
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
164
|
+
param_dict.update(params)
|
|
165
|
+
|
|
166
|
+
return ParseFileAsJsonParams(**param_dict)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
# Associate parameter classes with their result types
|
|
170
|
+
ExecuteParams._result = ExecuteResult
|
|
171
|
+
ParseFileAsBotResourceParams._result = ParseFileAsBotResourceResult
|
|
172
|
+
ParseFileAsJsonParams._result = ParseFileAsJsonResult
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LLM service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for LLM service with bot-compatible parameters.
|
|
6
|
+
Actual execution happens in the Go backend after syncing.
|
|
7
|
+
|
|
8
|
+
NOTE: This module is hardcoded to provide bot-compatible parameter names
|
|
9
|
+
that match the exported bot code format.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from typing import Any, Dict, List, Optional, Union
|
|
13
|
+
|
|
14
|
+
from pydantic import BaseModel
|
|
15
|
+
|
|
16
|
+
from erdo.template import TemplateString
|
|
17
|
+
from erdo.types import StepMetadata
|
|
18
|
+
|
|
19
|
+
from ..types import Tool
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MessageParams(BaseModel):
|
|
23
|
+
"""LLM message parameters (bot-compatible)"""
|
|
24
|
+
|
|
25
|
+
name: str = "llm.message" # Action type for roundtrip compatibility
|
|
26
|
+
|
|
27
|
+
# Bot definition parameters (high-level)
|
|
28
|
+
system_prompt: Optional[Union[str, TemplateString]] = (
|
|
29
|
+
None # System prompt for the conversation
|
|
30
|
+
)
|
|
31
|
+
message_history: Optional[Union[List[Dict[str, Any]], TemplateString]] = (
|
|
32
|
+
None # Previous messages in the conversation
|
|
33
|
+
)
|
|
34
|
+
query: Optional[Union[str, TemplateString]] = None # User query/message
|
|
35
|
+
context: Optional[Union[str, TemplateString]] = None # Additional context
|
|
36
|
+
|
|
37
|
+
# LLM configuration parameters
|
|
38
|
+
model: Optional[Union[str, TemplateString]] = None # LLM model to use
|
|
39
|
+
tools: Optional[List[Tool]] = None # Available tools for the LLM
|
|
40
|
+
response_format: Optional[Union[Dict[str, Any], TemplateString]] = (
|
|
41
|
+
None # Response format specification
|
|
42
|
+
)
|
|
43
|
+
max_tokens: Optional[Union[int, TemplateString]] = (
|
|
44
|
+
None # Maximum tokens in response
|
|
45
|
+
)
|
|
46
|
+
metadata: Optional[Union[Dict[str, Any], TemplateString]] = (
|
|
47
|
+
None # Additional metadata
|
|
48
|
+
)
|
|
49
|
+
disable_tools: Optional[Union[bool, TemplateString]] = (
|
|
50
|
+
None # Whether to disable tools for this message
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def message(
|
|
55
|
+
system_prompt: Optional[Union[str, TemplateString]] = None,
|
|
56
|
+
message_history: Optional[Union[List[Dict[str, Any]], TemplateString]] = None,
|
|
57
|
+
query: Optional[Union[str, TemplateString]] = None,
|
|
58
|
+
context: Optional[Union[str, TemplateString]] = None,
|
|
59
|
+
model: Optional[Union[str, TemplateString]] = None,
|
|
60
|
+
tools: Optional[List[Tool]] = None,
|
|
61
|
+
response_format: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
62
|
+
max_tokens: Optional[Union[int, TemplateString]] = None,
|
|
63
|
+
metadata: Optional[Union[Dict[str, Any], TemplateString]] = None,
|
|
64
|
+
disable_tools: Optional[Union[bool, TemplateString]] = None,
|
|
65
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
66
|
+
) -> MessageParams:
|
|
67
|
+
"""Generate LLM message with bot-compatible parameters
|
|
68
|
+
|
|
69
|
+
This function accepts the same parameters that bot definitions use,
|
|
70
|
+
making it compatible with exported bot code.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
system_prompt: System prompt for the conversation
|
|
74
|
+
message_history: Previous messages in the conversation
|
|
75
|
+
query: User query/message
|
|
76
|
+
context: Additional context
|
|
77
|
+
model: LLM model to use
|
|
78
|
+
tools: Available tools for the LLM
|
|
79
|
+
response_format: Response format specification
|
|
80
|
+
max_tokens: Maximum tokens in response
|
|
81
|
+
metadata: Additional metadata
|
|
82
|
+
disable_tools: Whether to disable tools for this message
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
MessageParams: Type-safe parameter object
|
|
86
|
+
"""
|
|
87
|
+
params = {
|
|
88
|
+
"system_prompt": system_prompt,
|
|
89
|
+
"message_history": message_history,
|
|
90
|
+
"query": query,
|
|
91
|
+
"context": context,
|
|
92
|
+
"model": model,
|
|
93
|
+
"tools": tools,
|
|
94
|
+
"response_format": response_format,
|
|
95
|
+
"max_tokens": max_tokens,
|
|
96
|
+
"metadata": metadata,
|
|
97
|
+
"disable_tools": disable_tools,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Remove None values for optional parameters
|
|
101
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
102
|
+
|
|
103
|
+
# Use normal constructor for proper validation
|
|
104
|
+
return MessageParams(**params)
|