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
|
@@ -6,57 +6,66 @@ from pygeai.core.utils.console import Console
|
|
|
6
6
|
def configure(option_list: list[str, str] = None):
|
|
7
7
|
if not any(option_list):
|
|
8
8
|
Console.write_stdout("# Configuring GEAI credentials...")
|
|
9
|
-
alias = str(input("-> Select an alias (Leave empty to use 'default'): "))
|
|
9
|
+
alias = str(input("-> Select an alias for this profile (Leave empty to use 'default'): ")).strip()
|
|
10
10
|
if not alias:
|
|
11
11
|
alias = "default"
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
if
|
|
15
|
-
|
|
13
|
+
auth_type = str(input("-> Which type of authentication will this profile use? \n1.API key \n2. Oauth2 \n(Type 'enter' for default (1): ")).strip()
|
|
14
|
+
if not auth_type or auth_type == "1":
|
|
15
|
+
api_key = str(input("-> Insert your GEAI API KEY (Leave empty to keep current value): ")).strip()
|
|
16
|
+
if api_key:
|
|
17
|
+
configure_api_key(api_key, alias)
|
|
18
|
+
|
|
19
|
+
elif auth_type == "2":
|
|
20
|
+
access_token = str(input("-> Insert your GEAI OAUTH2 ACCESS TOKEN (Leave empty to keep current value): ")).strip()
|
|
21
|
+
if access_token:
|
|
22
|
+
configure_access_token(access_token, alias)
|
|
16
23
|
|
|
17
|
-
base_url = str(input("-> Insert your GEAI API BASE URL (Leave empty to keep current value): "))
|
|
24
|
+
base_url = str(input("-> Insert your GEAI API BASE URL (Leave empty to keep current value): ")).strip()
|
|
18
25
|
if base_url:
|
|
19
26
|
configure_base_url(base_url, alias)
|
|
20
27
|
|
|
21
|
-
eval_url = str(input("-> Insert your GEAI API EVAL URL (Leave empty to keep current value): "))
|
|
28
|
+
eval_url = str(input("-> Insert your GEAI API EVAL URL (Leave empty to keep current value): ")).strip()
|
|
22
29
|
if eval_url:
|
|
23
30
|
configure_eval_url(eval_url, alias)
|
|
24
31
|
|
|
25
32
|
else:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
alias = option_arg
|
|
38
|
-
if option_flag.name == "api_key":
|
|
39
|
-
api_key = option_arg
|
|
40
|
-
if option_flag.name == "base_url":
|
|
41
|
-
base_url = option_arg
|
|
42
|
-
if option_flag.name == "eval_url":
|
|
43
|
-
eval_url = option_arg
|
|
44
|
-
if option_flag.name == "remove_alias":
|
|
45
|
-
alias = option_arg
|
|
46
|
-
remove_alias = True
|
|
47
|
-
|
|
33
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
34
|
+
|
|
35
|
+
list_alias = 'list' in opts
|
|
36
|
+
remove_alias = 'remove_alias' in opts
|
|
37
|
+
alias = opts.get('remove_alias') if remove_alias else opts.get('profile_alias', 'default')
|
|
38
|
+
api_key = opts.get('api_key')
|
|
39
|
+
base_url = opts.get('base_url')
|
|
40
|
+
eval_url = opts.get('eval_url')
|
|
41
|
+
access_token = opts.get('access_token')
|
|
42
|
+
project_id = opts.get('project_id')
|
|
43
|
+
organization_id = opts.get('organization_id')
|
|
48
44
|
|
|
49
45
|
if list_alias:
|
|
50
46
|
display_alias_list()
|
|
51
47
|
elif remove_alias:
|
|
52
48
|
remove_alias_from_config(alias)
|
|
53
49
|
else:
|
|
50
|
+
if api_key and access_token:
|
|
51
|
+
Console.write_stdout(
|
|
52
|
+
"WARNING: You're setting 2 different types of authentication for the same profile. "
|
|
53
|
+
"This may cause unknown behaviors. Consider using separate profiles for different "
|
|
54
|
+
"authentication types."
|
|
55
|
+
)
|
|
56
|
+
|
|
54
57
|
if api_key:
|
|
55
58
|
configure_api_key(api_key=api_key, alias=alias)
|
|
56
59
|
if base_url:
|
|
57
60
|
configure_base_url(base_url=base_url, alias=alias)
|
|
58
61
|
if eval_url:
|
|
59
62
|
configure_eval_url(eval_url=eval_url, alias=alias)
|
|
63
|
+
if access_token:
|
|
64
|
+
configure_access_token(access_token=access_token, alias=alias)
|
|
65
|
+
if project_id:
|
|
66
|
+
configure_project_id(project_id=project_id, alias=alias)
|
|
67
|
+
if organization_id:
|
|
68
|
+
configure_organization_id(organization_id=organization_id, alias=alias)
|
|
60
69
|
|
|
61
70
|
|
|
62
71
|
def configure_api_key(api_key: str, alias: str = "default"):
|
|
@@ -77,6 +86,24 @@ def configure_eval_url(eval_url: str, alias: str = "default"):
|
|
|
77
86
|
Console.write_stdout(f"GEAI API EVAL URL for alias '{alias}' saved successfully!")
|
|
78
87
|
|
|
79
88
|
|
|
89
|
+
def configure_access_token(access_token: str, alias: str = "default"):
|
|
90
|
+
settings = get_settings()
|
|
91
|
+
settings.set_access_token(access_token, alias)
|
|
92
|
+
Console.write_stdout(f"GEAI OAUTH2 ACCESS TOKEN for alias '{alias}' saved successfully!")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def configure_project_id(project_id: str, alias: str = "default"):
|
|
96
|
+
settings = get_settings()
|
|
97
|
+
settings.set_project_id(project_id, alias)
|
|
98
|
+
Console.write_stdout(f"GEAI PROJECT ID for alias '{alias}' saved successfully!")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def configure_organization_id(organization_id: str, alias: str = "default"):
|
|
102
|
+
settings = get_settings()
|
|
103
|
+
settings.set_organization_id(organization_id, alias)
|
|
104
|
+
Console.write_stdout(f"GEAI ORGANIZATION ID for alias '{alias}' saved successfully!")
|
|
105
|
+
|
|
106
|
+
|
|
80
107
|
def display_alias_list():
|
|
81
108
|
settings = get_settings()
|
|
82
109
|
for alias, url in settings.list_aliases().items():
|
|
@@ -93,7 +120,6 @@ def remove_alias_from_config(alias: str):
|
|
|
93
120
|
Console.write_stdout(f"Alias {alias} kept in configuration file.")
|
|
94
121
|
|
|
95
122
|
|
|
96
|
-
|
|
97
123
|
configuration_options = (
|
|
98
124
|
Option(
|
|
99
125
|
"api_key",
|
|
@@ -113,6 +139,30 @@ configuration_options = (
|
|
|
113
139
|
"Set GEAI API EVAL URL for the evaluation module",
|
|
114
140
|
True
|
|
115
141
|
),
|
|
142
|
+
Option(
|
|
143
|
+
"eval_url",
|
|
144
|
+
["--eval-url", "--eu"],
|
|
145
|
+
"Set GEAI API EVAL URL for the evaluation module",
|
|
146
|
+
True
|
|
147
|
+
),
|
|
148
|
+
Option(
|
|
149
|
+
"access_token",
|
|
150
|
+
["--access-token", "--at"],
|
|
151
|
+
"Set GEAI_OAUTH_ACCESS_TOKEN for Oauth2 authentication in requests",
|
|
152
|
+
True
|
|
153
|
+
),
|
|
154
|
+
Option(
|
|
155
|
+
"project_id",
|
|
156
|
+
["--project-id", "--pid"],
|
|
157
|
+
"Set GEAI_PROJECT_ID for header configuration in some requests",
|
|
158
|
+
True
|
|
159
|
+
),
|
|
160
|
+
Option(
|
|
161
|
+
"organization_id",
|
|
162
|
+
["--organization-id", "--oid"],
|
|
163
|
+
"Set GEAI_ORGANIZATION_ID for header configuration in some requests",
|
|
164
|
+
True
|
|
165
|
+
),
|
|
116
166
|
Option(
|
|
117
167
|
"profile_alias",
|
|
118
168
|
["--profile-alias", "--pa"],
|
pygeai/cli/commands/docs.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
1
|
import subprocess
|
|
3
2
|
import webbrowser
|
|
4
3
|
from pathlib import Path
|
|
@@ -8,6 +7,8 @@ from pygeai.cli.commands.builders import build_help_text
|
|
|
8
7
|
from pygeai.cli.texts.help import DOCS_HELP_TEXT
|
|
9
8
|
from pygeai.core.utils.console import Console
|
|
10
9
|
|
|
10
|
+
from importlib import util
|
|
11
|
+
|
|
11
12
|
|
|
12
13
|
def show_help():
|
|
13
14
|
help_text = build_help_text(docs_commands, DOCS_HELP_TEXT)
|
|
@@ -15,9 +16,7 @@ def show_help():
|
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def open_documentation():
|
|
18
|
-
|
|
19
|
-
import sphinx
|
|
20
|
-
except ImportError:
|
|
19
|
+
if not util.find_spec("sphinx"):
|
|
21
20
|
Console.write_stdout(
|
|
22
21
|
"Documentation dependencies (sphinx, sphinx-rtd-theme) are not installed.\n"
|
|
23
22
|
"Would you like to install them now? [Y/n]: "
|
|
@@ -17,41 +17,35 @@ def show_help():
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def generate_embeddings(option_list: list):
|
|
20
|
-
|
|
21
|
-
encoding_format = None
|
|
20
|
+
input_list = []
|
|
22
21
|
dimensions = None
|
|
23
|
-
user = None
|
|
24
|
-
input_type = None
|
|
25
22
|
timeout = None
|
|
26
|
-
cache = None
|
|
27
23
|
preview = True
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
cache = None
|
|
25
|
+
|
|
30
26
|
for option_flag, option_arg in option_list:
|
|
31
|
-
if option_flag.name == "model":
|
|
32
|
-
model = option_arg
|
|
33
27
|
if option_flag.name == "input":
|
|
34
28
|
input_list.append(option_arg)
|
|
35
|
-
|
|
36
|
-
encoding_format = option_arg
|
|
37
|
-
if option_flag.name == "dimensions":
|
|
29
|
+
elif option_flag.name == "dimensions":
|
|
38
30
|
try:
|
|
39
31
|
dimensions = int(option_arg)
|
|
40
32
|
except (ValueError, TypeError):
|
|
41
33
|
raise WrongArgumentError("dimensions must be an integer")
|
|
42
|
-
|
|
43
|
-
user = option_arg
|
|
44
|
-
if option_flag.name == "input_type":
|
|
45
|
-
input_type = option_arg
|
|
46
|
-
if option_flag.name == "timeout":
|
|
34
|
+
elif option_flag.name == "timeout":
|
|
47
35
|
try:
|
|
48
36
|
timeout = int(option_arg)
|
|
49
37
|
except (ValueError, TypeError):
|
|
50
38
|
raise WrongArgumentError("timeout must be an integer")
|
|
51
|
-
|
|
39
|
+
elif option_flag.name == "cache":
|
|
52
40
|
cache = get_boolean_value(option_arg)
|
|
53
|
-
|
|
41
|
+
elif option_flag.name == "preview":
|
|
54
42
|
preview = get_boolean_value(option_arg)
|
|
43
|
+
|
|
44
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
45
|
+
model = opts.get('model')
|
|
46
|
+
encoding_format = opts.get('encoding_format')
|
|
47
|
+
user = opts.get('user')
|
|
48
|
+
input_type = opts.get('input_type')
|
|
55
49
|
|
|
56
50
|
if not (model and any(input_list)):
|
|
57
51
|
raise MissingRequirementException("Cannot generate embeddings without specifying model and at least one input")
|