pygeai 0.6.0b13__py3-none-any.whl → 0.6.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.
- pygeai/__init__.py +1 -2
- pygeai/_docs/source/content/api_reference/project.rst +392 -0
- pygeai/_docs/source/content/authentication.rst +130 -1
- pygeai/_docs/source/content/debugger.rst +327 -157
- pygeai/_docs/source/content/migration.rst +391 -7
- pygeai/_docs/source/pygeai.core.common.rst +8 -0
- pygeai/_docs/source/pygeai.tests.auth.rst +56 -0
- pygeai/_docs/source/pygeai.tests.cli.rst +8 -0
- pygeai/admin/clients.py +1 -3
- pygeai/analytics/clients.py +1 -1
- pygeai/assistant/clients.py +2 -7
- pygeai/assistant/data/clients.py +0 -8
- pygeai/assistant/data_analyst/clients.py +0 -2
- pygeai/assistant/managers.py +1 -1
- pygeai/assistant/rag/clients.py +0 -2
- pygeai/assistant/rag/mappers.py +9 -11
- pygeai/auth/clients.py +26 -7
- pygeai/auth/endpoints.py +2 -1
- pygeai/chat/clients.py +2 -2
- pygeai/chat/managers.py +1 -1
- pygeai/cli/commands/admin.py +13 -25
- pygeai/cli/commands/analytics.py +56 -88
- pygeai/cli/commands/assistant.py +84 -138
- pygeai/cli/commands/auth.py +23 -46
- pygeai/cli/commands/base.py +0 -1
- pygeai/cli/commands/chat.py +218 -209
- pygeai/cli/commands/common.py +5 -5
- pygeai/cli/commands/configuration.py +79 -29
- pygeai/cli/commands/docs.py +3 -4
- pygeai/cli/commands/embeddings.py +13 -19
- pygeai/cli/commands/evaluation.py +133 -344
- pygeai/cli/commands/feedback.py +7 -15
- pygeai/cli/commands/files.py +26 -53
- pygeai/cli/commands/gam.py +28 -69
- pygeai/cli/commands/lab/ai_lab.py +96 -142
- pygeai/cli/commands/lab/common.py +1 -1
- pygeai/cli/commands/lab/spec.py +12 -32
- pygeai/cli/commands/llm.py +9 -18
- pygeai/cli/commands/migrate.py +43 -99
- pygeai/cli/commands/organization.py +223 -196
- pygeai/cli/commands/rag.py +35 -58
- pygeai/cli/commands/rerank.py +21 -25
- pygeai/cli/commands/secrets.py +39 -67
- pygeai/cli/commands/usage_limits.py +50 -136
- pygeai/cli/commands/validators.py +1 -1
- pygeai/cli/geai.py +32 -3
- pygeai/cli/geai_proxy.py +6 -2
- pygeai/cli/install_man.py +1 -1
- pygeai/cli/parsers.py +1 -1
- pygeai/core/base/clients.py +90 -21
- pygeai/core/base/mappers.py +39 -55
- pygeai/core/base/session.py +134 -22
- pygeai/core/common/config.py +50 -13
- pygeai/core/common/constants.py +8 -0
- pygeai/core/common/exceptions.py +6 -0
- pygeai/core/embeddings/clients.py +0 -1
- pygeai/core/embeddings/managers.py +0 -1
- pygeai/core/feedback/clients.py +0 -2
- pygeai/core/feedback/models.py +1 -1
- pygeai/core/files/clients.py +0 -3
- pygeai/core/files/managers.py +1 -1
- pygeai/core/files/mappers.py +4 -5
- pygeai/core/llm/clients.py +0 -1
- pygeai/core/models.py +4 -4
- pygeai/core/plugins/clients.py +0 -3
- pygeai/core/plugins/models.py +2 -2
- pygeai/core/rerank/clients.py +0 -2
- pygeai/core/secrets/clients.py +0 -2
- pygeai/core/services/rest.py +80 -14
- pygeai/core/singleton.py +24 -0
- pygeai/dbg/__init__.py +2 -2
- pygeai/dbg/debugger.py +276 -38
- pygeai/evaluation/clients.py +2 -4
- pygeai/evaluation/dataset/clients.py +0 -1
- pygeai/evaluation/plan/clients.py +0 -2
- pygeai/evaluation/result/clients.py +0 -2
- pygeai/gam/clients.py +1 -3
- pygeai/health/clients.py +1 -3
- pygeai/lab/clients.py +0 -1
- pygeai/lab/managers.py +0 -1
- pygeai/lab/models.py +0 -1
- pygeai/lab/strategies/clients.py +1 -2
- pygeai/lab/tools/clients.py +2 -2
- pygeai/lab/tools/mappers.py +1 -1
- pygeai/migration/strategies.py +5 -6
- pygeai/migration/tools.py +1 -1
- pygeai/organization/clients.py +118 -12
- pygeai/organization/endpoints.py +1 -0
- pygeai/organization/limits/clients.py +4 -6
- pygeai/organization/limits/managers.py +1 -4
- pygeai/organization/managers.py +2 -2
- pygeai/proxy/config.py +1 -0
- pygeai/proxy/managers.py +6 -5
- pygeai/tests/admin/test_clients.py +11 -11
- pygeai/tests/assistants/rag/test_clients.py +1 -1
- pygeai/tests/assistants/rag/test_models.py +1 -2
- pygeai/tests/assistants/test_clients.py +1 -1
- pygeai/tests/assistants/test_managers.py +1 -3
- pygeai/tests/auth/test_cli_configuration.py +252 -0
- pygeai/tests/auth/test_client_initialization.py +411 -0
- pygeai/tests/auth/test_clients.py +29 -27
- pygeai/tests/auth/test_config_manager.py +305 -0
- pygeai/tests/auth/test_header_injection.py +294 -0
- pygeai/tests/auth/test_oauth.py +3 -1
- pygeai/tests/auth/test_session_logging.py +119 -0
- pygeai/tests/auth/test_session_validation.py +408 -0
- pygeai/tests/auth/test_singleton_reset.py +201 -0
- pygeai/tests/chat/test_clients.py +1 -1
- pygeai/tests/chat/test_iris.py +1 -1
- pygeai/tests/chat/test_ui.py +0 -2
- pygeai/tests/cli/commands/lab/test_ai_lab.py +1 -3
- pygeai/tests/cli/commands/lab/test_common.py +0 -1
- pygeai/tests/cli/commands/test_chat.py +1 -1
- pygeai/tests/cli/commands/test_common.py +0 -1
- pygeai/tests/cli/commands/test_embeddings.py +2 -2
- pygeai/tests/cli/commands/test_evaluation.py +1 -9
- pygeai/tests/cli/commands/test_llm.py +1 -1
- pygeai/tests/cli/commands/test_migrate.py +1 -1
- pygeai/tests/cli/commands/test_rerank.py +0 -1
- pygeai/tests/cli/commands/test_secrets.py +1 -1
- pygeai/tests/cli/commands/test_show_help.py +0 -1
- pygeai/tests/cli/commands/test_validators.py +0 -1
- pygeai/tests/cli/test_credentials_flag.py +312 -0
- pygeai/tests/cli/test_error_handler.py +0 -1
- pygeai/tests/core/base/test_mappers.py +2 -2
- pygeai/tests/core/base/test_models.py +4 -4
- pygeai/tests/core/common/test_config.py +2 -7
- pygeai/tests/core/common/test_decorators.py +0 -1
- pygeai/tests/core/embeddings/test_managers.py +1 -1
- pygeai/tests/core/feedback/test_clients.py +2 -2
- pygeai/tests/core/files/test_clients.py +6 -6
- pygeai/tests/core/files/test_models.py +0 -1
- pygeai/tests/core/files/test_responses.py +0 -1
- pygeai/tests/core/llm/test_clients.py +1 -1
- pygeai/tests/core/plugins/test_clients.py +4 -4
- pygeai/tests/core/rerank/test_mappers.py +1 -3
- pygeai/tests/core/secrets/test_clients.py +2 -3
- pygeai/tests/core/services/test_rest.py +10 -10
- pygeai/tests/core/utils/test_console.py +0 -1
- pygeai/tests/dbg/test_debugger.py +95 -8
- pygeai/tests/evaluation/dataset/test_clients.py +24 -27
- pygeai/tests/evaluation/plan/test_clients.py +16 -18
- pygeai/tests/evaluation/result/test_clients.py +4 -5
- pygeai/tests/health/test_clients.py +2 -2
- pygeai/tests/integration/lab/agents/test_create_agent.py +1 -3
- pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
- pygeai/tests/integration/lab/processes/test_create_process.py +2 -2
- pygeai/tests/integration/lab/processes/test_create_task.py +2 -3
- pygeai/tests/integration/lab/processes/test_delete_process.py +0 -1
- pygeai/tests/integration/lab/processes/test_get_process.py +2 -4
- pygeai/tests/integration/lab/processes/test_list_process_instances.py +1 -3
- pygeai/tests/integration/lab/processes/test_update_process.py +3 -9
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +1 -2
- pygeai/tests/integration/lab/tools/test_delete_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
- pygeai/tests/integration/lab/tools/test_update_tool.py +1 -1
- pygeai/tests/lab/agents/test_clients.py +17 -17
- pygeai/tests/lab/processes/test_clients.py +67 -67
- pygeai/tests/lab/processes/test_mappers.py +23 -23
- pygeai/tests/lab/spec/test_loader.py +0 -2
- pygeai/tests/lab/spec/test_parsers.py +1 -2
- pygeai/tests/lab/strategies/test_clients.py +10 -10
- pygeai/tests/lab/test_managers.py +3 -5
- pygeai/tests/lab/test_mappers.py +1 -4
- pygeai/tests/lab/tools/test_clients.py +21 -21
- pygeai/tests/lab/tools/test_mappers.py +0 -1
- pygeai/tests/organization/limits/test_clients.py +33 -33
- pygeai/tests/organization/limits/test_managers.py +7 -7
- pygeai/tests/organization/test_clients.py +78 -60
- pygeai/tests/proxy/test_clients.py +1 -1
- pygeai/tests/proxy/test_integration.py +1 -4
- pygeai/tests/proxy/test_managers.py +1 -2
- pygeai/tests/proxy/test_servers.py +1 -2
- pygeai/tests/snippets/assistants/rag/delete_rag_assistant.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_documents.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_rag_assistant_data.py +0 -1
- pygeai/tests/snippets/chat/get_request_status.py +0 -1
- pygeai/tests/snippets/dbg/file_debugging.py +72 -0
- pygeai/tests/snippets/dbg/module_debugging.py +60 -0
- pygeai/tests/snippets/embeddings/cohere_example.py +2 -2
- pygeai/tests/snippets/embeddings/openai_base64_example.py +1 -1
- pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +8 -8
- pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +5 -5
- pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +3 -3
- pygeai/tests/snippets/lab/agentic_flow_example_1.py +1 -1
- pygeai/tests/snippets/lab/agentic_flow_example_2.py +3 -4
- pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +2 -2
- pygeai/tests/snippets/lab/agents/delete_agent.py +1 -2
- pygeai/tests/snippets/lab/agents/get_agent.py +1 -1
- pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +10 -10
- pygeai/tests/snippets/lab/agents/get_sharing_link.py +0 -1
- pygeai/tests/snippets/lab/agents/list_agents.py +1 -1
- pygeai/tests/snippets/lab/agents/publish_agent_revision.py +0 -1
- pygeai/tests/snippets/lab/agents/update_agent_properties.py +1 -1
- pygeai/tests/snippets/lab/crud_ui.py +3 -5
- pygeai/tests/snippets/lab/processes/kbs/get_kb.py +0 -1
- pygeai/tests/snippets/lab/processes/kbs/list_kbs.py +0 -1
- pygeai/tests/snippets/lab/processes/list_processes.py +1 -1
- pygeai/tests/snippets/lab/samples/summarize_files.py +0 -3
- pygeai/tests/snippets/lab/strategies/get_reasoning_strategy.py +0 -1
- pygeai/tests/snippets/lab/strategies/list_reasoning_strategies.py +1 -1
- pygeai/tests/snippets/lab/tools/get_tool.py +1 -1
- pygeai/tests/snippets/lab/tools/publish_tool_revision.py +0 -1
- pygeai/tests/snippets/lab/tools/set_parameters.py +1 -2
- pygeai/tests/snippets/lab/use_cases/c_code_fixer_agent_flow.py +2 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +1 -1
- pygeai/tests/snippets/lab/use_cases/update_cli_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_lab_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_designer.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_reader.py +0 -1
- pygeai/tests/snippets/migrate/orchestrator_examples.py +1 -1
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/METADATA +32 -7
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/RECORD +217 -206
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/top_level.txt +0 -0
|
@@ -26,29 +26,15 @@ def show_help():
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def list_agents(option_list: list):
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if option_flag.name == "project_id":
|
|
39
|
-
project_id = option_arg
|
|
40
|
-
if option_flag.name == "status":
|
|
41
|
-
status = option_arg
|
|
42
|
-
if option_flag.name == "start":
|
|
43
|
-
start = option_arg
|
|
44
|
-
if option_flag.name == "count":
|
|
45
|
-
count = option_arg
|
|
46
|
-
if option_flag.name == "access_scope":
|
|
47
|
-
access_scope = option_arg
|
|
48
|
-
if option_flag.name == "allow_drafts":
|
|
49
|
-
allow_drafts = get_boolean_value(option_arg)
|
|
50
|
-
if option_flag.name == "allow_external":
|
|
51
|
-
allow_external = get_boolean_value(option_arg)
|
|
29
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
30
|
+
|
|
31
|
+
project_id = opts.get('project_id')
|
|
32
|
+
status = opts.get('status', '')
|
|
33
|
+
start = opts.get('start', '')
|
|
34
|
+
count = opts.get('count', '')
|
|
35
|
+
access_scope = opts.get('access_scope', 'public')
|
|
36
|
+
allow_drafts = get_boolean_value(opts['allow_drafts']) if 'allow_drafts' in opts else True
|
|
37
|
+
allow_external = get_boolean_value(opts['allow_external']) if 'allow_external' in opts else False
|
|
52
38
|
|
|
53
39
|
client = AgentClient(project_id=project_id)
|
|
54
40
|
result = client.list_agents(
|
|
@@ -112,9 +98,9 @@ def create_agent(option_list: list):
|
|
|
112
98
|
avatar_image = None
|
|
113
99
|
description = None
|
|
114
100
|
agent_data_prompt_instructions = None
|
|
115
|
-
agent_data_prompt_inputs =
|
|
116
|
-
agent_data_prompt_outputs =
|
|
117
|
-
agent_data_prompt_examples =
|
|
101
|
+
agent_data_prompt_inputs = []
|
|
102
|
+
agent_data_prompt_outputs = []
|
|
103
|
+
agent_data_prompt_examples = []
|
|
118
104
|
agent_data_llm_max_tokens = None
|
|
119
105
|
agent_data_llm_timeout = None
|
|
120
106
|
agent_data_llm_temperature = None
|
|
@@ -154,7 +140,7 @@ def create_agent(option_list: list):
|
|
|
154
140
|
raise ValueError
|
|
155
141
|
|
|
156
142
|
agent_data_prompt_inputs = input_json
|
|
157
|
-
except Exception
|
|
143
|
+
except Exception:
|
|
158
144
|
raise WrongArgumentError(
|
|
159
145
|
"Inputs must be a list of strings: '[\"input_name\", \"another_input\"]'. "
|
|
160
146
|
"Each element in the list must be a string representing an input name."
|
|
@@ -166,7 +152,7 @@ def create_agent(option_list: list):
|
|
|
166
152
|
agent_data_prompt_outputs = output_json
|
|
167
153
|
elif isinstance(output_json, dict):
|
|
168
154
|
agent_data_prompt_outputs.append(output_json)
|
|
169
|
-
except Exception
|
|
155
|
+
except Exception:
|
|
170
156
|
raise WrongArgumentError(
|
|
171
157
|
"Each output must be in JSON format: '{\"key\": \"output_key\", \"description\": \"description of the output\"}' "
|
|
172
158
|
"It must be a dictionary or a list of dictionaries. Each dictionary must contain 'key' and 'description'."
|
|
@@ -179,7 +165,7 @@ def create_agent(option_list: list):
|
|
|
179
165
|
agent_data_prompt_examples = examples_json
|
|
180
166
|
elif isinstance(examples_json, dict):
|
|
181
167
|
agent_data_prompt_examples.append(examples_json)
|
|
182
|
-
except Exception
|
|
168
|
+
except Exception:
|
|
183
169
|
raise WrongArgumentError(
|
|
184
170
|
"Each example must be in JSON format: '{\"inputData\": \"example input\", \"output\": \"expected output in JSON string format\"}' "
|
|
185
171
|
"It must be a dictionary or a list of dictionaries. Each dictionary must contain 'inputData' and 'output'."
|
|
@@ -205,7 +191,7 @@ def create_agent(option_list: list):
|
|
|
205
191
|
if not isinstance(pools_json, list):
|
|
206
192
|
raise ValueError
|
|
207
193
|
agent_data_resource_pools = pools_json
|
|
208
|
-
except Exception
|
|
194
|
+
except Exception:
|
|
209
195
|
raise WrongArgumentError(
|
|
210
196
|
"Resource pools must be in JSON format: '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]' "
|
|
211
197
|
"It must be a list of dictionaries. Each dictionary must contain 'name' and optional 'tools' and 'agents' lists."
|
|
@@ -213,8 +199,11 @@ def create_agent(option_list: list):
|
|
|
213
199
|
if option_flag.name == "automatic_publish":
|
|
214
200
|
automatic_publish = get_boolean_value(option_arg)
|
|
215
201
|
|
|
216
|
-
if not
|
|
217
|
-
raise MissingRequirementException("Cannot create assistant without specifying name
|
|
202
|
+
if not name:
|
|
203
|
+
raise MissingRequirementException("Cannot create assistant without specifying name.")
|
|
204
|
+
|
|
205
|
+
if access_scope == 'public' and not public_name:
|
|
206
|
+
raise MissingRequirementException("If access scope is public, public name must be defined.")
|
|
218
207
|
|
|
219
208
|
prompt_inputs = get_agent_data_prompt_inputs(agent_data_prompt_inputs)
|
|
220
209
|
prompt_outputs = get_agent_data_prompt_outputs(agent_data_prompt_outputs)
|
|
@@ -379,23 +368,13 @@ create_agent_options = [
|
|
|
379
368
|
|
|
380
369
|
|
|
381
370
|
def get_agent(option_list: list):
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if option_flag.name == "project_id":
|
|
390
|
-
project_id = option_arg
|
|
391
|
-
if option_flag.name == "agent_id":
|
|
392
|
-
agent_id = option_arg
|
|
393
|
-
if option_flag.name == "revision":
|
|
394
|
-
revision = option_arg
|
|
395
|
-
if option_flag.name == "version":
|
|
396
|
-
version = option_arg
|
|
397
|
-
if option_flag.name == "allow_drafts":
|
|
398
|
-
allow_drafts = get_boolean_value(option_arg)
|
|
371
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
372
|
+
|
|
373
|
+
project_id = opts.get('project_id')
|
|
374
|
+
agent_id = opts.get('agent_id')
|
|
375
|
+
revision = opts.get('revision', 0)
|
|
376
|
+
version = opts.get('version', 0)
|
|
377
|
+
allow_drafts = get_boolean_value(opts['allow_drafts']) if 'allow_drafts' in opts else True
|
|
399
378
|
|
|
400
379
|
if not agent_id:
|
|
401
380
|
raise MissingRequirementException("Agent ID must be specified.")
|
|
@@ -440,17 +419,11 @@ get_agent_options = [
|
|
|
440
419
|
|
|
441
420
|
|
|
442
421
|
def export_agent(option_list: list):
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
if option_flag.name == "project_id":
|
|
449
|
-
project_id = option_arg
|
|
450
|
-
if option_flag.name == "agent_id":
|
|
451
|
-
agent_id = option_arg
|
|
452
|
-
if option_flag.name == "file":
|
|
453
|
-
file = option_arg
|
|
422
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
423
|
+
|
|
424
|
+
project_id = opts.get('project_id')
|
|
425
|
+
agent_id = opts.get('agent_id')
|
|
426
|
+
file = opts.get('file')
|
|
454
427
|
|
|
455
428
|
if not agent_id:
|
|
456
429
|
raise MissingRequirementException("Agent ID must be specified.")
|
|
@@ -467,7 +440,7 @@ def export_agent(option_list: list):
|
|
|
467
440
|
Console.write_stdout(f"Result from API saved to {file}.")
|
|
468
441
|
except json.JSONDecodeError as e:
|
|
469
442
|
logger.error(f"Result from API endpoint is not in JSON format: {e}")
|
|
470
|
-
Console.write_stderr(
|
|
443
|
+
Console.write_stderr("Result from API endpoint is not in JSON format.")
|
|
471
444
|
else:
|
|
472
445
|
Console.write_stdout(f"Agent spec: \n{result}")
|
|
473
446
|
|
|
@@ -490,15 +463,10 @@ export_agent_options = [
|
|
|
490
463
|
|
|
491
464
|
|
|
492
465
|
def import_agent(option_list: list):
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if option_flag.name == "project_id":
|
|
498
|
-
project_id = option_arg
|
|
499
|
-
if option_flag.name == "file":
|
|
500
|
-
file = option_arg
|
|
501
|
-
|
|
466
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
467
|
+
|
|
468
|
+
project_id = opts.get('project_id')
|
|
469
|
+
file = opts.get('file')
|
|
502
470
|
|
|
503
471
|
if not file:
|
|
504
472
|
raise MissingRequirementException("File path to spec must be specified.")
|
|
@@ -508,7 +476,7 @@ def import_agent(option_list: list):
|
|
|
508
476
|
agent_data = json.load(f)
|
|
509
477
|
except json.JSONDecodeError as e:
|
|
510
478
|
logger.error(f"File is not in JSON format: {e}")
|
|
511
|
-
Console.write_stderr(
|
|
479
|
+
Console.write_stderr("File is not in JSON format.")
|
|
512
480
|
|
|
513
481
|
client = AgentClient(project_id=project_id)
|
|
514
482
|
result = client.import_agent(
|
|
@@ -531,14 +499,10 @@ import_agent_options = [
|
|
|
531
499
|
|
|
532
500
|
|
|
533
501
|
def create_sharing_link(option_list: list):
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if option_flag.name == "project_id":
|
|
539
|
-
project_id = option_arg
|
|
540
|
-
if option_flag.name == "agent_id":
|
|
541
|
-
agent_id = option_arg
|
|
502
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
503
|
+
|
|
504
|
+
project_id = opts.get('project_id')
|
|
505
|
+
agent_id = opts.get('agent_id')
|
|
542
506
|
|
|
543
507
|
if not agent_id:
|
|
544
508
|
raise MissingRequirementException("Agent ID must be specified.")
|
|
@@ -562,17 +526,11 @@ create_sharing_link_options = [
|
|
|
562
526
|
|
|
563
527
|
|
|
564
528
|
def publish_agent_revision(option_list: list):
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if option_flag.name == "project_id":
|
|
571
|
-
project_id = option_arg
|
|
572
|
-
if option_flag.name == "agent_id":
|
|
573
|
-
agent_id = option_arg
|
|
574
|
-
if option_flag.name == "revision":
|
|
575
|
-
revision = option_arg
|
|
529
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
530
|
+
|
|
531
|
+
project_id = opts.get('project_id')
|
|
532
|
+
agent_id = opts.get('agent_id')
|
|
533
|
+
revision = opts.get('revision')
|
|
576
534
|
|
|
577
535
|
if not (agent_id and revision):
|
|
578
536
|
raise MissingRequirementException("Agent ID and revision must be specified.")
|
|
@@ -603,14 +561,10 @@ publish_agent_revision_options = [
|
|
|
603
561
|
|
|
604
562
|
|
|
605
563
|
def delete_agent(option_list: list):
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if option_flag.name == "project_id":
|
|
611
|
-
project_id = option_arg
|
|
612
|
-
if option_flag.name == "agent_id":
|
|
613
|
-
agent_id = option_arg
|
|
564
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
565
|
+
|
|
566
|
+
project_id = opts.get('project_id')
|
|
567
|
+
agent_id = opts.get('agent_id')
|
|
614
568
|
|
|
615
569
|
if not agent_id:
|
|
616
570
|
raise MissingRequirementException("Agent ID must be specified.")
|
|
@@ -643,9 +597,9 @@ def update_agent(option_list: list):
|
|
|
643
597
|
avatar_image = None
|
|
644
598
|
description = None
|
|
645
599
|
agent_data_prompt_instructions = None
|
|
646
|
-
agent_data_prompt_inputs =
|
|
647
|
-
agent_data_prompt_outputs =
|
|
648
|
-
agent_data_prompt_examples =
|
|
600
|
+
agent_data_prompt_inputs = []
|
|
601
|
+
agent_data_prompt_outputs = []
|
|
602
|
+
agent_data_prompt_examples = []
|
|
649
603
|
agent_data_llm_max_tokens = None
|
|
650
604
|
agent_data_llm_timeout = None
|
|
651
605
|
agent_data_llm_temperature = None
|
|
@@ -688,7 +642,7 @@ def update_agent(option_list: list):
|
|
|
688
642
|
raise ValueError
|
|
689
643
|
|
|
690
644
|
agent_data_prompt_inputs = input_json
|
|
691
|
-
except Exception
|
|
645
|
+
except Exception:
|
|
692
646
|
raise WrongArgumentError(
|
|
693
647
|
"Inputs must be a list of strings: '[\"input_name\", \"another_input\"]'. "
|
|
694
648
|
"Each element in the list must be a string representing an input name."
|
|
@@ -700,7 +654,7 @@ def update_agent(option_list: list):
|
|
|
700
654
|
agent_data_prompt_outputs = output_json
|
|
701
655
|
elif isinstance(output_json, dict):
|
|
702
656
|
agent_data_prompt_outputs.append(output_json)
|
|
703
|
-
except Exception
|
|
657
|
+
except Exception:
|
|
704
658
|
raise WrongArgumentError(
|
|
705
659
|
"Each output must be in JSON format: '{\"key\": \"output_key\", \"description\": \"description of the output\"}' "
|
|
706
660
|
"It must be a dictionary or a list of dictionaries. Each dictionary must contain 'key' and 'description'."
|
|
@@ -713,7 +667,7 @@ def update_agent(option_list: list):
|
|
|
713
667
|
agent_data_prompt_examples = examples_json
|
|
714
668
|
elif isinstance(examples_json, dict):
|
|
715
669
|
agent_data_prompt_examples.append(examples_json)
|
|
716
|
-
except Exception
|
|
670
|
+
except Exception:
|
|
717
671
|
raise WrongArgumentError(
|
|
718
672
|
"Each example must be in JSON format: '{\"inputData\": \"example input\", \"output\": \"expected output in JSON string format\"}' "
|
|
719
673
|
"It must be a dictionary or a list of dictionaries. Each dictionary must contain 'inputData' and 'output'."
|
|
@@ -739,7 +693,7 @@ def update_agent(option_list: list):
|
|
|
739
693
|
if not isinstance(pools_json, list):
|
|
740
694
|
raise ValueError
|
|
741
695
|
agent_data_resource_pools = pools_json
|
|
742
|
-
except Exception
|
|
696
|
+
except Exception:
|
|
743
697
|
raise WrongArgumentError(
|
|
744
698
|
"Resource pools must be in JSON format: '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]' "
|
|
745
699
|
"It must be a list of dictionaries. Each dictionary must contain 'name' and optional 'tools' and 'agents' lists."
|
|
@@ -940,7 +894,7 @@ def create_tool(option_list: list):
|
|
|
940
894
|
open_api = None
|
|
941
895
|
open_api_json = None
|
|
942
896
|
report_events = "None"
|
|
943
|
-
parameters =
|
|
897
|
+
parameters = []
|
|
944
898
|
automatic_publish = False
|
|
945
899
|
|
|
946
900
|
for option_flag, option_arg in option_list:
|
|
@@ -965,7 +919,7 @@ def create_tool(option_list: list):
|
|
|
965
919
|
open_api_json = json.loads(option_arg)
|
|
966
920
|
if not isinstance(open_api_json, dict):
|
|
967
921
|
raise ValueError
|
|
968
|
-
except Exception
|
|
922
|
+
except Exception:
|
|
969
923
|
raise WrongArgumentError(
|
|
970
924
|
"open_api_json must be a valid JSON object (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}')"
|
|
971
925
|
)
|
|
@@ -977,7 +931,7 @@ def create_tool(option_list: list):
|
|
|
977
931
|
if not isinstance(param_json, dict):
|
|
978
932
|
raise ValueError
|
|
979
933
|
parameters.append(param_json)
|
|
980
|
-
except Exception
|
|
934
|
+
except Exception:
|
|
981
935
|
raise WrongArgumentError(
|
|
982
936
|
"Each parameter must be in JSON format (e.g., "
|
|
983
937
|
"'{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' "
|
|
@@ -1257,7 +1211,7 @@ def export_tool(option_list: list):
|
|
|
1257
1211
|
Console.write_stdout(f"Result from API saved to {file}.")
|
|
1258
1212
|
except json.JSONDecodeError as e:
|
|
1259
1213
|
logger.error(f"Result from API endpoint is not in JSON format: {e}")
|
|
1260
|
-
Console.write_stderr(
|
|
1214
|
+
Console.write_stderr("Result from API endpoint is not in JSON format.")
|
|
1261
1215
|
|
|
1262
1216
|
|
|
1263
1217
|
|
|
@@ -1332,7 +1286,7 @@ def update_tool(option_list: list):
|
|
|
1332
1286
|
open_api = None
|
|
1333
1287
|
open_api_json = None
|
|
1334
1288
|
report_events = "None"
|
|
1335
|
-
parameters =
|
|
1289
|
+
parameters = []
|
|
1336
1290
|
automatic_publish = False
|
|
1337
1291
|
upsert = False
|
|
1338
1292
|
|
|
@@ -1360,7 +1314,7 @@ def update_tool(option_list: list):
|
|
|
1360
1314
|
open_api_json = json.loads(option_arg)
|
|
1361
1315
|
if not isinstance(open_api_json, dict):
|
|
1362
1316
|
raise ValueError
|
|
1363
|
-
except Exception
|
|
1317
|
+
except Exception:
|
|
1364
1318
|
raise WrongArgumentError(
|
|
1365
1319
|
"open_api_json must be a valid JSON object (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}')"
|
|
1366
1320
|
)
|
|
@@ -1372,7 +1326,7 @@ def update_tool(option_list: list):
|
|
|
1372
1326
|
if not isinstance(param_json, dict):
|
|
1373
1327
|
raise ValueError
|
|
1374
1328
|
parameters.append(param_json)
|
|
1375
|
-
except Exception
|
|
1329
|
+
except Exception:
|
|
1376
1330
|
raise WrongArgumentError(
|
|
1377
1331
|
"Each parameter must be in JSON format (e.g., "
|
|
1378
1332
|
"'{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' "
|
|
@@ -1613,7 +1567,7 @@ def set_parameter(option_list: list):
|
|
|
1613
1567
|
project_id = None
|
|
1614
1568
|
tool_public_name = None
|
|
1615
1569
|
tool_id = None
|
|
1616
|
-
parameters =
|
|
1570
|
+
parameters = []
|
|
1617
1571
|
|
|
1618
1572
|
for option_flag, option_arg in option_list:
|
|
1619
1573
|
if option_flag.name == "project_id":
|
|
@@ -1628,7 +1582,7 @@ def set_parameter(option_list: list):
|
|
|
1628
1582
|
if not isinstance(param_json, dict):
|
|
1629
1583
|
raise ValueError
|
|
1630
1584
|
parameters.append(param_json)
|
|
1631
|
-
except Exception
|
|
1585
|
+
except Exception:
|
|
1632
1586
|
raise WrongArgumentError(
|
|
1633
1587
|
"Each parameter must be in JSON format: "
|
|
1634
1588
|
"'{\"key\": \"param_name\", \"dataType\": \"String\", \"description\": \"param description\", \"isRequired\": true}' "
|
|
@@ -1757,7 +1711,7 @@ def create_reasoning_strategy(option_list: list):
|
|
|
1757
1711
|
system_prompt = None
|
|
1758
1712
|
access_scope = "public"
|
|
1759
1713
|
strategy_type = "addendum"
|
|
1760
|
-
localized_descriptions =
|
|
1714
|
+
localized_descriptions = []
|
|
1761
1715
|
automatic_publish = False
|
|
1762
1716
|
|
|
1763
1717
|
for option_flag, option_arg in option_list:
|
|
@@ -1775,7 +1729,7 @@ def create_reasoning_strategy(option_list: list):
|
|
|
1775
1729
|
if not isinstance(desc_json, dict) or "language" not in desc_json or "description" not in desc_json:
|
|
1776
1730
|
raise ValueError
|
|
1777
1731
|
localized_descriptions.append(desc_json)
|
|
1778
|
-
except Exception
|
|
1732
|
+
except Exception:
|
|
1779
1733
|
raise WrongArgumentError(
|
|
1780
1734
|
"Each localized description must be in JSON format: "
|
|
1781
1735
|
"'{\"language\": \"english\", \"description\": \"description text\"}'"
|
|
@@ -1860,7 +1814,7 @@ def update_reasoning_strategy(option_list: list):
|
|
|
1860
1814
|
system_prompt = None
|
|
1861
1815
|
access_scope = None
|
|
1862
1816
|
strategy_type = None
|
|
1863
|
-
localized_descriptions =
|
|
1817
|
+
localized_descriptions = []
|
|
1864
1818
|
automatic_publish = False
|
|
1865
1819
|
upsert = False
|
|
1866
1820
|
|
|
@@ -1881,7 +1835,7 @@ def update_reasoning_strategy(option_list: list):
|
|
|
1881
1835
|
if not isinstance(desc_json, dict) or "language" not in desc_json or "description" not in desc_json:
|
|
1882
1836
|
raise ValueError
|
|
1883
1837
|
localized_descriptions.append(desc_json)
|
|
1884
|
-
except Exception
|
|
1838
|
+
except Exception:
|
|
1885
1839
|
raise WrongArgumentError(
|
|
1886
1840
|
"Each localized description must be in JSON format: "
|
|
1887
1841
|
"'{\"language\": \"english\", \"description\": \"description text\"}'"
|
|
@@ -2023,12 +1977,12 @@ def create_process(option_list: list):
|
|
|
2023
1977
|
name = None
|
|
2024
1978
|
description = None
|
|
2025
1979
|
kb = None
|
|
2026
|
-
agentic_activities =
|
|
2027
|
-
artifact_signals =
|
|
2028
|
-
user_signals =
|
|
1980
|
+
agentic_activities = []
|
|
1981
|
+
artifact_signals = []
|
|
1982
|
+
user_signals = []
|
|
2029
1983
|
start_event = None
|
|
2030
1984
|
end_event = None
|
|
2031
|
-
sequence_flows =
|
|
1985
|
+
sequence_flows = []
|
|
2032
1986
|
automatic_publish = False
|
|
2033
1987
|
|
|
2034
1988
|
for option_flag, option_arg in option_list:
|
|
@@ -2045,7 +1999,7 @@ def create_process(option_list: list):
|
|
|
2045
1999
|
kb = json.loads(option_arg)
|
|
2046
2000
|
if not isinstance(kb, dict) or "name" not in kb or "artifactTypeName" not in kb:
|
|
2047
2001
|
raise ValueError
|
|
2048
|
-
except Exception
|
|
2002
|
+
except Exception:
|
|
2049
2003
|
raise WrongArgumentError(
|
|
2050
2004
|
"KB must be in JSON format: "
|
|
2051
2005
|
"'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}'"
|
|
@@ -2058,7 +2012,7 @@ def create_process(option_list: list):
|
|
|
2058
2012
|
elif not isinstance(activity_json, dict) or "key" not in activity_json or "name" not in activity_json:
|
|
2059
2013
|
raise ValueError
|
|
2060
2014
|
agentic_activities.append(activity_json)
|
|
2061
|
-
except Exception
|
|
2015
|
+
except Exception:
|
|
2062
2016
|
raise WrongArgumentError(
|
|
2063
2017
|
"Each agentic activity must be in JSON format: "
|
|
2064
2018
|
"'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
|
|
@@ -2070,7 +2024,7 @@ def create_process(option_list: list):
|
|
|
2070
2024
|
if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
|
|
2071
2025
|
raise ValueError
|
|
2072
2026
|
artifact_signals.append(signal_json)
|
|
2073
|
-
except Exception
|
|
2027
|
+
except Exception:
|
|
2074
2028
|
raise WrongArgumentError(
|
|
2075
2029
|
"Each artifact signal must be in JSON format: "
|
|
2076
2030
|
"'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
|
|
@@ -2082,7 +2036,7 @@ def create_process(option_list: list):
|
|
|
2082
2036
|
if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
|
|
2083
2037
|
raise ValueError
|
|
2084
2038
|
user_signals.append(signal_json)
|
|
2085
|
-
except Exception
|
|
2039
|
+
except Exception:
|
|
2086
2040
|
raise WrongArgumentError(
|
|
2087
2041
|
"Each user signal must be in JSON format: "
|
|
2088
2042
|
"'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'"
|
|
@@ -2092,7 +2046,7 @@ def create_process(option_list: list):
|
|
|
2092
2046
|
start_event = json.loads(option_arg)
|
|
2093
2047
|
if not isinstance(start_event, dict) or "key" not in start_event or "name" not in start_event:
|
|
2094
2048
|
raise ValueError
|
|
2095
|
-
except Exception
|
|
2049
|
+
except Exception:
|
|
2096
2050
|
raise WrongArgumentError(
|
|
2097
2051
|
"Start event must be in JSON format: "
|
|
2098
2052
|
"'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}'"
|
|
@@ -2102,7 +2056,7 @@ def create_process(option_list: list):
|
|
|
2102
2056
|
end_event = json.loads(option_arg)
|
|
2103
2057
|
if not isinstance(end_event, dict) or "key" not in end_event or "name" not in end_event:
|
|
2104
2058
|
raise ValueError
|
|
2105
|
-
except Exception
|
|
2059
|
+
except Exception:
|
|
2106
2060
|
raise WrongArgumentError(
|
|
2107
2061
|
"End event must be in JSON format: "
|
|
2108
2062
|
"'{\"key\": \"end\", \"name\": \"Done\"}'"
|
|
@@ -2113,7 +2067,7 @@ def create_process(option_list: list):
|
|
|
2113
2067
|
if not isinstance(flow_json, dict) or "key" not in flow_json or "sourceKey" not in flow_json or "targetKey" not in flow_json:
|
|
2114
2068
|
raise ValueError
|
|
2115
2069
|
sequence_flows.append(flow_json)
|
|
2116
|
-
except Exception
|
|
2070
|
+
except Exception:
|
|
2117
2071
|
raise WrongArgumentError(
|
|
2118
2072
|
"Each sequence flow must be in JSON format: "
|
|
2119
2073
|
"'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'"
|
|
@@ -2235,12 +2189,12 @@ def update_process(option_list: list):
|
|
|
2235
2189
|
key = None
|
|
2236
2190
|
description = None
|
|
2237
2191
|
kb = None
|
|
2238
|
-
agentic_activities =
|
|
2239
|
-
artifact_signals =
|
|
2240
|
-
user_signals =
|
|
2192
|
+
agentic_activities = []
|
|
2193
|
+
artifact_signals = []
|
|
2194
|
+
user_signals = []
|
|
2241
2195
|
start_event = None
|
|
2242
2196
|
end_event = None
|
|
2243
|
-
sequence_flows =
|
|
2197
|
+
sequence_flows = []
|
|
2244
2198
|
automatic_publish = False
|
|
2245
2199
|
upsert = False
|
|
2246
2200
|
|
|
@@ -2260,7 +2214,7 @@ def update_process(option_list: list):
|
|
|
2260
2214
|
kb = json.loads(option_arg)
|
|
2261
2215
|
if not isinstance(kb, dict) or "name" not in kb or "artifactTypeName" not in kb:
|
|
2262
2216
|
raise ValueError
|
|
2263
|
-
except Exception
|
|
2217
|
+
except Exception:
|
|
2264
2218
|
raise WrongArgumentError(
|
|
2265
2219
|
"KB must be in JSON format: "
|
|
2266
2220
|
"'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}'"
|
|
@@ -2273,7 +2227,7 @@ def update_process(option_list: list):
|
|
|
2273
2227
|
elif not isinstance(activity_json, dict) or "key" not in activity_json or "name" not in activity_json:
|
|
2274
2228
|
raise ValueError
|
|
2275
2229
|
agentic_activities.append(activity_json)
|
|
2276
|
-
except Exception
|
|
2230
|
+
except Exception:
|
|
2277
2231
|
raise WrongArgumentError(
|
|
2278
2232
|
"Each agentic activity must be in JSON format: "
|
|
2279
2233
|
"'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
|
|
@@ -2285,7 +2239,7 @@ def update_process(option_list: list):
|
|
|
2285
2239
|
if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
|
|
2286
2240
|
raise ValueError
|
|
2287
2241
|
artifact_signals.append(signal_json)
|
|
2288
|
-
except Exception
|
|
2242
|
+
except Exception:
|
|
2289
2243
|
raise WrongArgumentError(
|
|
2290
2244
|
"Each artifact signal must be in JSON format: "
|
|
2291
2245
|
"'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
|
|
@@ -2297,7 +2251,7 @@ def update_process(option_list: list):
|
|
|
2297
2251
|
if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
|
|
2298
2252
|
raise ValueError
|
|
2299
2253
|
user_signals.append(signal_json)
|
|
2300
|
-
except Exception
|
|
2254
|
+
except Exception:
|
|
2301
2255
|
raise WrongArgumentError(
|
|
2302
2256
|
"Each user signal must be in JSON format: "
|
|
2303
2257
|
"'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'"
|
|
@@ -2307,7 +2261,7 @@ def update_process(option_list: list):
|
|
|
2307
2261
|
start_event = json.loads(option_arg)
|
|
2308
2262
|
if not isinstance(start_event, dict) or "key" not in start_event or "name" not in start_event:
|
|
2309
2263
|
raise ValueError
|
|
2310
|
-
except Exception
|
|
2264
|
+
except Exception:
|
|
2311
2265
|
raise WrongArgumentError(
|
|
2312
2266
|
"Start event must be in JSON format: "
|
|
2313
2267
|
"'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}'"
|
|
@@ -2317,7 +2271,7 @@ def update_process(option_list: list):
|
|
|
2317
2271
|
end_event = json.loads(option_arg)
|
|
2318
2272
|
if not isinstance(end_event, dict) or "key" not in end_event or "name" not in end_event:
|
|
2319
2273
|
raise ValueError
|
|
2320
|
-
except Exception
|
|
2274
|
+
except Exception:
|
|
2321
2275
|
raise WrongArgumentError(
|
|
2322
2276
|
"End event must be in JSON format: "
|
|
2323
2277
|
"'{\"key\": \"end\", \"name\": \"Done\"}'"
|
|
@@ -2328,7 +2282,7 @@ def update_process(option_list: list):
|
|
|
2328
2282
|
if not isinstance(flow_json, dict) or "key" not in flow_json or "sourceKey" not in flow_json or "targetKey" not in flow_json:
|
|
2329
2283
|
raise ValueError
|
|
2330
2284
|
sequence_flows.append(flow_json)
|
|
2331
|
-
except Exception
|
|
2285
|
+
except Exception:
|
|
2332
2286
|
raise WrongArgumentError(
|
|
2333
2287
|
"Each sequence flow must be in JSON format: "
|
|
2334
2288
|
"'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'"
|
|
@@ -3422,7 +3376,7 @@ def create_kb(option_list: list):
|
|
|
3422
3376
|
artifacts = json.loads(option_arg)
|
|
3423
3377
|
if not isinstance(artifacts, list):
|
|
3424
3378
|
raise ValueError
|
|
3425
|
-
except Exception
|
|
3379
|
+
except Exception:
|
|
3426
3380
|
raise WrongArgumentError(
|
|
3427
3381
|
"Artifacts must be a JSON list of strings: '[\"artifact1\", \"artifact2\"]'"
|
|
3428
3382
|
)
|
|
@@ -3431,7 +3385,7 @@ def create_kb(option_list: list):
|
|
|
3431
3385
|
metadata = json.loads(option_arg)
|
|
3432
3386
|
if not isinstance(metadata, list):
|
|
3433
3387
|
raise ValueError
|
|
3434
|
-
except Exception
|
|
3388
|
+
except Exception:
|
|
3435
3389
|
raise WrongArgumentError(
|
|
3436
3390
|
"Metadata must be a JSON list of strings: '[\"meta1\", \"meta2\"]'"
|
|
3437
3391
|
)
|
|
@@ -123,7 +123,7 @@ def get_tool_parameters(parameter_list: list) -> list:
|
|
|
123
123
|
|
|
124
124
|
parameters.append(validated_param)
|
|
125
125
|
|
|
126
|
-
except (KeyError, TypeError)
|
|
126
|
+
except (KeyError, TypeError):
|
|
127
127
|
raise WrongArgumentError(
|
|
128
128
|
"Each parameter must be in JSON format: "
|
|
129
129
|
"'{\"key\": \"param_name\", \"dataType\": \"String\", \"description\": \"param description\", \"isRequired\": true}' "
|
pygeai/cli/commands/lab/spec.py
CHANGED
|
@@ -19,14 +19,9 @@ def show_help():
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def load_agent(option_list: list):
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for option_flag, option_arg in option_list:
|
|
26
|
-
if option_flag.name == "file":
|
|
27
|
-
file = option_arg
|
|
28
|
-
if option_flag.name == "automatic_publish":
|
|
29
|
-
automatic_publish = option_arg
|
|
22
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
23
|
+
file = opts.get("file")
|
|
24
|
+
automatic_publish = opts.get("automatic_publish", False)
|
|
30
25
|
|
|
31
26
|
if not file:
|
|
32
27
|
raise MissingRequirementException("Cannot load agent definition without specifying path to JSON file.")
|
|
@@ -71,14 +66,9 @@ load_agent_options = [
|
|
|
71
66
|
|
|
72
67
|
|
|
73
68
|
def load_tool(option_list: list):
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
for option_flag, option_arg in option_list:
|
|
78
|
-
if option_flag.name == "file":
|
|
79
|
-
file = option_arg
|
|
80
|
-
if option_flag.name == "automatic_publish":
|
|
81
|
-
automatic_publish = option_arg
|
|
69
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
70
|
+
file = opts.get("file")
|
|
71
|
+
automatic_publish = opts.get("automatic_publish", False)
|
|
82
72
|
|
|
83
73
|
if not file:
|
|
84
74
|
raise MissingRequirementException("Cannot load tool definition without specifying path to JSON file.")
|
|
@@ -122,14 +112,9 @@ load_tool_options = [
|
|
|
122
112
|
|
|
123
113
|
|
|
124
114
|
def load_task(option_list: list):
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
for option_flag, option_arg in option_list:
|
|
129
|
-
if option_flag.name == "file":
|
|
130
|
-
file = option_arg
|
|
131
|
-
if option_flag.name == "automatic_publish":
|
|
132
|
-
automatic_publish = option_arg
|
|
115
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
116
|
+
file = opts.get("file")
|
|
117
|
+
automatic_publish = opts.get("automatic_publish", False)
|
|
133
118
|
|
|
134
119
|
if not file:
|
|
135
120
|
raise MissingRequirementException("Cannot load task definition without specifying path to JSON file.")
|
|
@@ -173,14 +158,9 @@ load_task_options = [
|
|
|
173
158
|
|
|
174
159
|
|
|
175
160
|
def load_agentic_process(option_list: list):
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
for option_flag, option_arg in option_list:
|
|
180
|
-
if option_flag.name == "file":
|
|
181
|
-
file = option_arg
|
|
182
|
-
if option_flag.name == "automatic_publish":
|
|
183
|
-
automatic_publish = option_arg
|
|
161
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
162
|
+
file = opts.get("file")
|
|
163
|
+
automatic_publish = opts.get("automatic_publish", False)
|
|
184
164
|
|
|
185
165
|
|
|
186
166
|
if not file:
|