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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
|
-
import unittest
|
|
3
2
|
import uuid
|
|
4
3
|
from pygeai.lab.managers import AILabManager
|
|
5
|
-
from pygeai.lab.models import Task, Prompt
|
|
6
|
-
from pygeai.core.common.exceptions import
|
|
4
|
+
from pygeai.lab.models import Task, Prompt
|
|
5
|
+
from pygeai.core.common.exceptions import APIError
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class TestAILabCreateTaskIntegration(TestCase):
|
|
@@ -3,7 +3,6 @@ import uuid
|
|
|
3
3
|
from pygeai.lab.managers import AILabManager
|
|
4
4
|
from pygeai.lab.models import AgenticProcess, KnowledgeBase, AgenticActivity, ArtifactSignal, UserSignal, Event, SequenceFlow
|
|
5
5
|
from pygeai.core.common.exceptions import InvalidAPIResponseException, MissingRequirementException
|
|
6
|
-
from pygeai.core.base.responses import EmptyResponse
|
|
7
6
|
|
|
8
7
|
ai_lab_manager: AILabManager
|
|
9
8
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
|
-
import unittest
|
|
3
2
|
from pygeai.lab.managers import AILabManager
|
|
4
|
-
from pygeai.lab.models import AgenticProcess, FilterSettings
|
|
5
|
-
from pygeai.core.common.exceptions import
|
|
3
|
+
from pygeai.lab.models import AgenticProcess, FilterSettings
|
|
4
|
+
from pygeai.core.common.exceptions import APIError, MissingRequirementException
|
|
6
5
|
import copy
|
|
7
|
-
import uuid
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
class TestAILabGetProcessIntegration(TestCase):
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
|
-
import uuid
|
|
3
2
|
from pygeai.lab.managers import AILabManager
|
|
4
|
-
from pygeai.lab.models import FilterSettings, ProcessInstanceList
|
|
5
|
-
from pygeai.core.common.exceptions import APIError, MissingRequirementException
|
|
3
|
+
from pygeai.lab.models import FilterSettings, ProcessInstanceList
|
|
6
4
|
import copy
|
|
7
5
|
|
|
8
6
|
ai_lab_manager: AILabManager
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
2
|
import uuid
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from pygeai.core.common.exceptions import APIResponseError, APIError
|
|
4
|
+
from pygeai.core.common.exceptions import APIError
|
|
6
5
|
from pygeai.lab.managers import AILabManager
|
|
7
6
|
from pygeai.lab.models import (
|
|
8
7
|
AgenticProcess, KnowledgeBase, AgenticActivity, ArtifactSignal, Task,
|
|
9
|
-
UserSignal, Event, SequenceFlow
|
|
8
|
+
UserSignal, Event, SequenceFlow
|
|
10
9
|
)
|
|
11
10
|
|
|
12
11
|
|
|
@@ -20,7 +19,6 @@ class TestAILabUpdateProcessIntegration(TestCase):
|
|
|
20
19
|
self.created_process: AgenticProcess = None
|
|
21
20
|
self.updated_process: AgenticProcess = None
|
|
22
21
|
|
|
23
|
-
|
|
24
22
|
def tearDown(self):
|
|
25
23
|
"""
|
|
26
24
|
Clean up after each test if necessary.
|
|
@@ -29,7 +27,6 @@ class TestAILabUpdateProcessIntegration(TestCase):
|
|
|
29
27
|
if isinstance(self.created_process, AgenticProcess):
|
|
30
28
|
self.ai_lab_manager.delete_process(self.created_process.id)
|
|
31
29
|
|
|
32
|
-
|
|
33
30
|
def __load_process(self):
|
|
34
31
|
"""
|
|
35
32
|
Helper to load a complete process configuration for testing.
|
|
@@ -137,12 +134,11 @@ class TestAILabUpdateProcessIntegration(TestCase):
|
|
|
137
134
|
self.__update_process(automatic_publish=auto_publish)
|
|
138
135
|
|
|
139
136
|
self.assertIn(
|
|
140
|
-
f"Invalid character in name ({':' if
|
|
137
|
+
f"Invalid character in name ({':' if ':' in invalid_name else '/'} is not allowed).",
|
|
141
138
|
str(exception.exception),
|
|
142
139
|
f"Expected an error about invalid character in process name with autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
143
140
|
)
|
|
144
141
|
|
|
145
|
-
|
|
146
142
|
def test_update_process_duplicated_name(self):
|
|
147
143
|
"""
|
|
148
144
|
Test updating a process with a name that already exists.
|
|
@@ -161,7 +157,6 @@ class TestAILabUpdateProcessIntegration(TestCase):
|
|
|
161
157
|
str(exception.exception),
|
|
162
158
|
f"Expected an error about duplicated process name with autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
163
159
|
)
|
|
164
|
-
|
|
165
160
|
|
|
166
161
|
def test_update_process_no_name(self):
|
|
167
162
|
"""
|
|
@@ -182,7 +177,6 @@ class TestAILabUpdateProcessIntegration(TestCase):
|
|
|
182
177
|
f"Expected an error when process name is empty with autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
183
178
|
)
|
|
184
179
|
|
|
185
|
-
|
|
186
180
|
def test_update_process_invalid_id(self):
|
|
187
181
|
"""
|
|
188
182
|
Test updating a process with an invalid ID.
|
|
@@ -3,8 +3,7 @@ import unittest
|
|
|
3
3
|
import uuid
|
|
4
4
|
from pygeai.lab.managers import AILabManager
|
|
5
5
|
from pygeai.lab.models import LocalizedDescription, ReasoningStrategy
|
|
6
|
-
from
|
|
7
|
-
from pygeai.core.common.exceptions import APIError, APIResponseError
|
|
6
|
+
from pygeai.core.common.exceptions import APIError
|
|
8
7
|
|
|
9
8
|
class TestAILabCreateReasoningStrategyIntegration(TestCase):
|
|
10
9
|
def setUp(self):
|
|
@@ -2,7 +2,7 @@ from unittest import TestCase
|
|
|
2
2
|
import uuid
|
|
3
3
|
from pygeai.lab.managers import AILabManager
|
|
4
4
|
from pygeai.lab.models import Tool
|
|
5
|
-
from pygeai.core.common.exceptions import APIResponseError, MissingRequirementException
|
|
5
|
+
from pygeai.core.common.exceptions import APIResponseError, MissingRequirementException
|
|
6
6
|
|
|
7
7
|
ai_lab_manager: AILabManager
|
|
8
8
|
|
|
@@ -91,7 +91,7 @@ class TestAILabListToolsIntegration(TestCase):
|
|
|
91
91
|
self.assertIn(
|
|
92
92
|
"Scope must be one of builtin, external, api, proxied.",
|
|
93
93
|
str(exception.exception),
|
|
94
|
-
|
|
94
|
+
"The expected error about invalid scope was not returned"
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
|
|
@@ -148,7 +148,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
148
148
|
with self.assertRaises(ValueError) as exception:
|
|
149
149
|
self.__update_tool(automatic_publish=auto_publish)
|
|
150
150
|
self.assertIn(
|
|
151
|
-
|
|
151
|
+
"Scope must be one of builtin, external, api, proxied",
|
|
152
152
|
str(exception.exception),
|
|
153
153
|
f"Expected an error when tool scope is invalid and autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
154
154
|
)
|
|
@@ -24,7 +24,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
24
24
|
self.agent_data_models = [{"name": "gpt-4o"}]
|
|
25
25
|
self.agent_data_resource_pools = [{"name": "pool1", "tools": [{"name": "tool1"}]}]
|
|
26
26
|
|
|
27
|
-
@patch("pygeai.core.services.rest.
|
|
27
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
28
28
|
def test_list_agents_success(self, mock_get):
|
|
29
29
|
expected_response = {"agents": [{"id": "agent-1", "name": "Agent1"}]}
|
|
30
30
|
mock_response = mock_get.return_value
|
|
@@ -56,7 +56,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
56
56
|
headers = mock_get.call_args[1]['headers']
|
|
57
57
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
58
58
|
|
|
59
|
-
@patch("pygeai.core.services.rest.
|
|
59
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
60
60
|
def test_list_agents_json_decode_error(self, mock_get):
|
|
61
61
|
mock_response = mock_get.return_value
|
|
62
62
|
mock_response.status_code = 200
|
|
@@ -69,7 +69,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
69
69
|
self.assertEqual(str(context.exception), f"Unable to list agents for project {self.project_id}: Invalid JSON response")
|
|
70
70
|
mock_get.assert_called_once()
|
|
71
71
|
|
|
72
|
-
@patch("pygeai.core.services.rest.
|
|
72
|
+
@patch("pygeai.core.services.rest.GEAIApiService.post")
|
|
73
73
|
def test_create_agent_success(self, mock_post):
|
|
74
74
|
expected_response = {"id": "agent-123", "name": "Test Agent"}
|
|
75
75
|
mock_response = mock_post.return_value
|
|
@@ -111,7 +111,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
111
111
|
headers = mock_post.call_args[1]['headers']
|
|
112
112
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
113
113
|
|
|
114
|
-
@patch("pygeai.core.services.rest.
|
|
114
|
+
@patch("pygeai.core.services.rest.GEAIApiService.post")
|
|
115
115
|
def test_create_agent_without_resource_pools(self, mock_post):
|
|
116
116
|
expected_response = {"id": "agent-123", "name": "Test Agent"}
|
|
117
117
|
mock_response = mock_post.return_value
|
|
@@ -153,7 +153,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
153
153
|
)
|
|
154
154
|
self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
|
|
155
155
|
|
|
156
|
-
@patch("pygeai.core.services.rest.
|
|
156
|
+
@patch("pygeai.core.services.rest.GEAIApiService.post")
|
|
157
157
|
def test_create_agent_json_decode_error(self, mock_post):
|
|
158
158
|
mock_response = mock_post.return_value
|
|
159
159
|
mock_response.status_code = 200
|
|
@@ -177,7 +177,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
177
177
|
self.assertEqual(str(context.exception), f"Unable to create agent for project {self.project_id}: Invalid JSON response")
|
|
178
178
|
mock_post.assert_called_once()
|
|
179
179
|
|
|
180
|
-
@patch("pygeai.core.services.rest.
|
|
180
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
181
181
|
def test_get_agent_success(self, mock_get):
|
|
182
182
|
expected_response = {"id": self.agent_id, "name": "Test Agent"}
|
|
183
183
|
mock_response = mock_get.return_value
|
|
@@ -209,7 +209,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
209
209
|
self.client.get_agent(agent_id="")
|
|
210
210
|
self.assertEqual(str(context.exception), "agent_id must be specified in order to retrieve the agent")
|
|
211
211
|
|
|
212
|
-
@patch("pygeai.core.services.rest.
|
|
212
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
213
213
|
def test_get_agent_json_decode_error(self, mock_get):
|
|
214
214
|
mock_response = mock_get.return_value
|
|
215
215
|
mock_response.status_code = 200
|
|
@@ -222,7 +222,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
222
222
|
self.assertEqual(str(context.exception), f"Unable to retrieve agent {self.agent_id} for project {self.project_id}: Invalid JSON response")
|
|
223
223
|
mock_get.assert_called_once()
|
|
224
224
|
|
|
225
|
-
@patch("pygeai.core.services.rest.
|
|
225
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
226
226
|
def test_create_sharing_link_success(self, mock_get):
|
|
227
227
|
expected_response = {"link": "http://example.com/share"}
|
|
228
228
|
mock_response = mock_get.return_value
|
|
@@ -247,7 +247,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
247
247
|
self.client.create_sharing_link(agent_id="")
|
|
248
248
|
self.assertEqual(str(context.exception), "agent_id must be specified in order to create sharing link")
|
|
249
249
|
|
|
250
|
-
@patch("pygeai.core.services.rest.
|
|
250
|
+
@patch("pygeai.core.services.rest.GEAIApiService.get")
|
|
251
251
|
def test_create_sharing_link_json_decode_error(self, mock_get):
|
|
252
252
|
mock_response = mock_get.return_value
|
|
253
253
|
mock_response.status_code = 200
|
|
@@ -262,7 +262,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
262
262
|
self.assertEqual(str(context.exception), f"Unable to create sharing link for agent {self.agent_id} in project {self.project_id}: Invalid JSON response")
|
|
263
263
|
mock_get.assert_called_once()
|
|
264
264
|
|
|
265
|
-
@patch("pygeai.core.services.rest.
|
|
265
|
+
@patch("pygeai.core.services.rest.GEAIApiService.post")
|
|
266
266
|
def test_publish_agent_revision_success(self, mock_post):
|
|
267
267
|
revision = "2"
|
|
268
268
|
expected_response = {"status": "published"}
|
|
@@ -284,7 +284,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
284
284
|
headers = mock_post.call_args[1]['headers']
|
|
285
285
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
286
286
|
|
|
287
|
-
@patch("pygeai.core.services.rest.
|
|
287
|
+
@patch("pygeai.core.services.rest.GEAIApiService.post")
|
|
288
288
|
def test_publish_agent_revision_json_decode_error(self, mock_post):
|
|
289
289
|
revision = "2"
|
|
290
290
|
mock_response = mock_post.return_value
|
|
@@ -301,7 +301,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
301
301
|
self.assertEqual(str(context.exception), f"Unable to publish revision {revision} for agent {self.agent_id} in project {self.project_id}: Invalid JSON response")
|
|
302
302
|
mock_post.assert_called_once()
|
|
303
303
|
|
|
304
|
-
@patch("pygeai.core.services.rest.
|
|
304
|
+
@patch("pygeai.core.services.rest.GEAIApiService.delete")
|
|
305
305
|
def test_delete_agent_success(self, mock_delete):
|
|
306
306
|
expected_response = {}
|
|
307
307
|
mock_response = mock_delete.return_value
|
|
@@ -320,7 +320,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
320
320
|
headers = mock_delete.call_args[1]['headers']
|
|
321
321
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
322
322
|
|
|
323
|
-
@patch("pygeai.core.services.rest.
|
|
323
|
+
@patch("pygeai.core.services.rest.GEAIApiService.delete")
|
|
324
324
|
def test_delete_agent_json_decode_error(self, mock_delete):
|
|
325
325
|
mock_response = mock_delete.return_value
|
|
326
326
|
mock_response.status_code = 200
|
|
@@ -335,7 +335,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
335
335
|
self.assertEqual(str(context.exception), f"Unable to delete agent {self.agent_id} from project {self.project_id}: Invalid JSON response")
|
|
336
336
|
mock_delete.assert_called_once()
|
|
337
337
|
|
|
338
|
-
@patch("pygeai.core.services.rest.
|
|
338
|
+
@patch("pygeai.core.services.rest.GEAIApiService.put")
|
|
339
339
|
def test_update_agent_success(self, mock_put):
|
|
340
340
|
expected_response = {"id": self.agent_id, "name": "Updated Agent"}
|
|
341
341
|
mock_response = mock_put.return_value
|
|
@@ -379,7 +379,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
379
379
|
headers = mock_put.call_args[1]['headers']
|
|
380
380
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
381
381
|
|
|
382
|
-
@patch("pygeai.core.services.rest.
|
|
382
|
+
@patch("pygeai.core.services.rest.GEAIApiService.put")
|
|
383
383
|
def test_update_agent_with_upsert(self, mock_put):
|
|
384
384
|
expected_response = {"id": self.agent_id, "name": "Upserted Agent"}
|
|
385
385
|
mock_response = mock_put.return_value
|
|
@@ -409,7 +409,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
409
409
|
data=mock_put.call_args[1]['data']
|
|
410
410
|
)
|
|
411
411
|
|
|
412
|
-
@patch("pygeai.core.services.rest.
|
|
412
|
+
@patch("pygeai.core.services.rest.GEAIApiService.put")
|
|
413
413
|
def test_update_agent_without_resource_pools(self, mock_put):
|
|
414
414
|
expected_response = {"id": self.agent_id, "name": "Updated Agent No Pools"}
|
|
415
415
|
mock_response = mock_put.return_value
|
|
@@ -454,7 +454,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
454
454
|
)
|
|
455
455
|
self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
|
|
456
456
|
|
|
457
|
-
@patch("pygeai.core.services.rest.
|
|
457
|
+
@patch("pygeai.core.services.rest.GEAIApiService.put")
|
|
458
458
|
def test_update_agent_json_decode_error(self, mock_put):
|
|
459
459
|
mock_response = mock_put.return_value
|
|
460
460
|
mock_response.status_code = 200
|