pygeai 0.6.0b14__py3-none-any.whl → 0.7.0b1__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/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 +31 -71
- 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 +129 -18
- 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.0b14.dist-info → pygeai-0.7.0b1.dist-info}/METADATA +32 -7
- {pygeai-0.6.0b14.dist-info → pygeai-0.7.0b1.dist-info}/RECORD +216 -205
- {pygeai-0.6.0b14.dist-info → pygeai-0.7.0b1.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b14.dist-info → pygeai-0.7.0b1.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b14.dist-info → pygeai-0.7.0b1.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b14.dist-info → pygeai-0.7.0b1.dist-info}/top_level.txt +0 -0
|
@@ -4,6 +4,22 @@ pygeai.tests.auth package
|
|
|
4
4
|
Submodules
|
|
5
5
|
----------
|
|
6
6
|
|
|
7
|
+
pygeai.tests.auth.test\_cli\_configuration module
|
|
8
|
+
-------------------------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: pygeai.tests.auth.test_cli_configuration
|
|
11
|
+
:members:
|
|
12
|
+
:show-inheritance:
|
|
13
|
+
:undoc-members:
|
|
14
|
+
|
|
15
|
+
pygeai.tests.auth.test\_client\_initialization module
|
|
16
|
+
-----------------------------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: pygeai.tests.auth.test_client_initialization
|
|
19
|
+
:members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
|
|
7
23
|
pygeai.tests.auth.test\_clients module
|
|
8
24
|
--------------------------------------
|
|
9
25
|
|
|
@@ -12,6 +28,22 @@ pygeai.tests.auth.test\_clients module
|
|
|
12
28
|
:show-inheritance:
|
|
13
29
|
:undoc-members:
|
|
14
30
|
|
|
31
|
+
pygeai.tests.auth.test\_config\_manager module
|
|
32
|
+
----------------------------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: pygeai.tests.auth.test_config_manager
|
|
35
|
+
:members:
|
|
36
|
+
:show-inheritance:
|
|
37
|
+
:undoc-members:
|
|
38
|
+
|
|
39
|
+
pygeai.tests.auth.test\_header\_injection module
|
|
40
|
+
------------------------------------------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: pygeai.tests.auth.test_header_injection
|
|
43
|
+
:members:
|
|
44
|
+
:show-inheritance:
|
|
45
|
+
:undoc-members:
|
|
46
|
+
|
|
15
47
|
pygeai.tests.auth.test\_oauth module
|
|
16
48
|
------------------------------------
|
|
17
49
|
|
|
@@ -20,6 +52,30 @@ pygeai.tests.auth.test\_oauth module
|
|
|
20
52
|
:show-inheritance:
|
|
21
53
|
:undoc-members:
|
|
22
54
|
|
|
55
|
+
pygeai.tests.auth.test\_session\_logging module
|
|
56
|
+
-----------------------------------------------
|
|
57
|
+
|
|
58
|
+
.. automodule:: pygeai.tests.auth.test_session_logging
|
|
59
|
+
:members:
|
|
60
|
+
:show-inheritance:
|
|
61
|
+
:undoc-members:
|
|
62
|
+
|
|
63
|
+
pygeai.tests.auth.test\_session\_validation module
|
|
64
|
+
--------------------------------------------------
|
|
65
|
+
|
|
66
|
+
.. automodule:: pygeai.tests.auth.test_session_validation
|
|
67
|
+
:members:
|
|
68
|
+
:show-inheritance:
|
|
69
|
+
:undoc-members:
|
|
70
|
+
|
|
71
|
+
pygeai.tests.auth.test\_singleton\_reset module
|
|
72
|
+
-----------------------------------------------
|
|
73
|
+
|
|
74
|
+
.. automodule:: pygeai.tests.auth.test_singleton_reset
|
|
75
|
+
:members:
|
|
76
|
+
:show-inheritance:
|
|
77
|
+
:undoc-members:
|
|
78
|
+
|
|
23
79
|
Module contents
|
|
24
80
|
---------------
|
|
25
81
|
|
|
@@ -13,6 +13,14 @@ Subpackages
|
|
|
13
13
|
Submodules
|
|
14
14
|
----------
|
|
15
15
|
|
|
16
|
+
pygeai.tests.cli.test\_credentials\_flag module
|
|
17
|
+
-----------------------------------------------
|
|
18
|
+
|
|
19
|
+
.. automodule:: pygeai.tests.cli.test_credentials_flag
|
|
20
|
+
:members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
:undoc-members:
|
|
23
|
+
|
|
16
24
|
pygeai.tests.cli.test\_error\_handler module
|
|
17
25
|
--------------------------------------------
|
|
18
26
|
|
pygeai/admin/clients.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
from pygeai import logger
|
|
3
1
|
from pygeai.admin.endpoints import GET_API_TOKEN_VALIDATION_V1, GET_AUTHORIZED_ORGANIZATIONS_V1, \
|
|
4
2
|
GET_AUTHORIZED_PROJECTS_V1, GET_PROJECT_VISIBILITY_V1, GET_PROJECT_API_TOKEN_V1
|
|
5
3
|
from pygeai.core.base.clients import BaseClient
|
|
6
|
-
|
|
4
|
+
|
|
7
5
|
from pygeai.core.utils.validators import validate_status_code
|
|
8
6
|
from pygeai.core.utils.parsers import parse_json_response
|
|
9
7
|
|
pygeai/analytics/clients.py
CHANGED
pygeai/assistant/clients.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
from pygeai.assistant.endpoints import GET_ASSISTANT_DATA_V1, CREATE_ASSISTANT_V1, UPDATE_ASSISTANT_V1, BEGIN_CONVERSATION_V1, \
|
|
4
|
-
SEND_TEXT_PROMPT_V1, SEND_CHAT_REQUEST_V1, GET_REQUEST_STATUS_V1, CANCEL_REQUEST_V1
|
|
5
|
-
from pygeai.assistant.data_analyst.endpoints import GET_DATA_ANALYST_STATUS_V1, EXTEND_DATA_ANALYST_DATASET_V1
|
|
1
|
+
from pygeai.assistant.endpoints import GET_ASSISTANT_DATA_V1, CREATE_ASSISTANT_V1, UPDATE_ASSISTANT_V1, \
|
|
2
|
+
SEND_CHAT_REQUEST_V1, GET_REQUEST_STATUS_V1, CANCEL_REQUEST_V1
|
|
6
3
|
from pygeai.core.base.clients import BaseClient
|
|
7
|
-
from pygeai.core.common.decorators import handler_server_error
|
|
8
|
-
from pygeai.core.common.exceptions import InvalidAPIResponseException
|
|
9
4
|
from pygeai.core.utils.validators import validate_status_code
|
|
10
5
|
from pygeai.core.utils.parsers import parse_json_response
|
|
11
6
|
|
pygeai/assistant/data/clients.py
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
1
|
from pygeai.assistant.clients import AssistantClient
|
|
4
|
-
from pygeai.assistant.endpoints import GET_ASSISTANT_DATA_V1, CREATE_ASSISTANT_V1, UPDATE_ASSISTANT_V1, BEGIN_CONVERSATION_V1, \
|
|
5
|
-
SEND_TEXT_PROMPT_V1, SEND_CHAT_REQUEST_V1, GET_REQUEST_STATUS_V1, CANCEL_REQUEST_V1
|
|
6
|
-
from pygeai.assistant.data_analyst.endpoints import GET_DATA_ANALYST_STATUS_V1, EXTEND_DATA_ANALYST_DATASET_V1
|
|
7
|
-
from pygeai.core.base.clients import BaseClient
|
|
8
|
-
from pygeai.core.common.decorators import handler_server_error
|
|
9
|
-
from pygeai.core.utils.validators import validate_status_code
|
|
10
2
|
|
|
11
3
|
|
|
12
4
|
class ChatWithDataAssistantClient(AssistantClient):
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
|
-
from pygeai import logger
|
|
4
3
|
from pygeai.assistant.clients import AssistantClient
|
|
5
4
|
from pygeai.assistant.data_analyst.endpoints import GET_DATA_ANALYST_STATUS_V1, EXTEND_DATA_ANALYST_DATASET_V1
|
|
6
|
-
from pygeai.core.common.exceptions import InvalidAPIResponseException
|
|
7
5
|
from pygeai.core.utils.validators import validate_status_code
|
|
8
6
|
from pygeai.core.utils.parsers import parse_json_response
|
|
9
7
|
|
pygeai/assistant/managers.py
CHANGED
|
@@ -4,7 +4,7 @@ from pygeai.assistant.clients import AssistantClient
|
|
|
4
4
|
from pygeai.assistant.rag.clients import RAGAssistantClient
|
|
5
5
|
from pygeai.assistant.rag.mappers import RAGAssistantMapper
|
|
6
6
|
from pygeai.assistant.rag.responses import DocumentListResponse
|
|
7
|
-
from pygeai.core.base.mappers import
|
|
7
|
+
from pygeai.core.base.mappers import ResponseMapper
|
|
8
8
|
from pygeai.core.handlers import ErrorHandler
|
|
9
9
|
from pygeai.core.models import Assistant, TextAssistant, ChatAssistant, ChatMessageList, AssistantRevision, \
|
|
10
10
|
ChatVariableList, LlmSettings, ChatWithDataAssistant, ChatToolList, ToolChoice
|
pygeai/assistant/rag/clients.py
CHANGED
|
@@ -3,14 +3,12 @@ import logging
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
from pygeai import logger
|
|
7
6
|
from pygeai.assistant.rag.endpoints import GET_ASSISTANTS_FROM_PROJECT_V1, GET_ASSISTANT_V1, CREATE_ASSISTANT_V1, \
|
|
8
7
|
UPDATE_ASSISTANT_V1, DELETE_ASSISTANT_V1, GET_DOCUMENTS_V1, DELETE_ALL_DOCUMENTS_V1, RETRIEVE_DOCUMENT_V1, \
|
|
9
8
|
UPLOAD_DOCUMENT_V1, DELETE_DOCUMENT_V1, EXECUTE_QUERY_V1
|
|
10
9
|
from pygeai.core.base.clients import BaseClient
|
|
11
10
|
import urllib.parse
|
|
12
11
|
|
|
13
|
-
from pygeai.core.common.exceptions import InvalidAPIResponseException
|
|
14
12
|
from pygeai.core.utils.validators import validate_status_code
|
|
15
13
|
from pygeai.core.utils.parsers import parse_json_response
|
|
16
14
|
|
pygeai/assistant/rag/mappers.py
CHANGED
|
@@ -186,14 +186,13 @@ class RAGAssistantMapper(ModelMapper):
|
|
|
186
186
|
|
|
187
187
|
@classmethod
|
|
188
188
|
def map_to_document_list(cls, data: dict) -> list[Document]:
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
documents = data.get('documents')
|
|
190
|
+
|
|
191
191
|
if documents is not None and any(documents):
|
|
192
|
-
for document_data in documents:
|
|
193
|
-
document = cls.map_to_document(document_data)
|
|
194
|
-
document_list.append(document)
|
|
195
192
|
|
|
196
|
-
|
|
193
|
+
return [cls.map_to_document(document_data) for document_data in documents]
|
|
194
|
+
|
|
195
|
+
return []
|
|
197
196
|
|
|
198
197
|
@classmethod
|
|
199
198
|
def map_to_document(cls, data: dict) -> Document:
|
|
@@ -211,14 +210,13 @@ class RAGAssistantMapper(ModelMapper):
|
|
|
211
210
|
|
|
212
211
|
@classmethod
|
|
213
212
|
def map_to_document_metadata_list(cls, data: dict) -> List[DocumentMetadata]:
|
|
214
|
-
metadata_list = list()
|
|
215
213
|
metadata = data.get('metadata')
|
|
214
|
+
|
|
216
215
|
if metadata is not None and any(metadata):
|
|
217
|
-
for metadata_data in metadata:
|
|
218
|
-
new_metadata = cls.map_to_document_metadata(metadata_data)
|
|
219
|
-
metadata_list.append(new_metadata)
|
|
220
216
|
|
|
221
|
-
|
|
217
|
+
return [cls.map_to_metadata(metadata_data) for metadata_data in metadata]
|
|
218
|
+
|
|
219
|
+
return []
|
|
222
220
|
|
|
223
221
|
@classmethod
|
|
224
222
|
def map_to_document_metadata(cls, data: dict) -> DocumentMetadata:
|
pygeai/auth/clients.py
CHANGED
|
@@ -2,7 +2,6 @@ from pygeai import logger
|
|
|
2
2
|
from pygeai.auth.endpoints import GET_USER_PROFILE_INFO, GET_OAUTH2_ACCESS_TOKEN, \
|
|
3
3
|
CREATE_PROJECT_API_TOKEN_V2, DELETE_PROJECT_API_TOKEN_V2, UPDATE_PROJECT_API_TOKEN_V2, GET_PROJECT_API_TOKEN_V2
|
|
4
4
|
from pygeai.core.base.clients import BaseClient
|
|
5
|
-
from pygeai.core.common.exceptions import InvalidAPIResponseException, APIResponseError
|
|
6
5
|
from pygeai.core.utils.validators import validate_status_code
|
|
7
6
|
from pygeai.core.utils.parsers import parse_json_response
|
|
8
7
|
|
|
@@ -37,15 +36,35 @@ class AuthClient(BaseClient):
|
|
|
37
36
|
validate_status_code(response)
|
|
38
37
|
return parse_json_response(response, "obtain Oauth2 access token")
|
|
39
38
|
|
|
40
|
-
def get_user_profile_information(self, access_token: str) -> dict:
|
|
39
|
+
def get_user_profile_information(self, access_token: str, project_id: str = None) -> dict:
|
|
41
40
|
"""
|
|
42
|
-
Get user profile information
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
Get user profile information using an OAuth access token.
|
|
42
|
+
|
|
43
|
+
This method creates a temporary API service to avoid mutating the session state.
|
|
44
|
+
|
|
45
|
+
:param access_token: str - OAuth 2.0 access token
|
|
46
|
+
:param project_id: str - Project ID for OAuth context (optional, uses session project_id if available)
|
|
45
47
|
:return: dict - The API response containing the user profile information
|
|
48
|
+
:raises: MissingRequirementException - If project_id is not provided and not in session
|
|
46
49
|
"""
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
# Determine project_id to use
|
|
51
|
+
effective_project_id = project_id or self.session.project_id
|
|
52
|
+
|
|
53
|
+
if not effective_project_id:
|
|
54
|
+
logger.warning(
|
|
55
|
+
"No project_id provided for get_user_profile_information. "
|
|
56
|
+
"This may cause authentication issues."
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Create a temporary API service without mutating session
|
|
60
|
+
from pygeai.core.services.rest import GEAIApiService
|
|
61
|
+
temp_service = GEAIApiService(
|
|
62
|
+
base_url=self.session.base_url,
|
|
63
|
+
token=access_token,
|
|
64
|
+
project_id=effective_project_id
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
response = temp_service.get(endpoint=GET_USER_PROFILE_INFO)
|
|
49
68
|
validate_status_code(response)
|
|
50
69
|
return parse_json_response(response, "retrieve user profile information")
|
|
51
70
|
|
pygeai/auth/endpoints.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
GET_OAUTH2_ACCESS_TOKEN = "/oauth/access_token" # POST -> Obtain an OAuth 2.0 access token
|
|
1
|
+
# GET_OAUTH2_ACCESS_TOKEN = "/oauth/access_token" # POST -> Obtain an OAuth 2.0 access token
|
|
2
|
+
GET_OAUTH2_ACCESS_TOKEN = "/oauth/gam/v2.0/access_token" # POST -> Obtain an OAuth 2.0 access token
|
|
2
3
|
GET_USER_PROFILE_INFO = "/openid/userinfo" # GET -> Retrieve user profile information
|
|
3
4
|
CREATE_PROJECT_API_TOKEN_V2 = "v2/projects/tokens" # POST -> Create a new API token for a project
|
|
4
5
|
DELETE_PROJECT_API_TOKEN_V2 = "v2/projects/tokens/{id}" # DELETE -> Revoke an API token
|
pygeai/chat/clients.py
CHANGED
|
@@ -197,7 +197,7 @@ class ChatClient(BaseClient):
|
|
|
197
197
|
):
|
|
198
198
|
content = json_data["choices"][0]["delta"]["content"]
|
|
199
199
|
yield content
|
|
200
|
-
except JSONDecodeError
|
|
200
|
+
except JSONDecodeError:
|
|
201
201
|
continue
|
|
202
202
|
except Exception as e:
|
|
203
203
|
raise InvalidAPIResponseException(f"Unable to process streaming chat response: {e}")
|
|
@@ -225,7 +225,7 @@ class ChatClient(BaseClient):
|
|
|
225
225
|
):
|
|
226
226
|
content = json_data["choices"][0]["delta"]["content"]
|
|
227
227
|
yield content
|
|
228
|
-
except JSONDecodeError
|
|
228
|
+
except JSONDecodeError:
|
|
229
229
|
continue
|
|
230
230
|
except Exception as e:
|
|
231
231
|
raise InvalidAPIResponseException(f"Unable to process streaming response: {e}")
|
pygeai/chat/managers.py
CHANGED
|
@@ -5,7 +5,7 @@ from pygeai.core.models import ChatMessageList, \
|
|
|
5
5
|
ChatVariableList, LlmSettings, ChatToolList, ToolChoice
|
|
6
6
|
from pygeai.assistant.mappers import AssistantResponseMapper
|
|
7
7
|
from pygeai.chat.clients import ChatClient
|
|
8
|
-
from pygeai.core.responses import
|
|
8
|
+
from pygeai.core.responses import ProviderResponse
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ChatManager:
|
pygeai/cli/commands/admin.py
CHANGED
|
@@ -2,7 +2,7 @@ from pygeai.admin.clients import AdminClient
|
|
|
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 ADMIN_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
|
|
|
@@ -27,10 +27,8 @@ def get_authorized_organizations():
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def get_authorized_projects_by_organization(option_list: list):
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if option_flag.name == "organization":
|
|
33
|
-
organization = option_arg
|
|
30
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
31
|
+
organization = opts.get('organization')
|
|
34
32
|
|
|
35
33
|
if not organization:
|
|
36
34
|
raise MissingRequirementException("Cannot get authorized projects within organization without organization id")
|
|
@@ -53,16 +51,11 @@ authorized_projects_by_organization_options = [
|
|
|
53
51
|
|
|
54
52
|
|
|
55
53
|
def get_project_visibility(option_list: list):
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
organization = option_arg
|
|
62
|
-
if option_flag.name == "project":
|
|
63
|
-
project = option_arg
|
|
64
|
-
if option_flag.name == "access_token":
|
|
65
|
-
access_token = option_arg
|
|
54
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
55
|
+
|
|
56
|
+
organization = opts.get('organization')
|
|
57
|
+
project = opts.get('project')
|
|
58
|
+
access_token = opts.get('access_token')
|
|
66
59
|
|
|
67
60
|
if not (organization and project and access_token):
|
|
68
61
|
raise MissingRequirementException("Cannot get project visibility for access token without specifying "
|
|
@@ -100,16 +93,11 @@ project_visibility_options = [
|
|
|
100
93
|
|
|
101
94
|
|
|
102
95
|
def get_project_api_token(option_list: list):
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
organization = option_arg
|
|
109
|
-
if option_flag.name == "project":
|
|
110
|
-
project = option_arg
|
|
111
|
-
if option_flag.name == "access_token":
|
|
112
|
-
access_token = option_arg
|
|
96
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
97
|
+
|
|
98
|
+
organization = opts.get('organization')
|
|
99
|
+
project = opts.get('project')
|
|
100
|
+
access_token = opts.get('access_token')
|
|
113
101
|
|
|
114
102
|
if not (organization and project and access_token):
|
|
115
103
|
raise MissingRequirementException("Cannot get project API Token without specifying "
|
pygeai/cli/commands/analytics.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pygeai.cli.commands import Command, Option, ArgumentsEnum
|
|
2
2
|
from pygeai.cli.commands.builders import build_help_text
|
|
3
3
|
from pygeai.cli.texts.help import ANALYTICS_HELP_TEXT
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
from pygeai.core.utils.console import Console
|
|
6
6
|
from pygeai.analytics.managers import AnalyticsManager
|
|
7
7
|
import csv
|
|
@@ -55,13 +55,9 @@ CSV_EXPORT_OPTION = Option(
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def get_agents_created_and_modified(option_list: list):
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if option_flag.name == "start_date":
|
|
62
|
-
start_date = option_arg
|
|
63
|
-
if option_flag.name == "end_date":
|
|
64
|
-
end_date = option_arg
|
|
58
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
59
|
+
start_date = opts.get("start_date")
|
|
60
|
+
end_date = opts.get("end_date")
|
|
65
61
|
|
|
66
62
|
if not start_date or not end_date:
|
|
67
63
|
start_date, end_date = get_default_date_range()
|
|
@@ -76,16 +72,10 @@ agents_created_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
76
72
|
|
|
77
73
|
|
|
78
74
|
def get_total_requests_per_day(option_list: list):
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if option_flag.name == "start_date":
|
|
84
|
-
start_date = option_arg
|
|
85
|
-
if option_flag.name == "end_date":
|
|
86
|
-
end_date = option_arg
|
|
87
|
-
if option_flag.name == "agent_name":
|
|
88
|
-
agent_name = option_arg
|
|
75
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
76
|
+
start_date = opts.get("start_date")
|
|
77
|
+
end_date = opts.get("end_date")
|
|
78
|
+
agent_name = opts.get("agent_name")
|
|
89
79
|
|
|
90
80
|
if not start_date or not end_date:
|
|
91
81
|
start_date, end_date = get_default_date_range()
|
|
@@ -93,7 +83,7 @@ def get_total_requests_per_day(option_list: list):
|
|
|
93
83
|
|
|
94
84
|
manager = AnalyticsManager()
|
|
95
85
|
result = manager.get_total_requests_per_day(start_date, end_date, agent_name)
|
|
96
|
-
Console.write_stdout(
|
|
86
|
+
Console.write_stdout("Total requests per day:")
|
|
97
87
|
for item in result.requestsPerDay:
|
|
98
88
|
Console.write_stdout(f" {item.date}: {item.totalRequests} requests ({item.totalRequestsWithError} errors)")
|
|
99
89
|
|
|
@@ -102,13 +92,9 @@ total_requests_per_day_options = [START_DATE_OPTION, END_DATE_OPTION, AGENT_NAME
|
|
|
102
92
|
|
|
103
93
|
|
|
104
94
|
def get_total_cost(option_list: list):
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if option_flag.name == "start_date":
|
|
109
|
-
start_date = option_arg
|
|
110
|
-
if option_flag.name == "end_date":
|
|
111
|
-
end_date = option_arg
|
|
95
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
96
|
+
start_date = opts.get("start_date")
|
|
97
|
+
end_date = opts.get("end_date")
|
|
112
98
|
|
|
113
99
|
if not start_date or not end_date:
|
|
114
100
|
start_date, end_date = get_default_date_range()
|
|
@@ -123,13 +109,9 @@ total_cost_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
123
109
|
|
|
124
110
|
|
|
125
111
|
def get_average_cost_per_request(option_list: list):
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if option_flag.name == "start_date":
|
|
130
|
-
start_date = option_arg
|
|
131
|
-
if option_flag.name == "end_date":
|
|
132
|
-
end_date = option_arg
|
|
112
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
113
|
+
start_date = opts.get("start_date")
|
|
114
|
+
end_date = opts.get("end_date")
|
|
133
115
|
|
|
134
116
|
if not start_date or not end_date:
|
|
135
117
|
start_date, end_date = get_default_date_range()
|
|
@@ -144,13 +126,9 @@ average_cost_per_request_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
144
126
|
|
|
145
127
|
|
|
146
128
|
def get_total_tokens(option_list: list):
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if option_flag.name == "start_date":
|
|
151
|
-
start_date = option_arg
|
|
152
|
-
if option_flag.name == "end_date":
|
|
153
|
-
end_date = option_arg
|
|
129
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
130
|
+
start_date = opts.get("start_date")
|
|
131
|
+
end_date = opts.get("end_date")
|
|
154
132
|
|
|
155
133
|
if not start_date or not end_date:
|
|
156
134
|
start_date, end_date = get_default_date_range()
|
|
@@ -165,13 +143,9 @@ total_tokens_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
165
143
|
|
|
166
144
|
|
|
167
145
|
def get_overall_error_rate(option_list: list):
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if option_flag.name == "start_date":
|
|
172
|
-
start_date = option_arg
|
|
173
|
-
if option_flag.name == "end_date":
|
|
174
|
-
end_date = option_arg
|
|
146
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
147
|
+
start_date = opts.get("start_date")
|
|
148
|
+
end_date = opts.get("end_date")
|
|
175
149
|
|
|
176
150
|
if not start_date or not end_date:
|
|
177
151
|
start_date, end_date = get_default_date_range()
|
|
@@ -186,13 +160,9 @@ error_rate_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
186
160
|
|
|
187
161
|
|
|
188
162
|
def get_top_agents_by_requests(option_list: list):
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if option_flag.name == "start_date":
|
|
193
|
-
start_date = option_arg
|
|
194
|
-
if option_flag.name == "end_date":
|
|
195
|
-
end_date = option_arg
|
|
163
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
164
|
+
start_date = opts.get("start_date")
|
|
165
|
+
end_date = opts.get("end_date")
|
|
196
166
|
|
|
197
167
|
if not start_date or not end_date:
|
|
198
168
|
start_date, end_date = get_default_date_range()
|
|
@@ -209,13 +179,9 @@ top_agents_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
209
179
|
|
|
210
180
|
|
|
211
181
|
def get_total_active_users(option_list: list):
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if option_flag.name == "start_date":
|
|
216
|
-
start_date = option_arg
|
|
217
|
-
if option_flag.name == "end_date":
|
|
218
|
-
end_date = option_arg
|
|
182
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
183
|
+
start_date = opts.get("start_date")
|
|
184
|
+
end_date = opts.get("end_date")
|
|
219
185
|
|
|
220
186
|
if not start_date or not end_date:
|
|
221
187
|
start_date, end_date = get_default_date_range()
|
|
@@ -230,16 +196,10 @@ active_users_options = [START_DATE_OPTION, END_DATE_OPTION]
|
|
|
230
196
|
|
|
231
197
|
|
|
232
198
|
def get_full_report(option_list: list):
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if option_flag.name == "start_date":
|
|
238
|
-
start_date = option_arg
|
|
239
|
-
if option_flag.name == "end_date":
|
|
240
|
-
end_date = option_arg
|
|
241
|
-
if option_flag.name == "csv_file":
|
|
242
|
-
csv_file = option_arg
|
|
199
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
200
|
+
start_date = opts.get("start_date")
|
|
201
|
+
end_date = opts.get("end_date")
|
|
202
|
+
csv_file = opts.get("csv_file")
|
|
243
203
|
|
|
244
204
|
if not start_date or not end_date:
|
|
245
205
|
start_date, end_date = get_default_date_range()
|