griptape-nodes 0.36.2__py3-none-any.whl → 0.37.1__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.
- griptape_nodes/__init__.py +68 -2
- griptape_nodes/app/__init__.py +1 -1
- griptape_nodes/app/app.py +6 -6
- griptape_nodes/app/app_websocket.py +8 -8
- griptape_nodes/exe_types/connections.py +32 -1
- griptape_nodes/exe_types/core_types.py +16 -0
- griptape_nodes/exe_types/flow.py +2 -2
- griptape_nodes/exe_types/node_types.py +207 -0
- griptape_nodes/retained_mode/events/agent_events.py +83 -0
- griptape_nodes/retained_mode/griptape_nodes.py +8 -0
- griptape_nodes/retained_mode/managers/agent_manager.py +103 -0
- griptape_nodes/retained_mode/managers/library_manager.py +50 -37
- griptape_nodes/retained_mode/managers/node_manager.py +29 -2
- griptape_nodes/retained_mode/retained_mode.py +662 -18
- {griptape_nodes-0.36.2.dist-info → griptape_nodes-0.37.1.dist-info}/METADATA +3 -2
- {griptape_nodes-0.36.2.dist-info → griptape_nodes-0.37.1.dist-info}/RECORD +19 -17
- {griptape_nodes-0.36.2.dist-info → griptape_nodes-0.37.1.dist-info}/WHEEL +0 -0
- {griptape_nodes-0.36.2.dist-info → griptape_nodes-0.37.1.dist-info}/entry_points.txt +0 -0
- {griptape_nodes-0.36.2.dist-info → griptape_nodes-0.37.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
import logging
|
|
2
3
|
from collections.abc import Callable
|
|
3
4
|
from functools import wraps
|
|
@@ -139,24 +140,79 @@ class RetainedMode:
|
|
|
139
140
|
flow_name: str | None = None,
|
|
140
141
|
parent_flow_name: str | None = None,
|
|
141
142
|
) -> ResultPayload:
|
|
143
|
+
"""Creates a new flow within the Griptape Nodes system.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
flow_name (str, optional): Name for the new flow. If not provided, a default name will be generated.
|
|
147
|
+
parent_flow_name (str, optional): Name of the parent flow. If provided, the new flow will be created as a child flow.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
ResultPayload: Contains the result of the flow creation operation.
|
|
151
|
+
|
|
152
|
+
Example:
|
|
153
|
+
# Create a top-level flow
|
|
154
|
+
result = cmd.create_flow("my_flow")
|
|
155
|
+
|
|
156
|
+
# Create a child flow
|
|
157
|
+
result = cmd.create_flow("child_flow", parent_flow_name="parent_flow")
|
|
158
|
+
"""
|
|
142
159
|
request = CreateFlowRequest(parent_flow_name=parent_flow_name, flow_name=flow_name)
|
|
143
160
|
result = GriptapeNodes().handle_request(request)
|
|
144
161
|
return result
|
|
145
162
|
|
|
146
163
|
@classmethod
|
|
147
164
|
def delete_flow(cls, flow_name: str) -> ResultPayload:
|
|
165
|
+
"""Deletes an existing flow from the system.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
flow_name (str): Name of the flow to delete.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
ResultPayload: Contains the result of the flow deletion operation.
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
# Delete a flow
|
|
175
|
+
result = cmd.delete_flow("my_flow")
|
|
176
|
+
"""
|
|
148
177
|
request = DeleteFlowRequest(flow_name=flow_name)
|
|
149
178
|
result = GriptapeNodes().handle_request(request)
|
|
150
179
|
return result
|
|
151
180
|
|
|
152
181
|
@classmethod
|
|
153
182
|
def get_flows(cls, parent_flow_name: str | None = None) -> ResultPayload:
|
|
183
|
+
"""Lists all flows within a parent flow or all top-level flows if no parent is specified.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
parent_flow_name (str, optional): Name of the parent flow. If not provided, returns all top-level flows.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
ResultPayload: Contains a list of flow names.
|
|
190
|
+
|
|
191
|
+
Example:
|
|
192
|
+
# Get all top-level flows
|
|
193
|
+
result = cmd.get_flows()
|
|
194
|
+
|
|
195
|
+
# Get all child flows of a parent
|
|
196
|
+
result = cmd.get_flows(parent_flow_name="parent_flow")
|
|
197
|
+
"""
|
|
154
198
|
request = ListFlowsInFlowRequest(parent_flow_name=parent_flow_name)
|
|
155
199
|
result = GriptapeNodes().handle_request(request)
|
|
156
200
|
return result
|
|
157
201
|
|
|
158
202
|
@classmethod
|
|
159
203
|
def get_nodes_in_flow(cls, flow_name: str) -> ResultPayload:
|
|
204
|
+
"""Lists all nodes contained within a specific flow.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
flow_name (str): Name of the flow to inspect.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
ResultPayload: Contains a list of node names in the flow.
|
|
211
|
+
|
|
212
|
+
Example:
|
|
213
|
+
# Get all nodes in a flow
|
|
214
|
+
result = cmd.get_nodes_in_flow("my_flow")
|
|
215
|
+
"""
|
|
160
216
|
request = ListNodesInFlowRequest(flow_name=flow_name)
|
|
161
217
|
result = GriptapeNodes().handle_request(request)
|
|
162
218
|
return result
|
|
@@ -171,6 +227,25 @@ class RetainedMode:
|
|
|
171
227
|
parent_flow_name: str | None = None,
|
|
172
228
|
metadata: dict[Any, Any] | None = None,
|
|
173
229
|
) -> ResultPayload:
|
|
230
|
+
"""Creates a node of the specified type and adds it to the current or a specified parent flow.
|
|
231
|
+
|
|
232
|
+
Supports custom naming and metadata (e.g., UI position, display name, tags).
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
node_type (str): Type of node to create (e.g. "Agent", "Prompt", "MergeText").
|
|
236
|
+
specific_library_name (str, optional): Library to search for the node type.
|
|
237
|
+
node_name (str, optional): Custom name for the new node.
|
|
238
|
+
parent_flow_name (str, optional): Parent flow to insert the node into (defaults to current).
|
|
239
|
+
metadata (dict, optional): Extra node metadata such as {"position": {"x": 100, "y": 200"}}.
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
ResultPayload: Contains the name of the created node if successful.
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
agent = cmd.create_node("Agent")
|
|
246
|
+
cmd.create_node("Prompt", node_name="intro_prompt")
|
|
247
|
+
cmd.create_node("Agent", metadata={"position": {"x": 100, "y": 200"}})
|
|
248
|
+
"""
|
|
174
249
|
request = CreateNodeRequest(
|
|
175
250
|
node_name=node_name,
|
|
176
251
|
node_type=node_type,
|
|
@@ -191,36 +266,119 @@ class RetainedMode:
|
|
|
191
266
|
cls,
|
|
192
267
|
node_name: str,
|
|
193
268
|
) -> ResultPayload:
|
|
269
|
+
"""Deletes a node from the system.
|
|
270
|
+
|
|
271
|
+
Args:
|
|
272
|
+
node_name (str): Name of the node to delete.
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
ResultPayload: Contains the result of the node deletion operation.
|
|
276
|
+
|
|
277
|
+
Example:
|
|
278
|
+
# Delete a node
|
|
279
|
+
result = cmd.delete_node("my_node")
|
|
280
|
+
"""
|
|
194
281
|
request = DeleteNodeRequest(node_name=node_name)
|
|
195
282
|
result = GriptapeNodes().handle_request(request)
|
|
196
283
|
return result
|
|
197
284
|
|
|
198
285
|
@classmethod
|
|
199
286
|
def get_resolution_state_for_node(cls, node_name: str) -> ResultPayload:
|
|
287
|
+
"""Gets the current resolution state of a node.
|
|
288
|
+
|
|
289
|
+
The resolution state indicates whether a node has been successfully resolved
|
|
290
|
+
and is ready for execution.
|
|
291
|
+
|
|
292
|
+
Args:
|
|
293
|
+
node_name (str): Name of the node to check.
|
|
294
|
+
|
|
295
|
+
Returns:
|
|
296
|
+
ResultPayload: Contains the resolution state of the node.
|
|
297
|
+
|
|
298
|
+
Example:
|
|
299
|
+
# Check if a node is resolved
|
|
300
|
+
result = cmd.get_resolution_state_for_node("my_node")
|
|
301
|
+
"""
|
|
200
302
|
request = GetNodeResolutionStateRequest(node_name=node_name)
|
|
201
303
|
result = GriptapeNodes().handle_request(request)
|
|
202
304
|
return result
|
|
203
305
|
|
|
204
306
|
@classmethod
|
|
205
307
|
def get_metadata_for_node(cls, node_name: str) -> ResultPayload:
|
|
308
|
+
"""Retrieves metadata associated with a node.
|
|
309
|
+
|
|
310
|
+
Node metadata can include UI position, display name, tags, and other custom properties.
|
|
311
|
+
|
|
312
|
+
Args:
|
|
313
|
+
node_name (str): Name of the node to get metadata for.
|
|
314
|
+
|
|
315
|
+
Returns:
|
|
316
|
+
ResultPayload: Contains the node's metadata.
|
|
317
|
+
|
|
318
|
+
Example:
|
|
319
|
+
# Get node metadata
|
|
320
|
+
result = cmd.get_metadata_for_node("my_node")
|
|
321
|
+
"""
|
|
206
322
|
request = GetNodeMetadataRequest(node_name=node_name)
|
|
207
323
|
result = GriptapeNodes().handle_request(request)
|
|
208
324
|
return result
|
|
209
325
|
|
|
210
326
|
@classmethod
|
|
211
327
|
def set_metadata_for_node(cls, node_name: str, metadata: dict[Any, Any]) -> ResultPayload:
|
|
328
|
+
"""Sets metadata for a node.
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
node_name (str): Name of the node to set metadata for.
|
|
332
|
+
metadata (dict): Dictionary containing the metadata to set.
|
|
333
|
+
|
|
334
|
+
Returns:
|
|
335
|
+
ResultPayload: Contains the result of the metadata update operation.
|
|
336
|
+
|
|
337
|
+
Example:
|
|
338
|
+
# Set node position
|
|
339
|
+
metadata = {
|
|
340
|
+
"position": {"x": 100, "y": 200}
|
|
341
|
+
}
|
|
342
|
+
result = cmd.set_metadata_for_node("my_node", metadata)
|
|
343
|
+
"""
|
|
212
344
|
request = SetNodeMetadataRequest(node_name=node_name, metadata=metadata)
|
|
213
345
|
result = GriptapeNodes().handle_request(request)
|
|
214
346
|
return result
|
|
215
347
|
|
|
216
348
|
@classmethod
|
|
217
349
|
def get_connections_for_node(cls, node_name: str) -> ResultPayload:
|
|
350
|
+
"""Gets all connections associated with a node.
|
|
351
|
+
|
|
352
|
+
This includes both incoming and outgoing connections to/from the node.
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
node_name (str): Name of the node to get connections for.
|
|
356
|
+
|
|
357
|
+
Returns:
|
|
358
|
+
ResultPayload: Contains a list of connections.
|
|
359
|
+
|
|
360
|
+
Example:
|
|
361
|
+
# Get all connections for a node
|
|
362
|
+
result = cmd.get_connections_for_node("my_node")
|
|
363
|
+
"""
|
|
218
364
|
request = ListConnectionsForNodeRequest(node_name=node_name)
|
|
219
365
|
result = GriptapeNodes().handle_request(request)
|
|
220
366
|
return result
|
|
221
367
|
|
|
222
368
|
@classmethod
|
|
223
369
|
def list_params(cls, node: str) -> ResultPayload:
|
|
370
|
+
"""Lists all parameters associated with a node.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
node (str): Name of the node to list parameters for.
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
ResultPayload: Contains a list of parameter names.
|
|
377
|
+
|
|
378
|
+
Example:
|
|
379
|
+
# List all parameters on a node
|
|
380
|
+
params = cmd.list_params("my_node")
|
|
381
|
+
"""
|
|
224
382
|
request = ListParametersOnNodeRequest(node_name=node)
|
|
225
383
|
result = GriptapeNodes().handle_request(request)
|
|
226
384
|
return result.parameter_names
|
|
@@ -245,6 +403,52 @@ class RetainedMode:
|
|
|
245
403
|
mode_allowed_output: bool = True, # noqa: FBT001, FBT002
|
|
246
404
|
**kwargs, # noqa: ARG003
|
|
247
405
|
) -> ResultPayload:
|
|
406
|
+
"""Adds or modifies a parameter on a node.
|
|
407
|
+
|
|
408
|
+
This method can be used to either add a new parameter or modify an existing one.
|
|
409
|
+
Parameters can have different modes (input, property, output) and can include
|
|
410
|
+
tooltips and UI options.
|
|
411
|
+
|
|
412
|
+
Args:
|
|
413
|
+
node_name (str): Name of the node to add/modify the parameter on.
|
|
414
|
+
parameter_name (str): Name of the parameter.
|
|
415
|
+
default_value (Any, optional): Default value for the parameter.
|
|
416
|
+
tooltip (str | list[dict]): Tooltip text or structured tooltip data.
|
|
417
|
+
type (str, optional): Type of the parameter.
|
|
418
|
+
input_types (list[str], optional): List of allowed input types.
|
|
419
|
+
output_type (str, optional): Expected output type.
|
|
420
|
+
edit (bool, optional): If True, modifies an existing parameter instead of creating new.
|
|
421
|
+
tooltip_as_input (str | list[dict], optional): Tooltip specific to input mode.
|
|
422
|
+
tooltip_as_property (str | list[dict], optional): Tooltip specific to property mode.
|
|
423
|
+
tooltip_as_output (str | list[dict], optional): Tooltip specific to output mode.
|
|
424
|
+
ui_options (dict, optional): Additional UI configuration options.
|
|
425
|
+
mode_allowed_input (bool, optional): Whether parameter can be used as input.
|
|
426
|
+
mode_allowed_property (bool, optional): Whether parameter can be used as property.
|
|
427
|
+
mode_allowed_output (bool, optional): Whether parameter can be used as output.
|
|
428
|
+
**kwargs: Additional keyword arguments that may be passed to the parameter creation/modification.
|
|
429
|
+
|
|
430
|
+
Returns:
|
|
431
|
+
ResultPayload: Contains the result of the parameter operation.
|
|
432
|
+
|
|
433
|
+
Example:
|
|
434
|
+
# Add a new parameter
|
|
435
|
+
result = cmd.add_param(
|
|
436
|
+
node_name="my_node",
|
|
437
|
+
parameter_name="my_param",
|
|
438
|
+
default_value="default",
|
|
439
|
+
tooltip="My parameter tooltip",
|
|
440
|
+
type="string"
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
# Modify an existing parameter
|
|
444
|
+
result = cmd.add_param(
|
|
445
|
+
node_name="my_node",
|
|
446
|
+
parameter_name="my_param",
|
|
447
|
+
default_value="new_default",
|
|
448
|
+
tooltip="Updated tooltip",
|
|
449
|
+
edit=True
|
|
450
|
+
)
|
|
451
|
+
"""
|
|
248
452
|
if edit:
|
|
249
453
|
request = AlterParameterDetailsRequest(
|
|
250
454
|
parameter_name=parameter_name,
|
|
@@ -282,32 +486,44 @@ class RetainedMode:
|
|
|
282
486
|
result = GriptapeNodes().handle_request(request)
|
|
283
487
|
return result
|
|
284
488
|
|
|
285
|
-
# remove_parameter_from_node
|
|
286
489
|
@classmethod
|
|
287
490
|
def del_param(cls, node_name: str, parameter_name: str) -> ResultPayload:
|
|
288
|
-
|
|
289
|
-
result = GriptapeNodes().handle_request(request)
|
|
290
|
-
return result
|
|
491
|
+
"""Removes a parameter from a node.
|
|
291
492
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
493
|
+
Args:
|
|
494
|
+
node_name (str): Name of the node containing the parameter.
|
|
495
|
+
parameter_name (str): Name of the parameter to remove.
|
|
496
|
+
|
|
497
|
+
Returns:
|
|
498
|
+
ResultPayload: Contains the result of the parameter deletion operation.
|
|
499
|
+
|
|
500
|
+
Example:
|
|
501
|
+
# Remove a parameter
|
|
502
|
+
result = cmd.del_param("my_node", "my_param")
|
|
503
|
+
"""
|
|
504
|
+
request = RemoveParameterFromNodeRequest(parameter_name=parameter_name, node_name=node_name)
|
|
298
505
|
result = GriptapeNodes().handle_request(request)
|
|
299
506
|
return result
|
|
300
|
-
"""
|
|
301
507
|
|
|
302
508
|
@classmethod
|
|
303
509
|
@command_arg_handler(node_param_split_func=node_param_split)
|
|
304
510
|
def param_info(cls, *, node: str, param: str, **kwargs) -> Any: # noqa: ARG003
|
|
305
|
-
"""
|
|
511
|
+
"""Gets detailed information about a parameter.
|
|
306
512
|
|
|
307
513
|
Args:
|
|
308
|
-
node: Name of the node
|
|
309
|
-
param: Name of the parameter
|
|
310
|
-
**kwargs: Additional arguments
|
|
514
|
+
node (str): Name of the node containing the parameter.
|
|
515
|
+
param (str): Name of the parameter to get info for.
|
|
516
|
+
**kwargs: Additional arguments.
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
Any: Contains detailed parameter information.
|
|
520
|
+
|
|
521
|
+
Example:
|
|
522
|
+
# Get parameter info using node.param format
|
|
523
|
+
info = cmd.param_info("my_node.my_param")
|
|
524
|
+
|
|
525
|
+
# Get parameter info using keyword arguments
|
|
526
|
+
info = cmd.param_info(node="my_node", param="my_param")
|
|
311
527
|
"""
|
|
312
528
|
request = GetParameterDetailsRequest(parameter_name=param, node_name=node)
|
|
313
529
|
result = GriptapeNodes().handle_request(request)
|
|
@@ -495,6 +711,31 @@ class RetainedMode:
|
|
|
495
711
|
|
|
496
712
|
@classmethod
|
|
497
713
|
def get_value(cls, *args, **kwargs) -> Any:
|
|
714
|
+
"""Gets the value of a parameter on a node.
|
|
715
|
+
|
|
716
|
+
This method supports both direct parameter access and indexed access for list/array parameters.
|
|
717
|
+
The parameter can be specified either as a single string argument ("node.param") or as
|
|
718
|
+
keyword arguments (node="node", param="param").
|
|
719
|
+
|
|
720
|
+
Args:
|
|
721
|
+
*args: Optional positional arguments. If provided, first argument should be "node.param".
|
|
722
|
+
**kwargs: Keyword arguments:
|
|
723
|
+
node (str): Name of the node containing the parameter.
|
|
724
|
+
param (str): Name of the parameter to get value from.
|
|
725
|
+
|
|
726
|
+
Returns:
|
|
727
|
+
Any: The value of the parameter, or a failure result if the operation failed.
|
|
728
|
+
|
|
729
|
+
Example:
|
|
730
|
+
# Get value using node.param format
|
|
731
|
+
value = cmd.get_value("my_node.my_param")
|
|
732
|
+
|
|
733
|
+
# Get value using keyword arguments
|
|
734
|
+
value = cmd.get_value(node="my_node", param="my_param")
|
|
735
|
+
|
|
736
|
+
# Get value from a list parameter using indexing
|
|
737
|
+
value = cmd.get_value("my_node.my_list[0]")
|
|
738
|
+
"""
|
|
498
739
|
node = kwargs.pop("node", None)
|
|
499
740
|
param = kwargs.pop("param", None)
|
|
500
741
|
lrg = len(args)
|
|
@@ -549,6 +790,38 @@ class RetainedMode:
|
|
|
549
790
|
|
|
550
791
|
@classmethod
|
|
551
792
|
def set_value(cls, *args, **kwargs) -> Any: # noqa: C901, PLR0912
|
|
793
|
+
"""Sets the value of a parameter on a node.
|
|
794
|
+
|
|
795
|
+
This method supports both direct parameter access and indexed access for list/array parameters.
|
|
796
|
+
The parameter can be specified either as a single string argument ("node.param") or as
|
|
797
|
+
keyword arguments (node="node", param="param"). The value to set can be provided as
|
|
798
|
+
the second positional argument or as a keyword argument (value=value).
|
|
799
|
+
|
|
800
|
+
Args:
|
|
801
|
+
*args: Optional positional arguments:
|
|
802
|
+
- First argument can be "node.param" format
|
|
803
|
+
- Second argument can be the value to set
|
|
804
|
+
**kwargs: Keyword arguments:
|
|
805
|
+
node (str): Name of the node containing the parameter.
|
|
806
|
+
param (str): Name of the parameter to set value for.
|
|
807
|
+
value (Any): Value to set for the parameter.
|
|
808
|
+
|
|
809
|
+
Returns:
|
|
810
|
+
Any: Result of the set operation.
|
|
811
|
+
|
|
812
|
+
Example:
|
|
813
|
+
# Set value using node.param format
|
|
814
|
+
result = cmd.set_value("my_node.my_param", "new_value")
|
|
815
|
+
|
|
816
|
+
# Set value using keyword arguments
|
|
817
|
+
result = cmd.set_value(node="my_node", param="my_param", value="new_value")
|
|
818
|
+
|
|
819
|
+
# Set value in a list parameter using indexing
|
|
820
|
+
result = cmd.set_value("my_node.my_list[0]", "new_value")
|
|
821
|
+
|
|
822
|
+
# Set value in a nested list
|
|
823
|
+
result = cmd.set_value("my_node.my_list[0][1]", "new_value")
|
|
824
|
+
"""
|
|
552
825
|
node = kwargs.pop("node", None)
|
|
553
826
|
param = kwargs.pop("param", None)
|
|
554
827
|
value = kwargs.pop("value", None)
|
|
@@ -654,6 +927,19 @@ class RetainedMode:
|
|
|
654
927
|
|
|
655
928
|
@classmethod
|
|
656
929
|
def connect(cls, source: str, destination: str) -> ResultPayload:
|
|
930
|
+
"""Creates a connection between two node parameters.
|
|
931
|
+
|
|
932
|
+
Args:
|
|
933
|
+
source (str): Source node and parameter in format "node.param".
|
|
934
|
+
destination (str): Destination node and parameter in format "node.param".
|
|
935
|
+
|
|
936
|
+
Returns:
|
|
937
|
+
ResultPayload: Contains the result of the connection operation.
|
|
938
|
+
|
|
939
|
+
Example:
|
|
940
|
+
# Connect output of one node to input of another
|
|
941
|
+
result = cmd.connect("source_node.output", "target_node.input")
|
|
942
|
+
"""
|
|
657
943
|
src_node, src_param = node_param_split(source)
|
|
658
944
|
dst_node, dst_param = node_param_split(destination)
|
|
659
945
|
|
|
@@ -667,13 +953,20 @@ class RetainedMode:
|
|
|
667
953
|
|
|
668
954
|
@classmethod
|
|
669
955
|
def exec_chain(cls, *node_names) -> dict:
|
|
670
|
-
"""Creates
|
|
956
|
+
"""Creates a chain of execution connections between nodes.
|
|
957
|
+
|
|
958
|
+
This method creates connections between nodes in sequence, connecting
|
|
959
|
+
the exec_out of each node to the exec_in of the next node.
|
|
671
960
|
|
|
672
961
|
Args:
|
|
673
|
-
*node_names: Variable number of node names to chain together
|
|
962
|
+
*node_names: Variable number of node names to chain together.
|
|
674
963
|
|
|
675
964
|
Returns:
|
|
676
|
-
Dictionary
|
|
965
|
+
dict: Dictionary containing results of each connection attempt.
|
|
966
|
+
|
|
967
|
+
Example:
|
|
968
|
+
# Create an execution chain of three nodes
|
|
969
|
+
results = cmd.exec_chain("node1", "node2", "node3")
|
|
677
970
|
"""
|
|
678
971
|
results = {}
|
|
679
972
|
failures = []
|
|
@@ -715,6 +1008,26 @@ class RetainedMode:
|
|
|
715
1008
|
target_node_name: str,
|
|
716
1009
|
target_param_name: str,
|
|
717
1010
|
) -> ResultPayload:
|
|
1011
|
+
"""Deletes a connection between two node parameters.
|
|
1012
|
+
|
|
1013
|
+
Args:
|
|
1014
|
+
source_node_name (str): Name of the source node.
|
|
1015
|
+
source_param_name (str): Name of the source parameter.
|
|
1016
|
+
target_node_name (str): Name of the target node.
|
|
1017
|
+
target_param_name (str): Name of the target parameter.
|
|
1018
|
+
|
|
1019
|
+
Returns:
|
|
1020
|
+
ResultPayload: Contains the result of the connection deletion operation.
|
|
1021
|
+
|
|
1022
|
+
Example:
|
|
1023
|
+
# Delete a connection between nodes
|
|
1024
|
+
result = cmd.delete_connection(
|
|
1025
|
+
"source_node",
|
|
1026
|
+
"output",
|
|
1027
|
+
"target_node",
|
|
1028
|
+
"input"
|
|
1029
|
+
)
|
|
1030
|
+
"""
|
|
718
1031
|
request = DeleteConnectionRequest(
|
|
719
1032
|
source_node_name=source_node_name,
|
|
720
1033
|
source_parameter_name=source_param_name,
|
|
@@ -727,18 +1040,55 @@ class RetainedMode:
|
|
|
727
1040
|
# LIBRARY OPERATIONS
|
|
728
1041
|
@classmethod
|
|
729
1042
|
def get_available_libraries(cls) -> ResultPayload:
|
|
1043
|
+
"""Gets a list of all available node libraries.
|
|
1044
|
+
|
|
1045
|
+
Returns:
|
|
1046
|
+
ResultPayload: Contains a list of library names.
|
|
1047
|
+
|
|
1048
|
+
Example:
|
|
1049
|
+
# Get all available libraries
|
|
1050
|
+
libraries = cmd.get_available_libraries()
|
|
1051
|
+
"""
|
|
730
1052
|
request = ListRegisteredLibrariesRequest()
|
|
731
1053
|
result = GriptapeNodes().handle_request(request)
|
|
732
1054
|
return result
|
|
733
1055
|
|
|
734
1056
|
@classmethod
|
|
735
1057
|
def get_node_types_in_library(cls, library_name: str) -> ResultPayload:
|
|
1058
|
+
"""Gets a list of all node types available in a specific library.
|
|
1059
|
+
|
|
1060
|
+
Args:
|
|
1061
|
+
library_name (str): Name of the library to inspect.
|
|
1062
|
+
|
|
1063
|
+
Returns:
|
|
1064
|
+
ResultPayload: Contains a list of node types.
|
|
1065
|
+
|
|
1066
|
+
Example:
|
|
1067
|
+
# Get all node types in a library
|
|
1068
|
+
node_types = cmd.get_node_types_in_library("my_library")
|
|
1069
|
+
"""
|
|
736
1070
|
request = ListNodeTypesInLibraryRequest(library=library_name)
|
|
737
1071
|
result = GriptapeNodes().handle_request(request)
|
|
738
1072
|
return result
|
|
739
1073
|
|
|
740
1074
|
@classmethod
|
|
741
1075
|
def get_node_metadata_from_library(cls, library_name: str, node_type_name: str) -> ResultPayload:
|
|
1076
|
+
"""Gets metadata for a specific node type from a library.
|
|
1077
|
+
|
|
1078
|
+
This includes information about the node's parameters, capabilities,
|
|
1079
|
+
and other configuration options.
|
|
1080
|
+
|
|
1081
|
+
Args:
|
|
1082
|
+
library_name (str): Name of the library containing the node type.
|
|
1083
|
+
node_type_name (str): Name of the node type to get metadata for.
|
|
1084
|
+
|
|
1085
|
+
Returns:
|
|
1086
|
+
ResultPayload: Contains the node type's metadata.
|
|
1087
|
+
|
|
1088
|
+
Example:
|
|
1089
|
+
# Get metadata for a specific node type
|
|
1090
|
+
metadata = cmd.get_node_metadata_from_library("my_library", "Agent")
|
|
1091
|
+
"""
|
|
742
1092
|
request = GetNodeMetadataFromLibraryRequest(library=library_name, node_type=node_type_name)
|
|
743
1093
|
result = GriptapeNodes().handle_request(request)
|
|
744
1094
|
return result
|
|
@@ -746,49 +1096,175 @@ class RetainedMode:
|
|
|
746
1096
|
# FLOW OPERATIONS
|
|
747
1097
|
@classmethod
|
|
748
1098
|
def run_flow(cls, flow_name: str) -> ResultPayload:
|
|
1099
|
+
"""Executes a flow from start to finish.
|
|
1100
|
+
|
|
1101
|
+
Args:
|
|
1102
|
+
flow_name (str): Name of the flow to execute.
|
|
1103
|
+
|
|
1104
|
+
Returns:
|
|
1105
|
+
ResultPayload: Contains the result of the flow execution.
|
|
1106
|
+
|
|
1107
|
+
Example:
|
|
1108
|
+
# Run a flow
|
|
1109
|
+
result = cmd.run_flow("my_flow")
|
|
1110
|
+
"""
|
|
749
1111
|
request = StartFlowRequest(flow_name=flow_name, debug_mode=False)
|
|
750
1112
|
result = GriptapeNodes().handle_request(request)
|
|
751
1113
|
return result
|
|
752
1114
|
|
|
753
1115
|
@classmethod
|
|
754
1116
|
def run_node(cls, node_name: str) -> ResultPayload:
|
|
1117
|
+
"""Executes a single node.
|
|
1118
|
+
|
|
1119
|
+
Args:
|
|
1120
|
+
node_name (str): Name of the node to execute.
|
|
1121
|
+
|
|
1122
|
+
Returns:
|
|
1123
|
+
ResultPayload: Contains the result of the node execution.
|
|
1124
|
+
|
|
1125
|
+
Example:
|
|
1126
|
+
# Run a single node
|
|
1127
|
+
result = cmd.run_node("my_node")
|
|
1128
|
+
"""
|
|
755
1129
|
request = ResolveNodeRequest(node_name=node_name)
|
|
756
1130
|
result = GriptapeNodes().handle_request(request)
|
|
757
1131
|
return result
|
|
758
1132
|
|
|
759
1133
|
@classmethod
|
|
760
1134
|
def single_step(cls, flow_name: str) -> ResultPayload:
|
|
1135
|
+
"""Executes a single step in a flow.
|
|
1136
|
+
|
|
1137
|
+
This method executes one node in the flow and stops, allowing for
|
|
1138
|
+
step-by-step debugging or controlled execution.
|
|
1139
|
+
|
|
1140
|
+
Args:
|
|
1141
|
+
flow_name (str): Name of the flow to step through.
|
|
1142
|
+
|
|
1143
|
+
Returns:
|
|
1144
|
+
ResultPayload: Contains the result of the step execution.
|
|
1145
|
+
|
|
1146
|
+
Example:
|
|
1147
|
+
# Execute one step in a flow
|
|
1148
|
+
result = cmd.single_step("my_flow")
|
|
1149
|
+
"""
|
|
761
1150
|
request = SingleNodeStepRequest(flow_name=flow_name)
|
|
762
1151
|
return GriptapeNodes().handle_request(request)
|
|
763
1152
|
|
|
764
1153
|
@classmethod
|
|
765
1154
|
def single_execution_step(cls, flow_name: str) -> ResultPayload:
|
|
1155
|
+
"""Executes a single execution step in a flow.
|
|
1156
|
+
|
|
1157
|
+
Similar to single_step but focuses on execution steps rather than
|
|
1158
|
+
individual nodes. This is useful for flows with complex execution patterns.
|
|
1159
|
+
|
|
1160
|
+
Args:
|
|
1161
|
+
flow_name (str): Name of the flow to step through.
|
|
1162
|
+
|
|
1163
|
+
Returns:
|
|
1164
|
+
ResultPayload: Contains the result of the execution step.
|
|
1165
|
+
|
|
1166
|
+
Example:
|
|
1167
|
+
# Execute one execution step in a flow
|
|
1168
|
+
result = cmd.single_execution_step("my_flow")
|
|
1169
|
+
"""
|
|
766
1170
|
request = SingleExecutionStepRequest(flow_name=flow_name)
|
|
767
1171
|
return GriptapeNodes().handle_request(request)
|
|
768
1172
|
|
|
769
1173
|
@classmethod
|
|
770
1174
|
def continue_flow(cls, flow_name: str) -> ResultPayload:
|
|
1175
|
+
"""Continues execution of a paused flow.
|
|
1176
|
+
|
|
1177
|
+
Use this method to resume execution after a flow has been paused
|
|
1178
|
+
(e.g., after a single step).
|
|
1179
|
+
|
|
1180
|
+
Args:
|
|
1181
|
+
flow_name (str): Name of the flow to continue.
|
|
1182
|
+
|
|
1183
|
+
Returns:
|
|
1184
|
+
ResultPayload: Contains the result of continuing the flow.
|
|
1185
|
+
|
|
1186
|
+
Example:
|
|
1187
|
+
# Continue a paused flow
|
|
1188
|
+
result = cmd.continue_flow("my_flow")
|
|
1189
|
+
"""
|
|
771
1190
|
request = ContinueExecutionStepRequest(flow_name=flow_name)
|
|
772
1191
|
return GriptapeNodes().handle_request(request)
|
|
773
1192
|
|
|
774
1193
|
@classmethod
|
|
775
1194
|
def reset_flow(cls, flow_name: str) -> ResultPayload:
|
|
1195
|
+
"""Resets a flow to its initial state.
|
|
1196
|
+
|
|
1197
|
+
This clears any execution state and allows the flow to be run again
|
|
1198
|
+
from the beginning.
|
|
1199
|
+
|
|
1200
|
+
Args:
|
|
1201
|
+
flow_name (str): Name of the flow to reset.
|
|
1202
|
+
|
|
1203
|
+
Returns:
|
|
1204
|
+
ResultPayload: Contains the result of resetting the flow.
|
|
1205
|
+
|
|
1206
|
+
Example:
|
|
1207
|
+
# Reset a flow to its initial state
|
|
1208
|
+
result = cmd.reset_flow("my_flow")
|
|
1209
|
+
"""
|
|
776
1210
|
request = UnresolveFlowRequest(flow_name=flow_name)
|
|
777
1211
|
return GriptapeNodes().handle_request(request)
|
|
778
1212
|
|
|
779
1213
|
@classmethod
|
|
780
1214
|
def cancel_flow(cls, flow_name: str) -> ResultPayload:
|
|
1215
|
+
"""Cancels the execution of a running flow.
|
|
1216
|
+
|
|
1217
|
+
Args:
|
|
1218
|
+
flow_name (str): Name of the flow to cancel.
|
|
1219
|
+
|
|
1220
|
+
Returns:
|
|
1221
|
+
ResultPayload: Contains the result of canceling the flow.
|
|
1222
|
+
|
|
1223
|
+
Example:
|
|
1224
|
+
# Cancel a running flow
|
|
1225
|
+
result = cmd.cancel_flow("my_flow")
|
|
1226
|
+
"""
|
|
781
1227
|
request = CancelFlowRequest(flow_name=flow_name)
|
|
782
1228
|
return GriptapeNodes().handle_request(request)
|
|
783
1229
|
|
|
784
1230
|
@classmethod
|
|
785
1231
|
def get_flow_state(cls, flow_name: str) -> ResultPayload:
|
|
1232
|
+
"""Gets the current state of a flow.
|
|
1233
|
+
|
|
1234
|
+
This includes information about which nodes have been executed,
|
|
1235
|
+
the current execution position, and any errors that have occurred.
|
|
1236
|
+
|
|
1237
|
+
Args:
|
|
1238
|
+
flow_name (str): Name of the flow to get state for.
|
|
1239
|
+
|
|
1240
|
+
Returns:
|
|
1241
|
+
ResultPayload: Contains the current state of the flow.
|
|
1242
|
+
|
|
1243
|
+
Example:
|
|
1244
|
+
# Get the current state of a flow
|
|
1245
|
+
state = cmd.get_flow_state("my_flow")
|
|
1246
|
+
"""
|
|
786
1247
|
request = GetFlowStateRequest(flow_name=flow_name)
|
|
787
1248
|
return GriptapeNodes().handle_request(request)
|
|
788
1249
|
|
|
789
1250
|
# ARBITRARY PYTHON EXECUTION
|
|
790
1251
|
@classmethod
|
|
791
1252
|
def run_arbitrary_python(cls, python_str: str) -> ResultPayload:
|
|
1253
|
+
"""Executes arbitrary Python code in the context of the current flow.
|
|
1254
|
+
|
|
1255
|
+
This method allows for dynamic execution of Python code, which can be
|
|
1256
|
+
useful for custom operations or debugging.
|
|
1257
|
+
|
|
1258
|
+
Args:
|
|
1259
|
+
python_str (str): Python code to execute.
|
|
1260
|
+
|
|
1261
|
+
Returns:
|
|
1262
|
+
ResultPayload: Contains the result of executing the Python code.
|
|
1263
|
+
|
|
1264
|
+
Example:
|
|
1265
|
+
# Execute some Python code
|
|
1266
|
+
result = cmd.run_arbitrary_python("print('Hello, World!')")
|
|
1267
|
+
"""
|
|
792
1268
|
request = RunArbitraryPythonStringRequest(python_string=python_str)
|
|
793
1269
|
result = GriptapeNodes().handle_request(request)
|
|
794
1270
|
return result
|
|
@@ -796,30 +1272,100 @@ class RetainedMode:
|
|
|
796
1272
|
# CONFIG MANAGER
|
|
797
1273
|
@classmethod
|
|
798
1274
|
def get_config_value(cls, category_and_key: str) -> ResultPayload:
|
|
1275
|
+
"""Gets a configuration value from the system.
|
|
1276
|
+
|
|
1277
|
+
Args:
|
|
1278
|
+
category_and_key (str): Configuration key in format "category.key".
|
|
1279
|
+
|
|
1280
|
+
Returns:
|
|
1281
|
+
ResultPayload: Contains the configuration value.
|
|
1282
|
+
|
|
1283
|
+
Example:
|
|
1284
|
+
# Get a configuration value
|
|
1285
|
+
value = cmd.get_config_value("app_events.events_to_echo")
|
|
1286
|
+
"""
|
|
799
1287
|
request = GetConfigValueRequest(category_and_key=category_and_key)
|
|
800
1288
|
result = GriptapeNodes().handle_request(request)
|
|
801
1289
|
return result
|
|
802
1290
|
|
|
803
1291
|
@classmethod
|
|
804
1292
|
def set_config_value(cls, category_and_key: str, value: Any) -> ResultPayload:
|
|
1293
|
+
"""Sets a configuration value in the system.
|
|
1294
|
+
|
|
1295
|
+
Args:
|
|
1296
|
+
category_and_key (str): Configuration key in format "category.key".
|
|
1297
|
+
value (Any): Value to set.
|
|
1298
|
+
|
|
1299
|
+
Returns:
|
|
1300
|
+
ResultPayload: Contains the result of setting the configuration value.
|
|
1301
|
+
|
|
1302
|
+
Example:
|
|
1303
|
+
# Set a configuration value
|
|
1304
|
+
result = cmd.set_config_value("app_events.events_to_echo", ["event1", "event2"])
|
|
1305
|
+
"""
|
|
805
1306
|
request = SetConfigValueRequest(category_and_key=category_and_key, value=value)
|
|
806
1307
|
result = GriptapeNodes().handle_request(request)
|
|
807
1308
|
return result
|
|
808
1309
|
|
|
809
1310
|
@classmethod
|
|
810
1311
|
def get_config_category(cls, category: str | None) -> ResultPayload:
|
|
1312
|
+
"""Gets all configuration values in a category.
|
|
1313
|
+
|
|
1314
|
+
Args:
|
|
1315
|
+
category (str, optional): Category to get values for. If None, returns all categories.
|
|
1316
|
+
|
|
1317
|
+
Returns:
|
|
1318
|
+
ResultPayload: Contains the configuration values.
|
|
1319
|
+
|
|
1320
|
+
Example:
|
|
1321
|
+
# Get all values in a category
|
|
1322
|
+
values = cmd.get_config_category("app_events")
|
|
1323
|
+
|
|
1324
|
+
# Get all categories
|
|
1325
|
+
categories = cmd.get_config_category(None)
|
|
1326
|
+
"""
|
|
811
1327
|
request = GetConfigCategoryRequest(category=category)
|
|
812
1328
|
result = GriptapeNodes().handle_request(request)
|
|
813
1329
|
return result
|
|
814
1330
|
|
|
815
1331
|
@classmethod
|
|
816
1332
|
def set_config_category(cls, category: str | None, contents: dict[str, Any]) -> ResultPayload:
|
|
1333
|
+
"""Sets multiple configuration values in a category.
|
|
1334
|
+
|
|
1335
|
+
Args:
|
|
1336
|
+
category (str, optional): Category to set values for. If None, sets root-level values.
|
|
1337
|
+
contents (dict): Dictionary of key-value pairs to set.
|
|
1338
|
+
|
|
1339
|
+
Returns:
|
|
1340
|
+
ResultPayload: Contains the result of setting the configuration values.
|
|
1341
|
+
|
|
1342
|
+
Example:
|
|
1343
|
+
# Set multiple values in a category
|
|
1344
|
+
values = {
|
|
1345
|
+
"key1": "value1",
|
|
1346
|
+
"key2": "value2"
|
|
1347
|
+
}
|
|
1348
|
+
result = cmd.set_config_category("my_category", values)
|
|
1349
|
+
"""
|
|
817
1350
|
request = SetConfigCategoryRequest(category=category, contents=contents)
|
|
818
1351
|
result = GriptapeNodes().handle_request(request)
|
|
819
1352
|
return result
|
|
820
1353
|
|
|
821
1354
|
@classmethod
|
|
822
1355
|
def rename(cls, object_name: str, requested_name: str) -> ResultPayload:
|
|
1356
|
+
"""Renames a node or flow.
|
|
1357
|
+
|
|
1358
|
+
Args:
|
|
1359
|
+
object_name (str): Current name of the object to rename.
|
|
1360
|
+
requested_name (str): New name to assign.
|
|
1361
|
+
|
|
1362
|
+
Returns:
|
|
1363
|
+
ResultPayload: Contains the result of the rename operation.
|
|
1364
|
+
|
|
1365
|
+
Example:
|
|
1366
|
+
# Rename a node
|
|
1367
|
+
result = cmd.rename("old_node_name", "new_node_name")
|
|
1368
|
+
"""
|
|
823
1369
|
request = RenameObjectRequest(
|
|
824
1370
|
object_name=object_name,
|
|
825
1371
|
requested_name=requested_name,
|
|
@@ -830,6 +1376,104 @@ class RetainedMode:
|
|
|
830
1376
|
|
|
831
1377
|
@classmethod
|
|
832
1378
|
def ls(cls, **kwargs) -> list:
|
|
1379
|
+
"""Lists objects in the system.
|
|
1380
|
+
|
|
1381
|
+
Args:
|
|
1382
|
+
**kwargs: Optional filters to apply to the listing.
|
|
1383
|
+
|
|
1384
|
+
Returns:
|
|
1385
|
+
list: List of object names matching the filters.
|
|
1386
|
+
|
|
1387
|
+
Example:
|
|
1388
|
+
# List all objects
|
|
1389
|
+
objects = cmd.ls()
|
|
1390
|
+
|
|
1391
|
+
# List objects with a specific filter
|
|
1392
|
+
filtered_objects = cmd.ls(type="node")
|
|
1393
|
+
"""
|
|
833
1394
|
rsl = GriptapeNodes.ObjectManager()
|
|
834
1395
|
as_dict = rsl.get_filtered_subset(**kwargs)
|
|
835
1396
|
return list(as_dict.keys())
|
|
1397
|
+
|
|
1398
|
+
@classmethod
|
|
1399
|
+
def help(cls, command_name: str | None = None) -> str:
|
|
1400
|
+
"""Returns help text for a specific command or all commands if none is provided.
|
|
1401
|
+
|
|
1402
|
+
Args:
|
|
1403
|
+
command_name (str, optional): Name of the command to get help for.
|
|
1404
|
+
|
|
1405
|
+
Returns:
|
|
1406
|
+
str: Help text for the specified command or list of all commands.
|
|
1407
|
+
|
|
1408
|
+
Example:
|
|
1409
|
+
# Get help for a specific command
|
|
1410
|
+
help_text = cmd.help("create_node")
|
|
1411
|
+
|
|
1412
|
+
# List all available commands
|
|
1413
|
+
all_commands = cmd.help()
|
|
1414
|
+
"""
|
|
1415
|
+
if command_name:
|
|
1416
|
+
func = getattr(cls, command_name, None)
|
|
1417
|
+
if not func or not callable(func):
|
|
1418
|
+
return f"❌ No such command: {command_name}"
|
|
1419
|
+
|
|
1420
|
+
doc = inspect.getdoc(func) or "No documentation available."
|
|
1421
|
+
sig_lines = _fancy_signature(func)
|
|
1422
|
+
|
|
1423
|
+
help_text = [f"Help for: {command_name}()", "", *doc.splitlines(), "", *sig_lines]
|
|
1424
|
+
return "\n".join(help_text)
|
|
1425
|
+
|
|
1426
|
+
lines = ["📚 Available commands:\n"]
|
|
1427
|
+
for name in dir(cls):
|
|
1428
|
+
if not name.startswith("_"):
|
|
1429
|
+
attr = getattr(cls, name)
|
|
1430
|
+
if callable(attr):
|
|
1431
|
+
lines.append(f"- {name}")
|
|
1432
|
+
lines.append("\nUse cmd.help('command_name') to get more info.")
|
|
1433
|
+
return "\n".join(lines)
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
def _fancy_signature(func: Callable) -> list[str]:
|
|
1437
|
+
"""Return a dev-friendly, neatly aligned function signature."""
|
|
1438
|
+
import inspect
|
|
1439
|
+
from typing import get_type_hints
|
|
1440
|
+
|
|
1441
|
+
sig = inspect.signature(func)
|
|
1442
|
+
type_hints = get_type_hints(func)
|
|
1443
|
+
|
|
1444
|
+
def type_repr(tp) -> str: # noqa: ANN001
|
|
1445
|
+
if tp is inspect.Signature.empty:
|
|
1446
|
+
return "Any"
|
|
1447
|
+
if isinstance(tp, type):
|
|
1448
|
+
return tp.__name__
|
|
1449
|
+
tp_str = str(tp)
|
|
1450
|
+
return tp_str.replace("typing.", "").replace("<class '", "").replace("'>", "").split(".")[-1]
|
|
1451
|
+
|
|
1452
|
+
params = []
|
|
1453
|
+
max_name_len = 0
|
|
1454
|
+
max_type_len = 0
|
|
1455
|
+
|
|
1456
|
+
for name, param in sig.parameters.items():
|
|
1457
|
+
annotation = type_hints.get(name, param.annotation)
|
|
1458
|
+
annotation_str = type_repr(annotation)
|
|
1459
|
+
is_optional = param.default is not inspect.Parameter.empty
|
|
1460
|
+
default = f"= {param.default!r}" if is_optional else ""
|
|
1461
|
+
optional_flag = "[optional]" if is_optional else "[required]"
|
|
1462
|
+
|
|
1463
|
+
params.append((name, annotation_str, default, optional_flag))
|
|
1464
|
+
max_name_len = max(max_name_len, len(name))
|
|
1465
|
+
max_type_len = max(max_type_len, len(annotation_str))
|
|
1466
|
+
|
|
1467
|
+
lines = ["Function definition:"]
|
|
1468
|
+
lines.append(f" {func.__name__}(")
|
|
1469
|
+
|
|
1470
|
+
for name, annotation_str, default, flag in params:
|
|
1471
|
+
lines.append(
|
|
1472
|
+
f" {name.ljust(max_name_len)}: {annotation_str.ljust(max_type_len)} {default.ljust(20)} {flag}"
|
|
1473
|
+
)
|
|
1474
|
+
|
|
1475
|
+
lines.append(" )")
|
|
1476
|
+
|
|
1477
|
+
lines.append("")
|
|
1478
|
+
lines.append("Parameters marked [optional] have default values.")
|
|
1479
|
+
return lines
|