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.
Files changed (48) hide show
  1. erdo/__init__.py +35 -0
  2. erdo/_generated/__init__.py +18 -0
  3. erdo/_generated/actions/__init__.py +34 -0
  4. erdo/_generated/actions/analysis.py +179 -0
  5. erdo/_generated/actions/bot.py +186 -0
  6. erdo/_generated/actions/codeexec.py +199 -0
  7. erdo/_generated/actions/llm.py +148 -0
  8. erdo/_generated/actions/memory.py +463 -0
  9. erdo/_generated/actions/pdfextractor.py +97 -0
  10. erdo/_generated/actions/resource_definitions.py +296 -0
  11. erdo/_generated/actions/sqlexec.py +90 -0
  12. erdo/_generated/actions/utils.py +475 -0
  13. erdo/_generated/actions/webparser.py +119 -0
  14. erdo/_generated/actions/websearch.py +85 -0
  15. erdo/_generated/condition/__init__.py +556 -0
  16. erdo/_generated/internal.py +51 -0
  17. erdo/_generated/internal_actions.py +91 -0
  18. erdo/_generated/parameters.py +17 -0
  19. erdo/_generated/secrets.py +17 -0
  20. erdo/_generated/template_functions.py +55 -0
  21. erdo/_generated/types.py +3907 -0
  22. erdo/actions/__init__.py +40 -0
  23. erdo/bot_permissions.py +266 -0
  24. erdo/cli_entry.py +73 -0
  25. erdo/conditions/__init__.py +11 -0
  26. erdo/config/__init__.py +5 -0
  27. erdo/config/config.py +140 -0
  28. erdo/formatting.py +279 -0
  29. erdo/install_cli.py +140 -0
  30. erdo/integrations.py +131 -0
  31. erdo/invoke/__init__.py +11 -0
  32. erdo/invoke/client.py +234 -0
  33. erdo/invoke/invoke.py +555 -0
  34. erdo/state.py +376 -0
  35. erdo/sync/__init__.py +17 -0
  36. erdo/sync/client.py +95 -0
  37. erdo/sync/extractor.py +492 -0
  38. erdo/sync/sync.py +327 -0
  39. erdo/template.py +136 -0
  40. erdo/test/__init__.py +41 -0
  41. erdo/test/evaluate.py +272 -0
  42. erdo/test/runner.py +263 -0
  43. erdo/types.py +1431 -0
  44. erdo-0.1.31.dist-info/METADATA +471 -0
  45. erdo-0.1.31.dist-info/RECORD +48 -0
  46. erdo-0.1.31.dist-info/WHEEL +4 -0
  47. erdo-0.1.31.dist-info/entry_points.txt +2 -0
  48. erdo-0.1.31.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,475 @@
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, 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 EchoParams(BaseActionParams):
29
+ """Echo parameters back as output parameters"""
30
+
31
+ name: str = "utils.echo" # Action type for roundtrip compatibility
32
+ data: Optional[Any] = None # data parameter
33
+
34
+
35
+ class ParseJsonParams(BaseActionParams):
36
+ """Parse JSON string and validate required keys parameters"""
37
+
38
+ model_config = {"populate_by_name": True} # Allow both field names and aliases
39
+
40
+ name: str = "utils.parse_json" # Action type for roundtrip compatibility
41
+ json_data: Optional[Union[str, TemplateString]] = Field(
42
+ default=None, alias="json"
43
+ ) # json parameter
44
+ required_keys: Optional[Any] = None # required_keys parameter
45
+
46
+
47
+ class ConcatParams(BaseActionParams):
48
+ """Concatenate arrays or strings from specified keys parameters"""
49
+
50
+ name: str = "utils.concat" # Action type for roundtrip compatibility
51
+ concat: Optional[Any] = None # concat parameter
52
+ data: Optional[Any] = None # data parameter
53
+
54
+
55
+ class CastParams(BaseActionParams):
56
+ """Cast string values to different types (string, integer, float, bool) parameters"""
57
+
58
+ model_config = {"populate_by_name": True} # Allow both field names and aliases
59
+
60
+ name: str = "utils.cast" # Action type for roundtrip compatibility
61
+ value: Optional[Union[str, TemplateString]] = None # value parameter
62
+ type_name: Optional[Union[str, TemplateString]] = Field(
63
+ default=None, alias="type"
64
+ ) # type parameter
65
+
66
+
67
+ class RaiseParams(BaseActionParams):
68
+ """Raise a status with message and parameters parameters"""
69
+
70
+ name: str = "utils.raise" # Action type for roundtrip compatibility
71
+ status: Optional[Union[str, TemplateString]] = None # status parameter
72
+ message: Optional[Union[str, TemplateString]] = None # message parameter
73
+ parameters: Optional[Any] = None # parameters parameter
74
+
75
+
76
+ class CaptureExceptionParams(BaseActionParams):
77
+ """Capture an exception to Sentry and return an error result parameters"""
78
+
79
+ name: str = "utils.capture_exception" # Action type for roundtrip compatibility
80
+ exception: Optional[Union[str, TemplateString]] = None # exception parameter
81
+ message: Optional[Union[str, TemplateString]] = None # message parameter
82
+ error_type: Optional[Union[str, TemplateString]] = None # error_type parameter
83
+
84
+
85
+ class SendStatusParams(BaseActionParams):
86
+ """Send a status event to the client parameters"""
87
+
88
+ name: str = "utils.send_status" # Action type for roundtrip compatibility
89
+ status: Optional[Union[str, TemplateString]] = None # status parameter
90
+ message: Optional[Union[str, TemplateString]] = None # message parameter
91
+ details: Optional[Any] = None # details parameter
92
+
93
+
94
+ class WriteParams(BaseActionParams):
95
+ """Write output message with specified content types parameters"""
96
+
97
+ name: str = "utils.write" # Action type for roundtrip compatibility
98
+ message: Optional[Union[str, TemplateString]] = None # message parameter
99
+ content_type: Optional[Union[str, TemplateString]] = None # content_type parameter
100
+ history_content_type: Optional[Union[str, TemplateString]] = (
101
+ None # history_content_type parameter
102
+ )
103
+ ui_content_type: Optional[Union[str, TemplateString]] = (
104
+ None # ui_content_type parameter
105
+ )
106
+ output_channels: Optional[Any] = None # output_channels parameter
107
+
108
+
109
+ class ProcessIntegrationQueriesParams(BaseActionParams):
110
+ """Process integration queries to create resource-specific search queries parameters"""
111
+
112
+ name: str = (
113
+ "utils.process_integration_queries" # Action type for roundtrip compatibility
114
+ )
115
+ query: Optional[Union[str, TemplateString]] = None # query parameter
116
+ resource: Optional[Any] = None # resource parameter
117
+ queries: Optional[Any] = None # queries parameter
118
+
119
+
120
+ class EchoResult(BaseModel):
121
+ """Echo parameters back as output result type
122
+
123
+ Generic result schema for utils.echo action.
124
+ """
125
+
126
+ success: bool = True # Whether the action was successful
127
+
128
+ class Config:
129
+ extra = "allow" # Allow additional fields dynamically
130
+
131
+
132
+ class ParseJsonResult(BaseModel):
133
+ """Parse JSON string and validate required keys result type
134
+
135
+ Generic result schema for utils.parse_json action.
136
+ """
137
+
138
+ success: bool = True # Whether the action was successful
139
+
140
+ class Config:
141
+ extra = "allow" # Allow additional fields dynamically
142
+
143
+
144
+ class ConcatResult(BaseModel):
145
+ """Concatenate arrays or strings from specified keys result type
146
+
147
+ Generic result schema for utils.concat action.
148
+ """
149
+
150
+ success: bool = True # Whether the action was successful
151
+
152
+ class Config:
153
+ extra = "allow" # Allow additional fields dynamically
154
+
155
+
156
+ class CastResult(BaseModel):
157
+ """Cast string values to different types (string, integer, float, bool) result type
158
+
159
+ Generic result schema for utils.cast action.
160
+ """
161
+
162
+ success: bool = True # Whether the action was successful
163
+
164
+ class Config:
165
+ extra = "allow" # Allow additional fields dynamically
166
+
167
+
168
+ class RaiseResult(BaseModel):
169
+ """Raise a status with message and parameters result type
170
+
171
+ Generic result schema for utils.raise action.
172
+ """
173
+
174
+ success: bool = True # Whether the action was successful
175
+
176
+ class Config:
177
+ extra = "allow" # Allow additional fields dynamically
178
+
179
+
180
+ class CaptureExceptionResult(BaseModel):
181
+ """Capture an exception to Sentry and return an error result result type
182
+
183
+ Generic result schema for utils.capture_exception action.
184
+ """
185
+
186
+ success: bool = True # Whether the action was successful
187
+
188
+ class Config:
189
+ extra = "allow" # Allow additional fields dynamically
190
+
191
+
192
+ class SendStatusResult(BaseModel):
193
+ """Send a status event to the client result type
194
+
195
+ Generic result schema for utils.send_status action.
196
+ """
197
+
198
+ success: bool = True # Whether the action was successful
199
+
200
+ class Config:
201
+ extra = "allow" # Allow additional fields dynamically
202
+
203
+
204
+ class WriteResult(BaseModel):
205
+ """Write output message with specified content types result type
206
+
207
+ Generic result schema for utils.write action.
208
+ """
209
+
210
+ success: bool = True # Whether the action was successful
211
+
212
+ class Config:
213
+ extra = "allow" # Allow additional fields dynamically
214
+
215
+
216
+ class ProcessIntegrationQueriesResult(BaseModel):
217
+ """Process integration queries to create resource-specific search queries result type
218
+
219
+ Generic result schema for utils.process_integration_queries action.
220
+ """
221
+
222
+ success: bool = True # Whether the action was successful
223
+
224
+ class Config:
225
+ extra = "allow" # Allow additional fields dynamically
226
+
227
+
228
+ def echo(data: Optional[Any] = None, **params: Any) -> EchoParams:
229
+ """Echo parameters back as output
230
+
231
+ Args:
232
+ data: data parameter
233
+
234
+ Returns:
235
+ EchoParams: Type-safe parameter object
236
+ """
237
+ param_dict = {
238
+ "data": data,
239
+ }
240
+ # Remove None values for optional parameters
241
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
242
+ param_dict.update(params)
243
+ params_obj = EchoParams(**param_dict)
244
+ return params_obj
245
+
246
+
247
+ def parse_json(
248
+ json_data: Optional[Union[str, TemplateString]] = None,
249
+ required_keys: Optional[Any] = None,
250
+ **params: Any,
251
+ ) -> ParseJsonParams:
252
+ """Parse JSON string and validate required keys
253
+
254
+ Args:
255
+ json_data: json parameter
256
+ required_keys: required_keys parameter
257
+
258
+ Returns:
259
+ ParseJsonParams: Type-safe parameter object
260
+ """
261
+ param_dict = {
262
+ "json": json_data,
263
+ "required_keys": required_keys,
264
+ }
265
+ # Remove None values for optional parameters
266
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
267
+ param_dict.update(params)
268
+ params_obj = ParseJsonParams(**param_dict)
269
+ return params_obj
270
+
271
+
272
+ def concat(
273
+ concat: Optional[Any] = None, data: Optional[Any] = None, **params: Any
274
+ ) -> ConcatParams:
275
+ """Concatenate arrays or strings from specified keys
276
+
277
+ Args:
278
+ concat: concat parameter
279
+ data: data parameter
280
+
281
+ Returns:
282
+ ConcatParams: Type-safe parameter object
283
+ """
284
+ param_dict = {
285
+ "concat": concat,
286
+ "data": data,
287
+ }
288
+ # Remove None values for optional parameters
289
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
290
+ param_dict.update(params)
291
+ params_obj = ConcatParams(**param_dict)
292
+ return params_obj
293
+
294
+
295
+ def cast(
296
+ value: Optional[Union[str, TemplateString]] = None,
297
+ type_name: Optional[Union[str, TemplateString]] = None,
298
+ **params: Any,
299
+ ) -> CastParams:
300
+ """Cast string values to different types (string, integer, float, bool)
301
+
302
+ Args:
303
+ value: value parameter
304
+ type_name: type parameter
305
+
306
+ Returns:
307
+ CastParams: Type-safe parameter object
308
+ """
309
+ param_dict = {
310
+ "value": value,
311
+ "type": type_name,
312
+ }
313
+ # Remove None values for optional parameters
314
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
315
+ param_dict.update(params)
316
+ params_obj = CastParams(**param_dict)
317
+ return params_obj
318
+
319
+
320
+ def raise_error(
321
+ status: Optional[Union[str, TemplateString]] = None,
322
+ message: Optional[Union[str, TemplateString]] = None,
323
+ parameters: Optional[Any] = None,
324
+ **params: Any,
325
+ ) -> RaiseParams:
326
+ """Raise a status with message and parameters
327
+
328
+ Args:
329
+ status: status parameter
330
+ message: message parameter
331
+ parameters: parameters parameter
332
+
333
+ Returns:
334
+ RaiseParams: Type-safe parameter object
335
+ """
336
+ param_dict = {
337
+ "status": status,
338
+ "message": message,
339
+ "parameters": parameters,
340
+ }
341
+ # Remove None values for optional parameters
342
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
343
+ param_dict.update(params)
344
+ params_obj = RaiseParams(**param_dict)
345
+ return params_obj
346
+
347
+
348
+ def capture_exception(
349
+ exception: Optional[Union[str, TemplateString]] = None,
350
+ message: Optional[Union[str, TemplateString]] = None,
351
+ error_type: Optional[Union[str, TemplateString]] = None,
352
+ **params: Any,
353
+ ) -> CaptureExceptionParams:
354
+ """Capture an exception to Sentry and return an error result
355
+
356
+ Args:
357
+ exception: exception parameter
358
+ message: message parameter
359
+ error_type: error_type parameter
360
+
361
+ Returns:
362
+ CaptureExceptionParams: Type-safe parameter object
363
+ """
364
+ param_dict = {
365
+ "exception": exception,
366
+ "message": message,
367
+ "error_type": error_type,
368
+ }
369
+ # Remove None values for optional parameters
370
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
371
+ param_dict.update(params)
372
+ params_obj = CaptureExceptionParams(**param_dict)
373
+ return params_obj
374
+
375
+
376
+ def send_status(
377
+ status: Optional[Union[str, TemplateString]] = None,
378
+ message: Optional[Union[str, TemplateString]] = None,
379
+ details: Optional[Any] = None,
380
+ **params: Any,
381
+ ) -> SendStatusParams:
382
+ """Send a status event to the client
383
+
384
+ Args:
385
+ status: status parameter
386
+ message: message parameter
387
+ details: details parameter
388
+
389
+ Returns:
390
+ SendStatusParams: Type-safe parameter object
391
+ """
392
+ param_dict = {
393
+ "status": status,
394
+ "message": message,
395
+ "details": details,
396
+ }
397
+ # Remove None values for optional parameters
398
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
399
+ param_dict.update(params)
400
+ params_obj = SendStatusParams(**param_dict)
401
+ return params_obj
402
+
403
+
404
+ def write(
405
+ message: Optional[Union[str, TemplateString]] = None,
406
+ content_type: Optional[Union[str, TemplateString]] = None,
407
+ history_content_type: Optional[Union[str, TemplateString]] = None,
408
+ ui_content_type: Optional[Union[str, TemplateString]] = None,
409
+ output_channels: Optional[Any] = None,
410
+ **params: Any,
411
+ ) -> WriteParams:
412
+ """Write output message with specified content types
413
+
414
+ Args:
415
+ message: message parameter
416
+ content_type: content_type parameter
417
+ history_content_type: history_content_type parameter
418
+ ui_content_type: ui_content_type parameter
419
+ output_channels: output_channels parameter
420
+
421
+ Returns:
422
+ WriteParams: Type-safe parameter object
423
+ """
424
+ param_dict = {
425
+ "message": message,
426
+ "content_type": content_type,
427
+ "history_content_type": history_content_type,
428
+ "ui_content_type": ui_content_type,
429
+ "output_channels": output_channels,
430
+ }
431
+ # Remove None values for optional parameters
432
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
433
+ param_dict.update(params)
434
+ params_obj = WriteParams(**param_dict)
435
+ return params_obj
436
+
437
+
438
+ def process_integration_queries(
439
+ query: Optional[Union[str, TemplateString]] = None,
440
+ resource: Optional[Any] = None,
441
+ queries: Optional[Any] = None,
442
+ **params: Any,
443
+ ) -> ProcessIntegrationQueriesParams:
444
+ """Process integration queries to create resource-specific search queries
445
+
446
+ Args:
447
+ query: query parameter
448
+ resource: resource parameter
449
+ queries: queries parameter
450
+
451
+ Returns:
452
+ ProcessIntegrationQueriesParams: Type-safe parameter object
453
+ """
454
+ param_dict = {
455
+ "query": query,
456
+ "resource": resource,
457
+ "queries": queries,
458
+ }
459
+ # Remove None values for optional parameters
460
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
461
+ param_dict.update(params)
462
+ params_obj = ProcessIntegrationQueriesParams(**param_dict)
463
+ return params_obj
464
+
465
+
466
+ # Associate parameter classes with their result types
467
+ EchoParams._result = EchoResult
468
+ ParseJsonParams._result = ParseJsonResult
469
+ ConcatParams._result = ConcatResult
470
+ CastParams._result = CastResult
471
+ RaiseParams._result = RaiseResult
472
+ CaptureExceptionParams._result = CaptureExceptionResult
473
+ SendStatusParams._result = SendStatusResult
474
+ WriteParams._result = WriteResult
475
+ ProcessIntegrationQueriesParams._result = ProcessIntegrationQueriesResult
@@ -0,0 +1,119 @@
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
+
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 ParseParams(BaseActionParams):
29
+ """Parse website content using Jina's reader API to extract text, images, and links parameters"""
30
+
31
+ name: str = "webparser.parse" # Action type for roundtrip compatibility
32
+ url: Optional[Union[str, TemplateString]] = None # url parameter
33
+ include_images: Optional[Union[bool, TemplateString]] = (
34
+ None # include_images parameter
35
+ )
36
+ include_links: Optional[Union[bool, TemplateString]] = (
37
+ None # include_links parameter
38
+ )
39
+ remove_selector: Optional[Union[str, TemplateString]] = (
40
+ None # remove_selector parameter
41
+ )
42
+ target_selector: Optional[Union[str, TemplateString]] = (
43
+ None # target_selector parameter
44
+ )
45
+ wait_for_selector: Optional[Union[str, TemplateString]] = (
46
+ None # wait_for_selector parameter
47
+ )
48
+ generate_image_alt: Optional[Union[bool, TemplateString]] = (
49
+ None # generate_image_alt parameter
50
+ )
51
+ return_format: Optional[Union[str, TemplateString]] = (
52
+ None # return_format parameter
53
+ )
54
+ timeout: Optional[Union[int, TemplateString]] = None # timeout parameter
55
+ no_cache: Optional[Union[bool, TemplateString]] = None # no_cache parameter
56
+
57
+
58
+ class ParseResult(BaseModel):
59
+ """Parse website content using Jina's reader API to extract text, images, and links result type
60
+
61
+ Result schema for webparser.parse action.
62
+ """
63
+
64
+ content: str
65
+ title: Optional[str]
66
+ metadata: Optional[Any]
67
+
68
+
69
+ def parse(
70
+ url: Optional[Union[str, TemplateString]] = None,
71
+ include_images: Optional[Union[bool, TemplateString]] = None,
72
+ include_links: Optional[Union[bool, TemplateString]] = None,
73
+ remove_selector: Optional[Union[str, TemplateString]] = None,
74
+ target_selector: Optional[Union[str, TemplateString]] = None,
75
+ wait_for_selector: Optional[Union[str, TemplateString]] = None,
76
+ generate_image_alt: Optional[Union[bool, TemplateString]] = None,
77
+ return_format: Optional[Union[str, TemplateString]] = None,
78
+ timeout: Optional[Union[int, TemplateString]] = None,
79
+ no_cache: Optional[Union[bool, TemplateString]] = None,
80
+ **params: Any,
81
+ ) -> ParseParams:
82
+ """Parse website content using Jina's reader API to extract text, images, and links
83
+
84
+ Args:
85
+ url: url parameter
86
+ include_images: include_images parameter
87
+ include_links: include_links parameter
88
+ remove_selector: remove_selector parameter
89
+ target_selector: target_selector parameter
90
+ wait_for_selector: wait_for_selector parameter
91
+ generate_image_alt: generate_image_alt parameter
92
+ return_format: return_format parameter
93
+ timeout: timeout parameter
94
+ no_cache: no_cache parameter
95
+
96
+ Returns:
97
+ ParseParams: Type-safe parameter object
98
+ """
99
+ param_dict = {
100
+ "url": url,
101
+ "include_images": include_images,
102
+ "include_links": include_links,
103
+ "remove_selector": remove_selector,
104
+ "target_selector": target_selector,
105
+ "wait_for_selector": wait_for_selector,
106
+ "generate_image_alt": generate_image_alt,
107
+ "return_format": return_format,
108
+ "timeout": timeout,
109
+ "no_cache": no_cache,
110
+ }
111
+ # Remove None values for optional parameters
112
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
113
+ param_dict.update(params)
114
+ params_obj = ParseParams(**param_dict)
115
+ return params_obj
116
+
117
+
118
+ # Associate parameter classes with their result types
119
+ ParseParams._result = ParseResult
@@ -0,0 +1,85 @@
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
+
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 SearchParams(BaseActionParams):
29
+ """Search the web using Jina's search API and return relevant results parameters"""
30
+
31
+ name: str = "websearch.search" # Action type for roundtrip compatibility
32
+ query: Optional[Union[str, TemplateString]] = None # query parameter
33
+ language: Optional[Union[str, TemplateString]] = None # language parameter
34
+ country: Optional[Union[str, TemplateString]] = None # country parameter
35
+ location: Optional[Union[str, TemplateString]] = None # location parameter
36
+ num_results: Optional[Union[int, TemplateString]] = None # num_results parameter
37
+
38
+
39
+ class SearchResult(BaseModel):
40
+ """Search the web using Jina's search API and return relevant results result type
41
+
42
+ Result schema for websearch.search action.
43
+ """
44
+
45
+ results: List[Any]
46
+ total_results: Optional[float]
47
+ query: Optional[str]
48
+
49
+
50
+ def search(
51
+ query: Optional[Union[str, TemplateString]] = None,
52
+ language: Optional[Union[str, TemplateString]] = None,
53
+ country: Optional[Union[str, TemplateString]] = None,
54
+ location: Optional[Union[str, TemplateString]] = None,
55
+ num_results: Optional[Union[int, TemplateString]] = None,
56
+ **params: Any,
57
+ ) -> SearchParams:
58
+ """Search the web using Jina's search API and return relevant results
59
+
60
+ Args:
61
+ query: query parameter
62
+ language: language parameter
63
+ country: country parameter
64
+ location: location parameter
65
+ num_results: num_results parameter
66
+
67
+ Returns:
68
+ SearchParams: Type-safe parameter object
69
+ """
70
+ param_dict = {
71
+ "query": query,
72
+ "language": language,
73
+ "country": country,
74
+ "location": location,
75
+ "num_results": num_results,
76
+ }
77
+ # Remove None values for optional parameters
78
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
79
+ param_dict.update(params)
80
+ params_obj = SearchParams(**param_dict)
81
+ return params_obj
82
+
83
+
84
+ # Associate parameter classes with their result types
85
+ SearchParams._result = SearchResult