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
pygeai/cli/commands/assistant.py
CHANGED
|
@@ -19,13 +19,9 @@ def show_help():
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def get_assistant_detail(option_list: list):
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if option_flag.name == "detail":
|
|
26
|
-
detail = option_arg
|
|
27
|
-
if option_flag.name == "assistant_id":
|
|
28
|
-
assistant_id = option_arg
|
|
22
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
23
|
+
detail = opts.get("detail", "summary")
|
|
24
|
+
assistant_id = opts.get("assistant_id")
|
|
29
25
|
|
|
30
26
|
if not assistant_id:
|
|
31
27
|
raise MissingRequirementException("Cannot retrieve assistant detail without assistant_id")
|
|
@@ -52,58 +48,43 @@ assistant_detail_options = [
|
|
|
52
48
|
|
|
53
49
|
|
|
54
50
|
def create_assistant(option_list: list):
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
52
|
+
assistant_type = opts.get("type", "text")
|
|
53
|
+
name = opts.get("name")
|
|
54
|
+
description = opts.get("description")
|
|
55
|
+
prompt = opts.get("prompt")
|
|
56
|
+
provider_name = opts.get("provider_name")
|
|
57
|
+
model_name = opts.get("model_name")
|
|
58
|
+
max_tokens = opts.get("max_tokens")
|
|
59
|
+
welcome_data_title = opts.get("welcome_data_title")
|
|
60
|
+
welcome_data_description = opts.get("welcome_data_description")
|
|
61
|
+
|
|
61
62
|
temperature = None
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
temp_arg = opts.get("temperature")
|
|
64
|
+
if temp_arg:
|
|
65
|
+
try:
|
|
66
|
+
temperature = float(temp_arg)
|
|
67
|
+
except Exception:
|
|
68
|
+
raise WrongArgumentError("When defined, temperature must be a decimal numer. Example: 0.5")
|
|
69
|
+
|
|
67
70
|
feature_list = []
|
|
71
|
+
feature_arg = opts.get("welcome_data_feature")
|
|
72
|
+
if feature_arg:
|
|
73
|
+
feature_list = get_welcome_data_feature_list([], feature_arg)
|
|
74
|
+
|
|
68
75
|
examples_prompt_list = []
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
assistant_type = option_arg
|
|
73
|
-
if option_flag.name == "name":
|
|
74
|
-
name = option_arg
|
|
75
|
-
if option_flag.name == "description":
|
|
76
|
-
description = option_arg
|
|
77
|
-
if option_flag.name == "prompt":
|
|
78
|
-
prompt = option_arg
|
|
79
|
-
if option_flag.name == "provider_name":
|
|
80
|
-
provider_name = option_arg
|
|
81
|
-
if option_flag.name == "model_name":
|
|
82
|
-
model_name = option_arg
|
|
83
|
-
if option_flag.name == "temperature":
|
|
84
|
-
if option_arg:
|
|
85
|
-
try:
|
|
86
|
-
temperature = float(option_arg)
|
|
87
|
-
except Exception as e:
|
|
88
|
-
raise WrongArgumentError("When defined, temperature must be a decimal numer. Example: 0.5")
|
|
89
|
-
|
|
90
|
-
if option_flag.name == "max_tokens":
|
|
91
|
-
max_tokens = option_arg
|
|
92
|
-
if option_flag.name == "welcome_data_title":
|
|
93
|
-
welcome_data_title = option_arg
|
|
94
|
-
if option_flag.name == "welcome_data_description":
|
|
95
|
-
welcome_data_description = option_arg
|
|
96
|
-
if option_flag.name == "welcome_data_feature":
|
|
97
|
-
feature_list = get_welcome_data_feature_list(feature_list, option_arg)
|
|
98
|
-
if option_flag.name == "welcome_data_example_prompt":
|
|
99
|
-
examples_prompt_list = get_welcome_data_example_prompt(examples_prompt_list, option_arg)
|
|
76
|
+
examples_arg = opts.get("welcome_data_example_prompt")
|
|
77
|
+
if examples_arg:
|
|
78
|
+
examples_prompt_list = get_welcome_data_example_prompt([], examples_arg)
|
|
100
79
|
|
|
101
80
|
if not (assistant_type and name and prompt):
|
|
102
81
|
raise MissingRequirementException("Cannot create new assistant without 'type', 'name' and 'prompt'")
|
|
103
82
|
|
|
83
|
+
llm_settings = {}
|
|
104
84
|
if provider_name or model_name or temperature or max_tokens:
|
|
105
85
|
llm_settings = get_llm_settings(provider_name, model_name, temperature, max_tokens)
|
|
106
86
|
|
|
87
|
+
welcome_data = {}
|
|
107
88
|
if welcome_data_title or welcome_data_description:
|
|
108
89
|
welcome_data = get_welcome_data(
|
|
109
90
|
welcome_data_title,
|
|
@@ -205,60 +186,37 @@ create_assistant_options = [
|
|
|
205
186
|
|
|
206
187
|
|
|
207
188
|
def update_assistant(option_list: list):
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
189
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
190
|
+
assistant_id = opts.get("assistant_id")
|
|
191
|
+
name = opts.get("name")
|
|
192
|
+
description = opts.get("description")
|
|
193
|
+
status = opts.get("status", 1)
|
|
194
|
+
action = opts.get("action", "saveNewRevision")
|
|
195
|
+
revision_id = opts.get("revision_id")
|
|
196
|
+
prompt = opts.get("prompt")
|
|
197
|
+
provider_name = opts.get("provider_name")
|
|
198
|
+
model_name = opts.get("model_name")
|
|
199
|
+
max_tokens = opts.get("max_tokens")
|
|
200
|
+
welcome_data_title = opts.get("welcome_data_title")
|
|
201
|
+
welcome_data_description = opts.get("welcome_data_description")
|
|
202
|
+
|
|
217
203
|
temperature = None
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
204
|
+
temp_arg = opts.get("temperature")
|
|
205
|
+
if temp_arg:
|
|
206
|
+
try:
|
|
207
|
+
temperature = float(temp_arg)
|
|
208
|
+
except Exception:
|
|
209
|
+
raise WrongArgumentError("When defined, temperature must be a decimal numer. Example: 0.5")
|
|
210
|
+
|
|
223
211
|
feature_list = []
|
|
212
|
+
feature_arg = opts.get("welcome_data_feature")
|
|
213
|
+
if feature_arg:
|
|
214
|
+
feature_list = get_welcome_data_feature_list([], feature_arg)
|
|
215
|
+
|
|
224
216
|
examples_prompt_list = []
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
assistant_id = option_arg
|
|
229
|
-
if option_flag.name == "name":
|
|
230
|
-
name = option_arg
|
|
231
|
-
if option_flag.name == "description":
|
|
232
|
-
description = option_arg
|
|
233
|
-
if option_flag.name == "status":
|
|
234
|
-
status = option_arg
|
|
235
|
-
if option_flag.name == "action":
|
|
236
|
-
action = option_arg
|
|
237
|
-
if option_flag.name == "revision_id":
|
|
238
|
-
revision_id = option_arg
|
|
239
|
-
if option_flag.name == "prompt":
|
|
240
|
-
prompt = option_arg
|
|
241
|
-
if option_flag.name == "provider_name":
|
|
242
|
-
provider_name = option_arg
|
|
243
|
-
if option_flag.name == "model_name":
|
|
244
|
-
model_name = option_arg
|
|
245
|
-
if option_flag.name == "temperature":
|
|
246
|
-
if option_arg:
|
|
247
|
-
try:
|
|
248
|
-
temperature = float(option_arg)
|
|
249
|
-
except Exception as e:
|
|
250
|
-
raise WrongArgumentError("When defined, temperature must be a decimal numer. Example: 0.5")
|
|
251
|
-
|
|
252
|
-
if option_flag.name == "max_tokens":
|
|
253
|
-
max_tokens = option_arg
|
|
254
|
-
if option_flag.name == "welcome_data_title":
|
|
255
|
-
welcome_data_title = option_arg
|
|
256
|
-
if option_flag.name == "welcome_data_description":
|
|
257
|
-
welcome_data_description = option_arg
|
|
258
|
-
if option_flag.name == "welcome_data_feature":
|
|
259
|
-
feature_list = get_welcome_data_feature_list(feature_list, option_arg)
|
|
260
|
-
if option_flag.name == "welcome_data_example_prompt":
|
|
261
|
-
examples_prompt_list = get_welcome_data_example_prompt(examples_prompt_list, option_arg)
|
|
217
|
+
examples_arg = opts.get("welcome_data_example_prompt")
|
|
218
|
+
if examples_arg:
|
|
219
|
+
examples_prompt_list = get_welcome_data_example_prompt([], examples_arg)
|
|
262
220
|
|
|
263
221
|
if not assistant_id:
|
|
264
222
|
raise MissingRequirementException("Cannot update existing assistant without 'assistant_id'")
|
|
@@ -269,9 +227,11 @@ def update_assistant(option_list: list):
|
|
|
269
227
|
if ((action == "saveNewRevision" or action == "savePublishNewRevision") or revision_id) and not prompt:
|
|
270
228
|
raise MissingRequirementException("Prompt must be defined if revisionId is specified or in case of actions saveNewRevision and savePublishNewRevision.")
|
|
271
229
|
|
|
230
|
+
llm_settings = {}
|
|
272
231
|
if provider_name or model_name or temperature or max_tokens:
|
|
273
232
|
llm_settings = get_llm_settings(provider_name, model_name, temperature, max_tokens)
|
|
274
233
|
|
|
234
|
+
welcome_data = {}
|
|
275
235
|
if welcome_data_title or welcome_data_description:
|
|
276
236
|
welcome_data = get_welcome_data(welcome_data_title, welcome_data_description, feature_list, examples_prompt_list)
|
|
277
237
|
|
|
@@ -389,10 +349,8 @@ update_assistant_options = [
|
|
|
389
349
|
|
|
390
350
|
|
|
391
351
|
def delete_assistant(option_list: list):
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if option_flag.name == "assistant_id":
|
|
395
|
-
assistant_id = option_arg
|
|
352
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
353
|
+
assistant_id = opts.get("assistant_id")
|
|
396
354
|
|
|
397
355
|
if not assistant_id:
|
|
398
356
|
raise MissingRequirementException("Cannot delete assistant without 'assistant_id'")
|
|
@@ -415,38 +373,30 @@ delete_assistant_options = [
|
|
|
415
373
|
|
|
416
374
|
|
|
417
375
|
def send_chat_request(option_list: list):
|
|
418
|
-
|
|
376
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
377
|
+
assistant_name = opts.get("assistant_name")
|
|
378
|
+
revision = opts.get("revision")
|
|
379
|
+
revision_name = opts.get("revision_name")
|
|
380
|
+
|
|
419
381
|
message_list = []
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
message_list.append(message_json)
|
|
433
|
-
except Exception as e:
|
|
434
|
-
raise WrongArgumentError(
|
|
435
|
-
"Each message must be in json format: '{\"role\": \"user\", \"content\": \"message content\"}' "
|
|
436
|
-
"It can be a dictionary or a list of dictionaries. Each dictionary must contain role and content")
|
|
437
|
-
|
|
438
|
-
if option_flag.name == "revision":
|
|
439
|
-
revision = option_arg
|
|
440
|
-
if option_flag.name == "revision_name":
|
|
441
|
-
revision_name = option_arg
|
|
382
|
+
messages_arg = opts.get("messages")
|
|
383
|
+
if messages_arg:
|
|
384
|
+
try:
|
|
385
|
+
message_json = json.loads(messages_arg)
|
|
386
|
+
if isinstance(message_json, list):
|
|
387
|
+
message_list = message_json
|
|
388
|
+
elif isinstance(message_json, dict):
|
|
389
|
+
message_list.append(message_json)
|
|
390
|
+
except Exception:
|
|
391
|
+
raise WrongArgumentError(
|
|
392
|
+
"Each message must be in json format: '{\"role\": \"user\", \"content\": \"message content\"}' "
|
|
393
|
+
"It can be a dictionary or a list of dictionaries. Each dictionary must contain role and content")
|
|
442
394
|
|
|
443
395
|
if not assistant_name:
|
|
444
396
|
raise MissingRequirementException("Cannot send chat request without specifying assistant name")
|
|
445
397
|
|
|
446
398
|
messages = get_messages(message_list)
|
|
447
399
|
|
|
448
|
-
# TODO -> Add variables handling
|
|
449
|
-
|
|
450
400
|
client = AssistantClient()
|
|
451
401
|
result = client.send_chat_request(
|
|
452
402
|
assistant_name=assistant_name,
|
|
@@ -480,7 +430,7 @@ send_chat_request_options = [
|
|
|
480
430
|
Option(
|
|
481
431
|
"revision_name",
|
|
482
432
|
["--revision-name"],
|
|
483
|
-
"string
|
|
433
|
+
"string:\tName of the revision.",
|
|
484
434
|
True
|
|
485
435
|
),
|
|
486
436
|
Option(
|
|
@@ -493,10 +443,8 @@ send_chat_request_options = [
|
|
|
493
443
|
|
|
494
444
|
|
|
495
445
|
def get_request_status(option_list: list):
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
if option_flag.name == "request_id":
|
|
499
|
-
request_id = option_arg
|
|
446
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
447
|
+
request_id = opts.get("request_id")
|
|
500
448
|
|
|
501
449
|
if not request_id:
|
|
502
450
|
raise MissingRequirementException("Cannot retrieve status of request without request_id.")
|
|
@@ -517,10 +465,8 @@ request_status_options = [
|
|
|
517
465
|
|
|
518
466
|
|
|
519
467
|
def cancel_request(option_list: list):
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if option_flag.name == "request_id":
|
|
523
|
-
request_id = option_arg
|
|
468
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
469
|
+
request_id = opts.get("request_id")
|
|
524
470
|
|
|
525
471
|
if not request_id:
|
|
526
472
|
raise MissingRequirementException("Cannot cancel request without request_id.")
|
pygeai/cli/commands/auth.py
CHANGED
|
@@ -2,7 +2,7 @@ from pygeai.auth.clients import AuthClient
|
|
|
2
2
|
from pygeai.cli.commands import Command, Option, ArgumentsEnum
|
|
3
3
|
from pygeai.cli.commands.builders import build_help_text
|
|
4
4
|
from pygeai.cli.texts.help import AUTH_HELP_TEXT
|
|
5
|
-
from pygeai.core.common.exceptions import MissingRequirementException
|
|
5
|
+
from pygeai.core.common.exceptions import MissingRequirementException
|
|
6
6
|
from pygeai.core.utils.console import Console
|
|
7
7
|
|
|
8
8
|
|
|
@@ -15,19 +15,12 @@ def show_help():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def get_oauth2_access_token(option_list: list):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
client_id = option_arg
|
|
25
|
-
if option_flag.name == "username":
|
|
26
|
-
username = option_arg
|
|
27
|
-
if option_flag.name == "password":
|
|
28
|
-
password = option_arg
|
|
29
|
-
if option_flag.name == "scope":
|
|
30
|
-
scope = option_arg
|
|
18
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
19
|
+
|
|
20
|
+
client_id = opts.get('client_id')
|
|
21
|
+
username = opts.get('username')
|
|
22
|
+
password = opts.get('password')
|
|
23
|
+
scope = opts.get('scope', "gam_user_data gam_user_roles")
|
|
31
24
|
|
|
32
25
|
if not (client_id and username and password):
|
|
33
26
|
raise MissingRequirementException("Cannot obtain Oauth2 access token without client_id, username and password")
|
|
@@ -72,10 +65,8 @@ get_oauth2_access_token_options = [
|
|
|
72
65
|
|
|
73
66
|
|
|
74
67
|
def get_user_profile_information(option_list: list):
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if option_flag.name == "access_token":
|
|
78
|
-
access_token = option_arg
|
|
68
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
69
|
+
access_token = opts.get('access_token')
|
|
79
70
|
|
|
80
71
|
client = AuthClient()
|
|
81
72
|
result = client.get_user_profile_information(access_token=access_token)
|
|
@@ -93,16 +84,11 @@ get_user_profile_information_options = [
|
|
|
93
84
|
|
|
94
85
|
|
|
95
86
|
def create_project_api_token(option_list: list):
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
project_id = option_arg
|
|
102
|
-
if option_flag.name == "name":
|
|
103
|
-
name = option_arg
|
|
104
|
-
if option_flag.name == "description":
|
|
105
|
-
description = option_arg
|
|
87
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
88
|
+
|
|
89
|
+
project_id = opts.get('project_id')
|
|
90
|
+
name = opts.get('name')
|
|
91
|
+
description = opts.get('description')
|
|
106
92
|
|
|
107
93
|
if not (project_id and name):
|
|
108
94
|
raise MissingRequirementException("Cannot create project API token without project-id and name")
|
|
@@ -139,10 +125,8 @@ create_project_api_token_options = [
|
|
|
139
125
|
|
|
140
126
|
|
|
141
127
|
def delete_project_api_token(option_list: list):
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if option_flag.name == "api_token_id":
|
|
145
|
-
api_token_id = option_arg
|
|
128
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
129
|
+
api_token_id = opts.get('api_token_id')
|
|
146
130
|
|
|
147
131
|
if not api_token_id:
|
|
148
132
|
raise MissingRequirementException("Cannot delete project API token without api-token-id")
|
|
@@ -163,16 +147,11 @@ delete_project_api_token_options = [
|
|
|
163
147
|
|
|
164
148
|
|
|
165
149
|
def update_project_api_token(option_list: list):
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
api_token_id = option_arg
|
|
172
|
-
if option_flag.name == "description":
|
|
173
|
-
description = option_arg
|
|
174
|
-
if option_flag.name == "status":
|
|
175
|
-
status = option_arg
|
|
150
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
151
|
+
|
|
152
|
+
api_token_id = opts.get('api_token_id')
|
|
153
|
+
description = opts.get('description')
|
|
154
|
+
status = opts.get('status')
|
|
176
155
|
|
|
177
156
|
if not api_token_id:
|
|
178
157
|
raise MissingRequirementException("Cannot update project API token without api-token-id")
|
|
@@ -209,10 +188,8 @@ update_project_api_token_options = [
|
|
|
209
188
|
|
|
210
189
|
|
|
211
190
|
def get_project_api_token(option_list: list):
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if option_flag.name == "api_token_id":
|
|
215
|
-
api_token_id = option_arg
|
|
191
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
192
|
+
api_token_id = opts.get('api_token_id')
|
|
216
193
|
|
|
217
194
|
if not api_token_id:
|
|
218
195
|
raise MissingRequirementException("Cannot get project API token without api-token-id")
|
pygeai/cli/commands/base.py
CHANGED
|
@@ -6,7 +6,6 @@ from pygeai.cli.commands.auth import auth_commands
|
|
|
6
6
|
from pygeai.cli.commands.builders import build_help_text
|
|
7
7
|
from pygeai.cli.commands.chat import chat_commands
|
|
8
8
|
from pygeai.cli.commands.configuration import configure, configuration_options
|
|
9
|
-
from pygeai.cli.commands.docs import docs_commands
|
|
10
9
|
from pygeai.cli.commands.embeddings import embeddings_commands
|
|
11
10
|
from pygeai.cli.commands.evaluation import evaluation_commands
|
|
12
11
|
from pygeai.cli.commands.feedback import feedback_commands
|