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
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Basic utility actions for data manipulation and control flow service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for utils 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, Field
|
|
12
|
+
|
|
13
|
+
from erdo.template import TemplateString
|
|
14
|
+
from erdo.types import StepMetadata
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class EchoParams(BaseModel):
|
|
18
|
+
"""Echo parameters back as output parameters"""
|
|
19
|
+
|
|
20
|
+
name: str = "utils.echo" # Action type for roundtrip compatibility
|
|
21
|
+
data: Optional[Any] = None # data parameter
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ParseJsonParams(BaseModel):
|
|
25
|
+
"""Parse JSON string and validate required keys parameters"""
|
|
26
|
+
|
|
27
|
+
model_config = {"populate_by_name": True} # Allow both field names and aliases
|
|
28
|
+
|
|
29
|
+
name: str = "utils.parse_json" # Action type for roundtrip compatibility
|
|
30
|
+
json_data: Optional[Union[str, TemplateString]] = Field(
|
|
31
|
+
default=None, alias="json"
|
|
32
|
+
) # json parameter
|
|
33
|
+
required_keys: Optional[Any] = None # required_keys parameter
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ConcatParams(BaseModel):
|
|
37
|
+
"""Concatenate arrays or strings from specified keys parameters"""
|
|
38
|
+
|
|
39
|
+
name: str = "utils.concat" # Action type for roundtrip compatibility
|
|
40
|
+
concat: Optional[Any] = None # concat parameter
|
|
41
|
+
data: Optional[Any] = None # data parameter
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class CastParams(BaseModel):
|
|
45
|
+
"""Cast string values to different types (string, integer, float, bool) parameters"""
|
|
46
|
+
|
|
47
|
+
model_config = {"populate_by_name": True} # Allow both field names and aliases
|
|
48
|
+
|
|
49
|
+
name: str = "utils.cast" # Action type for roundtrip compatibility
|
|
50
|
+
value: Optional[Union[str, TemplateString]] = None # value parameter
|
|
51
|
+
type_name: Optional[Union[str, TemplateString]] = Field(
|
|
52
|
+
default=None, alias="type"
|
|
53
|
+
) # type parameter
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class RaiseParams(BaseModel):
|
|
57
|
+
"""Raise a status with message and parameters parameters"""
|
|
58
|
+
|
|
59
|
+
name: str = "utils.raise" # Action type for roundtrip compatibility
|
|
60
|
+
status: Optional[Union[str, TemplateString]] = None # status parameter
|
|
61
|
+
message: Optional[Union[str, TemplateString]] = None # message parameter
|
|
62
|
+
parameters: Optional[Any] = None # parameters parameter
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class CaptureExceptionParams(BaseModel):
|
|
66
|
+
"""Capture an exception to Sentry and return an error result parameters"""
|
|
67
|
+
|
|
68
|
+
name: str = "utils.capture_exception" # Action type for roundtrip compatibility
|
|
69
|
+
exception: Optional[Union[str, TemplateString]] = None # exception parameter
|
|
70
|
+
message: Optional[Union[str, TemplateString]] = None # message parameter
|
|
71
|
+
error_type: Optional[Union[str, TemplateString]] = None # error_type parameter
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class SendStatusParams(BaseModel):
|
|
75
|
+
"""Send a status event to the client parameters"""
|
|
76
|
+
|
|
77
|
+
name: str = "utils.send_status" # Action type for roundtrip compatibility
|
|
78
|
+
status: Optional[Union[str, TemplateString]] = None # status parameter
|
|
79
|
+
message: Optional[Union[str, TemplateString]] = None # message parameter
|
|
80
|
+
details: Optional[Any] = None # details parameter
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class WriteParams(BaseModel):
|
|
84
|
+
"""Write output message with specified content types parameters"""
|
|
85
|
+
|
|
86
|
+
name: str = "utils.write" # Action type for roundtrip compatibility
|
|
87
|
+
message: Optional[Union[str, TemplateString]] = None # message parameter
|
|
88
|
+
content_type: Optional[Union[str, TemplateString]] = None # content_type parameter
|
|
89
|
+
history_content_type: Optional[Union[str, TemplateString]] = (
|
|
90
|
+
None # history_content_type parameter
|
|
91
|
+
)
|
|
92
|
+
ui_content_type: Optional[Union[str, TemplateString]] = (
|
|
93
|
+
None # ui_content_type parameter
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class EchoResult(BaseModel):
|
|
98
|
+
"""Echo parameters back as output result type
|
|
99
|
+
|
|
100
|
+
Result schema for utils.echo action.
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class ParseJsonResult(BaseModel):
|
|
107
|
+
"""Parse JSON string and validate required keys result type
|
|
108
|
+
|
|
109
|
+
Result schema for utils.parse_json action.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class ConcatResult(BaseModel):
|
|
116
|
+
"""Concatenate arrays or strings from specified keys result type
|
|
117
|
+
|
|
118
|
+
Result schema for utils.concat action.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class CastResult(BaseModel):
|
|
125
|
+
"""Cast string values to different types (string, integer, float, bool) result type
|
|
126
|
+
|
|
127
|
+
Result schema for utils.cast action.
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class RaiseResult(BaseModel):
|
|
134
|
+
"""Raise a status with message and parameters result type
|
|
135
|
+
|
|
136
|
+
Result schema for utils.raise action.
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class CaptureExceptionResult(BaseModel):
|
|
143
|
+
"""Capture an exception to Sentry and return an error result result type
|
|
144
|
+
|
|
145
|
+
Result schema for utils.capture_exception action.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class SendStatusResult(BaseModel):
|
|
152
|
+
"""Send a status event to the client result type
|
|
153
|
+
|
|
154
|
+
Result schema for utils.send_status action.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class WriteResult(BaseModel):
|
|
161
|
+
"""Write output message with specified content types result type
|
|
162
|
+
|
|
163
|
+
Result schema for utils.write action.
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
data: Optional[Dict[str, Any]] # Action result data
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def echo(
|
|
170
|
+
data: Optional[Any] = None,
|
|
171
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
172
|
+
**params: Any,
|
|
173
|
+
) -> EchoParams:
|
|
174
|
+
"""Echo parameters back as output
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
data: data parameter
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
EchoParams: Type-safe parameter object
|
|
181
|
+
"""
|
|
182
|
+
param_dict = {
|
|
183
|
+
"data": data,
|
|
184
|
+
}
|
|
185
|
+
# Remove None values for optional parameters
|
|
186
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
187
|
+
param_dict.update(params)
|
|
188
|
+
|
|
189
|
+
return EchoParams(**param_dict)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def parse_json(
|
|
193
|
+
json_data: Optional[Union[str, TemplateString]] = None,
|
|
194
|
+
required_keys: Optional[Any] = None,
|
|
195
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
196
|
+
**params: Any,
|
|
197
|
+
) -> ParseJsonParams:
|
|
198
|
+
"""Parse JSON string and validate required keys
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
json_data: json parameter
|
|
202
|
+
required_keys: required_keys parameter
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
ParseJsonParams: Type-safe parameter object
|
|
206
|
+
"""
|
|
207
|
+
param_dict = {
|
|
208
|
+
"json": json_data,
|
|
209
|
+
"required_keys": required_keys,
|
|
210
|
+
}
|
|
211
|
+
# Remove None values for optional parameters
|
|
212
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
213
|
+
param_dict.update(params)
|
|
214
|
+
|
|
215
|
+
return ParseJsonParams(**param_dict)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def concat(
|
|
219
|
+
concat: Optional[Any] = None,
|
|
220
|
+
data: Optional[Any] = None,
|
|
221
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
222
|
+
**params: Any,
|
|
223
|
+
) -> ConcatParams:
|
|
224
|
+
"""Concatenate arrays or strings from specified keys
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
concat: concat parameter
|
|
228
|
+
data: data parameter
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
ConcatParams: Type-safe parameter object
|
|
232
|
+
"""
|
|
233
|
+
param_dict = {
|
|
234
|
+
"concat": concat,
|
|
235
|
+
"data": data,
|
|
236
|
+
}
|
|
237
|
+
# Remove None values for optional parameters
|
|
238
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
239
|
+
param_dict.update(params)
|
|
240
|
+
|
|
241
|
+
return ConcatParams(**param_dict)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def cast(
|
|
245
|
+
value: Optional[Union[str, TemplateString]] = None,
|
|
246
|
+
type_name: Optional[Union[str, TemplateString]] = None,
|
|
247
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
248
|
+
**params: Any,
|
|
249
|
+
) -> CastParams:
|
|
250
|
+
"""Cast string values to different types (string, integer, float, bool)
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
value: value parameter
|
|
254
|
+
type_name: type parameter
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
CastParams: Type-safe parameter object
|
|
258
|
+
"""
|
|
259
|
+
param_dict = {
|
|
260
|
+
"value": value,
|
|
261
|
+
"type": type_name,
|
|
262
|
+
}
|
|
263
|
+
# Remove None values for optional parameters
|
|
264
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
265
|
+
param_dict.update(params)
|
|
266
|
+
|
|
267
|
+
return CastParams(**param_dict)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def raise_error(
|
|
271
|
+
status: Optional[Union[str, TemplateString]] = None,
|
|
272
|
+
message: Optional[Union[str, TemplateString]] = None,
|
|
273
|
+
parameters: Optional[Any] = None,
|
|
274
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
275
|
+
**params: Any,
|
|
276
|
+
) -> RaiseParams:
|
|
277
|
+
"""Raise a status with message and parameters
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
status: status parameter
|
|
281
|
+
message: message parameter
|
|
282
|
+
parameters: parameters parameter
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
RaiseParams: Type-safe parameter object
|
|
286
|
+
"""
|
|
287
|
+
param_dict = {
|
|
288
|
+
"status": status,
|
|
289
|
+
"message": message,
|
|
290
|
+
"parameters": parameters,
|
|
291
|
+
}
|
|
292
|
+
# Remove None values for optional parameters
|
|
293
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
294
|
+
param_dict.update(params)
|
|
295
|
+
|
|
296
|
+
return RaiseParams(**param_dict)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def capture_exception(
|
|
300
|
+
exception: Optional[Union[str, TemplateString]] = None,
|
|
301
|
+
message: Optional[Union[str, TemplateString]] = None,
|
|
302
|
+
error_type: Optional[Union[str, TemplateString]] = None,
|
|
303
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
304
|
+
**params: Any,
|
|
305
|
+
) -> CaptureExceptionParams:
|
|
306
|
+
"""Capture an exception to Sentry and return an error result
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
exception: exception parameter
|
|
310
|
+
message: message parameter
|
|
311
|
+
error_type: error_type parameter
|
|
312
|
+
|
|
313
|
+
Returns:
|
|
314
|
+
CaptureExceptionParams: Type-safe parameter object
|
|
315
|
+
"""
|
|
316
|
+
param_dict = {
|
|
317
|
+
"exception": exception,
|
|
318
|
+
"message": message,
|
|
319
|
+
"error_type": error_type,
|
|
320
|
+
}
|
|
321
|
+
# Remove None values for optional parameters
|
|
322
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
323
|
+
param_dict.update(params)
|
|
324
|
+
|
|
325
|
+
return CaptureExceptionParams(**param_dict)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def send_status(
|
|
329
|
+
status: Optional[Union[str, TemplateString]] = None,
|
|
330
|
+
message: Optional[Union[str, TemplateString]] = None,
|
|
331
|
+
details: Optional[Any] = None,
|
|
332
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
333
|
+
**params: Any,
|
|
334
|
+
) -> SendStatusParams:
|
|
335
|
+
"""Send a status event to the client
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
status: status parameter
|
|
339
|
+
message: message parameter
|
|
340
|
+
details: details parameter
|
|
341
|
+
|
|
342
|
+
Returns:
|
|
343
|
+
SendStatusParams: Type-safe parameter object
|
|
344
|
+
"""
|
|
345
|
+
param_dict = {
|
|
346
|
+
"status": status,
|
|
347
|
+
"message": message,
|
|
348
|
+
"details": details,
|
|
349
|
+
}
|
|
350
|
+
# Remove None values for optional parameters
|
|
351
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
352
|
+
param_dict.update(params)
|
|
353
|
+
|
|
354
|
+
return SendStatusParams(**param_dict)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def write(
|
|
358
|
+
message: Optional[Union[str, TemplateString]] = None,
|
|
359
|
+
content_type: Optional[Union[str, TemplateString]] = None,
|
|
360
|
+
history_content_type: Optional[Union[str, TemplateString]] = None,
|
|
361
|
+
ui_content_type: Optional[Union[str, TemplateString]] = None,
|
|
362
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
363
|
+
**params: Any,
|
|
364
|
+
) -> WriteParams:
|
|
365
|
+
"""Write output message with specified content types
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
message: message parameter
|
|
369
|
+
content_type: content_type parameter
|
|
370
|
+
history_content_type: history_content_type parameter
|
|
371
|
+
ui_content_type: ui_content_type parameter
|
|
372
|
+
|
|
373
|
+
Returns:
|
|
374
|
+
WriteParams: Type-safe parameter object
|
|
375
|
+
"""
|
|
376
|
+
param_dict = {
|
|
377
|
+
"message": message,
|
|
378
|
+
"content_type": content_type,
|
|
379
|
+
"history_content_type": history_content_type,
|
|
380
|
+
"ui_content_type": ui_content_type,
|
|
381
|
+
}
|
|
382
|
+
# Remove None values for optional parameters
|
|
383
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
384
|
+
param_dict.update(params)
|
|
385
|
+
|
|
386
|
+
return WriteParams(**param_dict)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
# Associate parameter classes with their result types
|
|
390
|
+
EchoParams._result = EchoResult
|
|
391
|
+
ParseJsonParams._result = ParseJsonResult
|
|
392
|
+
ConcatParams._result = ConcatResult
|
|
393
|
+
CastParams._result = CastResult
|
|
394
|
+
RaiseParams._result = RaiseResult
|
|
395
|
+
CaptureExceptionParams._result = CaptureExceptionResult
|
|
396
|
+
SendStatusParams._result = SendStatusResult
|
|
397
|
+
WriteParams._result = WriteResult
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Web parsing actions for extracting content from websites service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for webparser 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
|
|
12
|
+
|
|
13
|
+
from erdo.template import TemplateString
|
|
14
|
+
from erdo.types import StepMetadata
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ParseParams(BaseModel):
|
|
18
|
+
"""Parse website content using Jina's reader API to extract text, images, and links parameters"""
|
|
19
|
+
|
|
20
|
+
name: str = "webparser.parse" # Action type for roundtrip compatibility
|
|
21
|
+
url: Optional[Union[str, TemplateString]] = None # url parameter
|
|
22
|
+
include_images: Optional[Union[bool, TemplateString]] = (
|
|
23
|
+
None # include_images parameter
|
|
24
|
+
)
|
|
25
|
+
include_links: Optional[Union[bool, TemplateString]] = (
|
|
26
|
+
None # include_links parameter
|
|
27
|
+
)
|
|
28
|
+
remove_selector: Optional[Union[str, TemplateString]] = (
|
|
29
|
+
None # remove_selector parameter
|
|
30
|
+
)
|
|
31
|
+
target_selector: Optional[Union[str, TemplateString]] = (
|
|
32
|
+
None # target_selector parameter
|
|
33
|
+
)
|
|
34
|
+
wait_for_selector: Optional[Union[str, TemplateString]] = (
|
|
35
|
+
None # wait_for_selector parameter
|
|
36
|
+
)
|
|
37
|
+
generate_image_alt: Optional[Union[bool, TemplateString]] = (
|
|
38
|
+
None # generate_image_alt parameter
|
|
39
|
+
)
|
|
40
|
+
return_format: Optional[Union[str, TemplateString]] = (
|
|
41
|
+
None # return_format parameter
|
|
42
|
+
)
|
|
43
|
+
timeout: Optional[Union[int, TemplateString]] = None # timeout parameter
|
|
44
|
+
no_cache: Optional[Union[bool, TemplateString]] = None # no_cache parameter
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ParseResult(BaseModel):
|
|
48
|
+
"""Parse website content using Jina's reader API to extract text, images, and links result type
|
|
49
|
+
|
|
50
|
+
Result schema for webparser.parse action.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
content: str
|
|
54
|
+
title: Optional[str]
|
|
55
|
+
metadata: Optional[Any]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def parse(
|
|
59
|
+
url: Optional[Union[str, TemplateString]] = None,
|
|
60
|
+
include_images: Optional[Union[bool, TemplateString]] = None,
|
|
61
|
+
include_links: Optional[Union[bool, TemplateString]] = None,
|
|
62
|
+
remove_selector: Optional[Union[str, TemplateString]] = None,
|
|
63
|
+
target_selector: Optional[Union[str, TemplateString]] = None,
|
|
64
|
+
wait_for_selector: Optional[Union[str, TemplateString]] = None,
|
|
65
|
+
generate_image_alt: Optional[Union[bool, TemplateString]] = None,
|
|
66
|
+
return_format: Optional[Union[str, TemplateString]] = None,
|
|
67
|
+
timeout: Optional[Union[int, TemplateString]] = None,
|
|
68
|
+
no_cache: Optional[Union[bool, TemplateString]] = None,
|
|
69
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
70
|
+
**params: Any,
|
|
71
|
+
) -> ParseParams:
|
|
72
|
+
"""Parse website content using Jina's reader API to extract text, images, and links
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
url: url parameter
|
|
76
|
+
include_images: include_images parameter
|
|
77
|
+
include_links: include_links parameter
|
|
78
|
+
remove_selector: remove_selector parameter
|
|
79
|
+
target_selector: target_selector parameter
|
|
80
|
+
wait_for_selector: wait_for_selector parameter
|
|
81
|
+
generate_image_alt: generate_image_alt parameter
|
|
82
|
+
return_format: return_format parameter
|
|
83
|
+
timeout: timeout parameter
|
|
84
|
+
no_cache: no_cache parameter
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
ParseParams: Type-safe parameter object
|
|
88
|
+
"""
|
|
89
|
+
param_dict = {
|
|
90
|
+
"url": url,
|
|
91
|
+
"include_images": include_images,
|
|
92
|
+
"include_links": include_links,
|
|
93
|
+
"remove_selector": remove_selector,
|
|
94
|
+
"target_selector": target_selector,
|
|
95
|
+
"wait_for_selector": wait_for_selector,
|
|
96
|
+
"generate_image_alt": generate_image_alt,
|
|
97
|
+
"return_format": return_format,
|
|
98
|
+
"timeout": timeout,
|
|
99
|
+
"no_cache": no_cache,
|
|
100
|
+
}
|
|
101
|
+
# Remove None values for optional parameters
|
|
102
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
103
|
+
param_dict.update(params)
|
|
104
|
+
|
|
105
|
+
return ParseParams(**param_dict)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# Associate parameter classes with their result types
|
|
109
|
+
ParseParams._result = ParseResult
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Web search actions for finding information on the internet service functions.
|
|
3
|
+
Auto-generated - DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
Provides type-safe action definitions for websearch 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 SearchParams(BaseModel):
|
|
18
|
+
"""Search the web using Jina's search API and return relevant results parameters"""
|
|
19
|
+
|
|
20
|
+
name: str = "websearch.search" # Action type for roundtrip compatibility
|
|
21
|
+
query: Optional[Union[str, TemplateString]] = None # query parameter
|
|
22
|
+
language: Optional[Union[str, TemplateString]] = None # language parameter
|
|
23
|
+
country: Optional[Union[str, TemplateString]] = None # country parameter
|
|
24
|
+
location: Optional[Union[str, TemplateString]] = None # location parameter
|
|
25
|
+
num_results: Optional[Union[int, TemplateString]] = None # num_results parameter
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SearchResult(BaseModel):
|
|
29
|
+
"""Search the web using Jina's search API and return relevant results result type
|
|
30
|
+
|
|
31
|
+
Result schema for websearch.search action.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
results: List[Any]
|
|
35
|
+
total_results: Optional[float]
|
|
36
|
+
query: Optional[str]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def search(
|
|
40
|
+
query: Optional[Union[str, TemplateString]] = None,
|
|
41
|
+
language: Optional[Union[str, TemplateString]] = None,
|
|
42
|
+
country: Optional[Union[str, TemplateString]] = None,
|
|
43
|
+
location: Optional[Union[str, TemplateString]] = None,
|
|
44
|
+
num_results: Optional[Union[int, TemplateString]] = None,
|
|
45
|
+
step_metadata: Optional[StepMetadata] = None,
|
|
46
|
+
**params: Any,
|
|
47
|
+
) -> SearchParams:
|
|
48
|
+
"""Search the web using Jina's search API and return relevant results
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
query: query parameter
|
|
52
|
+
language: language parameter
|
|
53
|
+
country: country parameter
|
|
54
|
+
location: location parameter
|
|
55
|
+
num_results: num_results parameter
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
SearchParams: Type-safe parameter object
|
|
59
|
+
"""
|
|
60
|
+
param_dict = {
|
|
61
|
+
"query": query,
|
|
62
|
+
"language": language,
|
|
63
|
+
"country": country,
|
|
64
|
+
"location": location,
|
|
65
|
+
"num_results": num_results,
|
|
66
|
+
}
|
|
67
|
+
# Remove None values for optional parameters
|
|
68
|
+
param_dict = {k: v for k, v in param_dict.items() if v is not None}
|
|
69
|
+
param_dict.update(params)
|
|
70
|
+
|
|
71
|
+
return SearchParams(**param_dict)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Associate parameter classes with their result types
|
|
75
|
+
SearchParams._result = SearchResult
|