pygeai 0.2.7b36__py3-none-any.whl → 0.2.7b38__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/core/base/mappers.py +11 -2
- pygeai/core/models.py +20 -11
- pygeai/lab/managers.py +54 -129
- pygeai/organization/responses.py +23 -0
- pygeai/tests/health/__init__.py +0 -0
- pygeai/tests/health/test_clients.py +40 -0
- pygeai/tests/integration/lab/agents/test_create_agent.py +39 -34
- pygeai/tests/integration/lab/agents/test_create_sharing_link.py +101 -0
- pygeai/tests/integration/lab/agents/test_delete_agent.py +100 -0
- pygeai/tests/integration/lab/agents/test_get_agent.py +12 -7
- pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +139 -0
- pygeai/tests/integration/lab/agents/test_update_agent.py +69 -42
- pygeai/tests/lab/test_managers.py +45 -45
- pygeai/tests/organization/test_mappers.py +146 -0
- pygeai/tests/snippets/lab/agents/create_agent.py +1 -5
- pygeai/tests/snippets/lab/agents/create_agent_2.py +1 -5
- pygeai/tests/snippets/lab/agents/delete_agent.py +1 -5
- pygeai/tests/snippets/lab/agents/get_agent.py +2 -11
- pygeai/tests/snippets/lab/agents/get_sharing_link.py +3 -7
- pygeai/tests/snippets/lab/agents/list_agents.py +2 -6
- pygeai/tests/snippets/lab/agents/publish_agent_revision.py +2 -6
- pygeai/tests/snippets/lab/agents/update_agent.py +1 -5
- pygeai/tests/snippets/lab/processes/create_process.py +3 -5
- pygeai/tests/snippets/lab/processes/create_task.py +3 -5
- pygeai/tests/snippets/lab/processes/jobs/list_jobs.py +10 -19
- pygeai/tests/snippets/lab/processes/kbs/create_kb.py +2 -5
- pygeai/tests/snippets/lab/processes/kbs/get_kb.py +10 -16
- pygeai/tests/snippets/lab/processes/kbs/list_kbs.py +13 -20
- pygeai/tests/snippets/lab/processes/kbs/try_all.py +5 -7
- pygeai/tests/snippets/lab/processes/list_processes.py +5 -7
- pygeai/tests/snippets/lab/strategies/create_reasoning_strategy.py +2 -5
- pygeai/tests/snippets/lab/strategies/get_reasoning_strategy.py +2 -5
- pygeai/tests/snippets/lab/strategies/list_reasoning_strategies.py +3 -6
- pygeai/tests/snippets/lab/strategies/update_reasoning_strategy.py +2 -5
- pygeai/tests/snippets/lab/tools/create_tool.py +3 -7
- pygeai/tests/snippets/lab/tools/delete_tool.py +2 -6
- pygeai/tests/snippets/lab/tools/get_parameter.py +5 -7
- pygeai/tests/snippets/lab/tools/get_tool.py +5 -7
- pygeai/tests/snippets/lab/tools/list_tools.py +3 -7
- pygeai/tests/snippets/lab/tools/publish_tool_revision.py +3 -5
- pygeai/tests/snippets/lab/tools/set_parameters.py +4 -9
- pygeai/tests/snippets/lab/tools/update_tool.py +4 -8
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/METADATA +1 -1
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/RECORD +48 -42
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/WHEEL +0 -0
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/entry_points.txt +0 -0
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.2.7b36.dist-info → pygeai-0.2.7b38.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
|
-
import unittest
|
|
3
2
|
import uuid
|
|
4
3
|
from pygeai.lab.managers import AILabManager
|
|
5
4
|
from pygeai.lab.models import Agent, AgentData, Prompt, LlmConfig, Model, Sampling, PromptExample, PromptOutput
|
|
6
5
|
from pydantic import ValidationError
|
|
6
|
+
from pygeai.core.common.exceptions import APIError
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TestAILabUpdateAgentIntegration(TestCase):
|
|
@@ -93,11 +93,12 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
93
93
|
self.agent_to_update.name = ""
|
|
94
94
|
for auto_publish in test_params:
|
|
95
95
|
with self.subTest(input=auto_publish):
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"Agent name cannot be empty.",
|
|
96
|
+
with self.assertRaises(APIError) as exception:
|
|
97
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
98
|
+
|
|
99
|
+
self.assertIn(
|
|
100
|
+
"Error received while updating agent: errors=[Error(id=2007, description='Agent name cannot be empty.')]",
|
|
101
|
+
str(exception.exception),
|
|
101
102
|
f"Expected error about missing agent name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
102
103
|
)
|
|
103
104
|
|
|
@@ -108,10 +109,12 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
108
109
|
|
|
109
110
|
for auto_publish in test_params:
|
|
110
111
|
with self.subTest(input=auto_publish):
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
with self.assertRaises(APIError) as exception:
|
|
113
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
114
|
+
|
|
115
|
+
self.assertIn(
|
|
116
|
+
"Agent already exists [name=AritmeticaExpert].",
|
|
117
|
+
str(exception.exception),
|
|
115
118
|
f"Expected error about duplicated agent name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
116
119
|
)
|
|
117
120
|
|
|
@@ -122,17 +125,18 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
122
125
|
|
|
123
126
|
for auto_publish in test_params:
|
|
124
127
|
with self.subTest(input=auto_publish):
|
|
125
|
-
|
|
126
|
-
updated_agent = self.__update_agent(automatic_publish=auto_publish)
|
|
127
128
|
|
|
128
|
-
self.
|
|
129
|
-
|
|
129
|
+
with self.assertRaises(APIError) as exception:
|
|
130
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
131
|
+
|
|
132
|
+
self.assertIn(
|
|
130
133
|
"Invalid character in name (: is not allowed).",
|
|
134
|
+
str(exception.exception),
|
|
131
135
|
f"Expected error about invalid character (:) in name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
132
136
|
)
|
|
133
|
-
self.
|
|
134
|
-
updated_agent.errors[1].description,
|
|
137
|
+
self.assertIn(
|
|
135
138
|
"Invalid character in name (/ is not allowed).",
|
|
139
|
+
str(exception.exception),
|
|
136
140
|
f"Expected error about invalid character (/) in name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
137
141
|
)
|
|
138
142
|
|
|
@@ -143,10 +147,12 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
143
147
|
|
|
144
148
|
for auto_publish in test_params:
|
|
145
149
|
with self.subTest(input=auto_publish):
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
with self.assertRaises(APIError) as exception:
|
|
151
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
152
|
+
|
|
153
|
+
self.assertIn(
|
|
149
154
|
"Agent publicName is required for agents with accessScope=public.",
|
|
155
|
+
str(exception.exception),
|
|
150
156
|
f"Expected error about missing public name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
151
157
|
)
|
|
152
158
|
|
|
@@ -156,12 +162,13 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
156
162
|
self.agent_to_update.public_name = "com.testing.geai.googlesummarizer"
|
|
157
163
|
|
|
158
164
|
for auto_publish in test_params:
|
|
159
|
-
with self.subTest(input=auto_publish):
|
|
160
|
-
|
|
165
|
+
with self.subTest(input=auto_publish):
|
|
166
|
+
with self.assertRaises(APIError) as exception:
|
|
167
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
161
168
|
|
|
162
|
-
self.
|
|
163
|
-
updated_agent.errors[0].description,
|
|
169
|
+
self.assertIn(
|
|
164
170
|
"Agent already exists [publicName=com.testing.geai.googlesummarizer].",
|
|
171
|
+
str(exception.exception),
|
|
165
172
|
f"Expected error about duplicated public name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
166
173
|
)
|
|
167
174
|
|
|
@@ -172,10 +179,12 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
172
179
|
|
|
173
180
|
for auto_publish in test_params:
|
|
174
181
|
with self.subTest(input=auto_publish):
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
182
|
+
with self.assertRaises(APIError) as exception:
|
|
183
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
184
|
+
|
|
185
|
+
self.assertIn(
|
|
178
186
|
"Invalid public name, it can only contain lowercase letters, numbers, periods (.), dashes (-), and underscores (_). Please remove any other characters.",
|
|
187
|
+
str(exception.exception),
|
|
179
188
|
f"Expected error about invalid public name when autopublish is {'enabled' if auto_publish else 'disabled'} was not returned."
|
|
180
189
|
)
|
|
181
190
|
|
|
@@ -189,28 +198,46 @@ class TestAILabUpdateAgentIntegration(TestCase):
|
|
|
189
198
|
with self.assertRaises(ValidationError) as exception:
|
|
190
199
|
self.__update_agent(automatic_publish=auto_publish)
|
|
191
200
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
self.assertIn(
|
|
202
|
+
"instructions",
|
|
203
|
+
str(exception.exception),
|
|
204
|
+
f"Expected a validation error about allowed values for instructions when autopublish is {'enabled' if auto_publish else 'disabled'}"
|
|
205
|
+
)
|
|
206
|
+
self.assertIn(
|
|
207
|
+
"Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]",
|
|
208
|
+
str(exception.exception),
|
|
209
|
+
f"Expected a validation error about allowed values for instructions when autopublish is {'enabled' if auto_publish else 'disabled'}"
|
|
210
|
+
)
|
|
198
211
|
|
|
199
212
|
|
|
200
|
-
@unittest.skip("Mismatched error message")
|
|
201
213
|
def test_update_agent_no_model(self):
|
|
202
214
|
test_params = [ True, False ]
|
|
203
215
|
self.agent_to_update.agent_data.models[0].name = ""
|
|
216
|
+
|
|
204
217
|
for auto_publish in test_params:
|
|
205
|
-
with self.subTest(input=auto_publish):
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
with self.subTest(input=auto_publish):
|
|
219
|
+
if auto_publish == False:
|
|
220
|
+
with self.assertRaises(ValidationError) as exception:
|
|
221
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
222
|
+
error_msg = str(exception.exception)
|
|
223
|
+
|
|
224
|
+
self.assertIn(
|
|
225
|
+
"name",
|
|
226
|
+
error_msg,
|
|
227
|
+
"Expected a validation error about empty model name"
|
|
228
|
+
)
|
|
229
|
+
self.assertIn(
|
|
230
|
+
"Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]",
|
|
231
|
+
error_msg,
|
|
232
|
+
"Expected a validation error about empty model name"
|
|
233
|
+
)
|
|
234
|
+
else:
|
|
235
|
+
with self.assertRaises(APIError) as exception:
|
|
236
|
+
self.__update_agent(automatic_publish=auto_publish)
|
|
237
|
+
error_msg = str(exception.exception)
|
|
238
|
+
self.assertIn(
|
|
239
|
+
"description='Model not found [name=]",
|
|
240
|
+
error_msg,
|
|
214
241
|
"Expected a validation error about allowed values for model name"
|
|
215
242
|
)
|
|
216
243
|
|
|
@@ -13,9 +13,9 @@ class TestAILabManager(unittest.TestCase):
|
|
|
13
13
|
"""
|
|
14
14
|
python -m unittest pygeai.tests.lab.test_managers.TestAILabManager
|
|
15
15
|
"""
|
|
16
|
+
|
|
16
17
|
def setUp(self):
|
|
17
|
-
self.manager = AILabManager(api_key="test_key", base_url="test_url", alias="test_alias")
|
|
18
|
-
self.project_id = "test_project"
|
|
18
|
+
self.manager = AILabManager(api_key="test_key", base_url="test_url", alias="test_alias", project_id="test_project")
|
|
19
19
|
self.agent_id = "test_agent"
|
|
20
20
|
self.tool_id = "test_tool"
|
|
21
21
|
self.process_id = "test_process"
|
|
@@ -31,7 +31,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
31
31
|
mock_list_agents.return_value = {"data": "test_data"}
|
|
32
32
|
mock_map_to_agent_list.return_value = AgentList(agents=[])
|
|
33
33
|
|
|
34
|
-
result = self.manager.get_agent_list(self.
|
|
34
|
+
result = self.manager.get_agent_list(self.filter_settings)
|
|
35
35
|
|
|
36
36
|
mock_list_agents.assert_called_once()
|
|
37
37
|
mock_map_to_agent_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -42,7 +42,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
42
42
|
mock_list_agents.return_value = {"error": {"id": 1, "message": "API error"}}
|
|
43
43
|
|
|
44
44
|
with self.assertRaises(APIError):
|
|
45
|
-
self.manager.get_agent_list(self.
|
|
45
|
+
self.manager.get_agent_list(self.filter_settings)
|
|
46
46
|
|
|
47
47
|
@patch('pygeai.lab.agents.clients.AgentClient.create_agent')
|
|
48
48
|
@patch('pygeai.lab.agents.mappers.AgentMapper.map_to_agent')
|
|
@@ -51,7 +51,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
51
51
|
mock_map_to_agent.return_value = Agent(id=self.agent_id, name="test_agent")
|
|
52
52
|
agent = Agent(name="test_agent")
|
|
53
53
|
|
|
54
|
-
result = self.manager.create_agent(
|
|
54
|
+
result = self.manager.create_agent(agent, automatic_publish=False)
|
|
55
55
|
|
|
56
56
|
mock_create_agent.assert_called_once()
|
|
57
57
|
mock_map_to_agent.assert_called_once_with({"data": "test_data"})
|
|
@@ -64,7 +64,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
64
64
|
mock_map_to_agent.return_value = Agent(id=self.agent_id, name="test_agent")
|
|
65
65
|
agent = Agent(id=self.agent_id, name="test_agent")
|
|
66
66
|
|
|
67
|
-
result = self.manager.update_agent(
|
|
67
|
+
result = self.manager.update_agent(agent, automatic_publish=False, upsert=False)
|
|
68
68
|
|
|
69
69
|
mock_update_agent.assert_called_once()
|
|
70
70
|
mock_map_to_agent.assert_called_once_with({"data": "test_data"})
|
|
@@ -76,7 +76,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
76
76
|
mock_get_agent.return_value = {"data": "test_data"}
|
|
77
77
|
mock_map_to_agent.return_value = Agent(id=self.agent_id, name="test_agent")
|
|
78
78
|
|
|
79
|
-
result = self.manager.get_agent(self.
|
|
79
|
+
result = self.manager.get_agent(self.agent_id, self.filter_settings)
|
|
80
80
|
|
|
81
81
|
mock_get_agent.assert_called_once()
|
|
82
82
|
mock_map_to_agent.assert_called_once_with({"data": "test_data"})
|
|
@@ -88,7 +88,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
88
88
|
mock_create_sharing_link.return_value = {"data": "test_data"}
|
|
89
89
|
mock_map_to_sharing_link.return_value = SharingLink(agent_id="test_agent", api_token="test_token", shared_link="test_link")
|
|
90
90
|
|
|
91
|
-
result = self.manager.create_sharing_link(self.
|
|
91
|
+
result = self.manager.create_sharing_link(self.agent_id)
|
|
92
92
|
|
|
93
93
|
mock_create_sharing_link.assert_called_once()
|
|
94
94
|
mock_map_to_sharing_link.assert_called_once_with({"data": "test_data"})
|
|
@@ -100,7 +100,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
100
100
|
mock_publish_agent_revision.return_value = {"data": "test_data"}
|
|
101
101
|
mock_map_to_agent.return_value = Agent(id=self.agent_id, name="test_agent")
|
|
102
102
|
|
|
103
|
-
result = self.manager.publish_agent_revision(self.
|
|
103
|
+
result = self.manager.publish_agent_revision(self.agent_id, self.revision)
|
|
104
104
|
|
|
105
105
|
mock_publish_agent_revision.assert_called_once()
|
|
106
106
|
mock_map_to_agent.assert_called_once_with({"data": "test_data"})
|
|
@@ -112,7 +112,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
112
112
|
mock_delete_agent.return_value = {"data": "test_data"}
|
|
113
113
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
114
114
|
|
|
115
|
-
result = self.manager.delete_agent(self.
|
|
115
|
+
result = self.manager.delete_agent(self.agent_id)
|
|
116
116
|
|
|
117
117
|
mock_delete_agent.assert_called_once()
|
|
118
118
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -125,7 +125,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
125
125
|
mock_map_to_tool.return_value = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
126
126
|
tool = Tool(name="test_tool", description="test_desc")
|
|
127
127
|
|
|
128
|
-
result = self.manager.create_tool(
|
|
128
|
+
result = self.manager.create_tool(tool, automatic_publish=False)
|
|
129
129
|
|
|
130
130
|
mock_create_tool.assert_called_once()
|
|
131
131
|
mock_map_to_tool.assert_called_once_with({"data": "test_data"})
|
|
@@ -138,7 +138,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
138
138
|
mock_map_to_tool.return_value = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
139
139
|
tool = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
140
140
|
|
|
141
|
-
result = self.manager.update_tool(
|
|
141
|
+
result = self.manager.update_tool(tool, automatic_publish=False, upsert=False)
|
|
142
142
|
|
|
143
143
|
mock_update_tool.assert_called_once()
|
|
144
144
|
mock_map_to_tool.assert_called_once_with({"data": "test_data"})
|
|
@@ -150,7 +150,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
150
150
|
mock_get_tool.return_value = {"data": "test_data"}
|
|
151
151
|
mock_map_to_tool.return_value = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
152
152
|
|
|
153
|
-
result = self.manager.get_tool(self.
|
|
153
|
+
result = self.manager.get_tool(self.tool_id, self.filter_settings)
|
|
154
154
|
|
|
155
155
|
mock_get_tool.assert_called_once()
|
|
156
156
|
mock_map_to_tool.assert_called_once_with({"data": "test_data"})
|
|
@@ -162,7 +162,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
162
162
|
mock_delete_tool.return_value = {"data": "test_data"}
|
|
163
163
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
164
164
|
|
|
165
|
-
result = self.manager.delete_tool(
|
|
165
|
+
result = self.manager.delete_tool(tool_id=self.tool_id)
|
|
166
166
|
|
|
167
167
|
mock_delete_tool.assert_called_once()
|
|
168
168
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -174,7 +174,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
174
174
|
mock_list_tools.return_value = {"data": "test_data"}
|
|
175
175
|
mock_map_to_tool_list.return_value = ToolList(tools=[])
|
|
176
176
|
|
|
177
|
-
result = self.manager.list_tools(self.
|
|
177
|
+
result = self.manager.list_tools(self.filter_settings)
|
|
178
178
|
|
|
179
179
|
mock_list_tools.assert_called_once()
|
|
180
180
|
mock_map_to_tool_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -186,7 +186,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
186
186
|
mock_publish_tool_revision.return_value = {"data": "test_data"}
|
|
187
187
|
mock_map_to_tool.return_value = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
188
188
|
|
|
189
|
-
result = self.manager.publish_tool_revision(self.
|
|
189
|
+
result = self.manager.publish_tool_revision(self.tool_id, self.revision)
|
|
190
190
|
|
|
191
191
|
mock_publish_tool_revision.assert_called_once()
|
|
192
192
|
mock_map_to_tool.assert_called_once_with({"data": "test_data"})
|
|
@@ -198,7 +198,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
198
198
|
mock_get_parameter.return_value = {"data": "test_data"}
|
|
199
199
|
mock_map_to_parameter_list.return_value = [ToolParameter(key="test_key", data_type="String", description="test_desc", is_required=True)]
|
|
200
200
|
|
|
201
|
-
result = self.manager.get_parameter(
|
|
201
|
+
result = self.manager.get_parameter(tool_id=self.tool_id, filter_settings=self.filter_settings)
|
|
202
202
|
|
|
203
203
|
mock_get_parameter.assert_called_once()
|
|
204
204
|
mock_map_to_parameter_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -211,7 +211,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
211
211
|
mock_map_to_tool.return_value = Tool(id=self.tool_id, name="test_tool", description="test_desc")
|
|
212
212
|
parameters = [ToolParameter(key="test_key", data_type="String", description="test_desc", is_required=True)]
|
|
213
213
|
|
|
214
|
-
result = self.manager.set_parameter(
|
|
214
|
+
result = self.manager.set_parameter(tool_id=self.tool_id, parameters=parameters)
|
|
215
215
|
|
|
216
216
|
mock_set_parameter.assert_called_once()
|
|
217
217
|
mock_map_to_tool.assert_called_once_with({"data": "test_data"})
|
|
@@ -236,7 +236,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
236
236
|
mock_map_to_strategy.return_value = ReasoningStrategy(id="test_strategy", name="test_strategy", access_scope="private", type="addendum")
|
|
237
237
|
strategy = ReasoningStrategy(name="test_strategy", access_scope="private", type="addendum", localized_descriptions=[])
|
|
238
238
|
|
|
239
|
-
result = self.manager.create_reasoning_strategy(
|
|
239
|
+
result = self.manager.create_reasoning_strategy(strategy, automatic_publish=False)
|
|
240
240
|
|
|
241
241
|
mock_create_strategy.assert_called_once()
|
|
242
242
|
mock_map_to_strategy.assert_called_once_with({"data": "test_data"})
|
|
@@ -249,7 +249,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
249
249
|
mock_map_to_strategy.return_value = ReasoningStrategy(id="test_strategy", name="test_strategy", access_scope="private", type="addendum")
|
|
250
250
|
strategy = ReasoningStrategy(id="test_strategy", name="test_strategy", access_scope="private", type="addendum", localized_descriptions=[])
|
|
251
251
|
|
|
252
|
-
result = self.manager.update_reasoning_strategy(
|
|
252
|
+
result = self.manager.update_reasoning_strategy(strategy, automatic_publish=False, upsert=False)
|
|
253
253
|
|
|
254
254
|
mock_update_strategy.assert_called_once()
|
|
255
255
|
mock_map_to_strategy.assert_called_once_with({"data": "test_data"})
|
|
@@ -261,7 +261,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
261
261
|
mock_get_strategy.return_value = {"data": "test_data"}
|
|
262
262
|
mock_map_to_strategy.return_value = ReasoningStrategy(id="test_strategy", name="test_strategy", access_scope="private", type="addendum")
|
|
263
263
|
|
|
264
|
-
result = self.manager.get_reasoning_strategy(
|
|
264
|
+
result = self.manager.get_reasoning_strategy(reasoning_strategy_id="test_strategy")
|
|
265
265
|
|
|
266
266
|
mock_get_strategy.assert_called_once()
|
|
267
267
|
mock_map_to_strategy.assert_called_once_with({"data": "test_data"})
|
|
@@ -274,7 +274,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
274
274
|
mock_map_to_process.return_value = AgenticProcess(id=self.process_id, name="test_process")
|
|
275
275
|
process = AgenticProcess(name="test_process", key="test_key")
|
|
276
276
|
|
|
277
|
-
result = self.manager.create_process(
|
|
277
|
+
result = self.manager.create_process(process, automatic_publish=False)
|
|
278
278
|
|
|
279
279
|
mock_create_process.assert_called_once()
|
|
280
280
|
mock_map_to_process.assert_called_once_with({"data": "test_data"})
|
|
@@ -287,7 +287,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
287
287
|
mock_map_to_process.return_value = AgenticProcess(id=self.process_id, name="test_process")
|
|
288
288
|
process = AgenticProcess(id=self.process_id, name="test_process", key="test_key")
|
|
289
289
|
|
|
290
|
-
result = self.manager.update_process(
|
|
290
|
+
result = self.manager.update_process(process, automatic_publish=False, upsert=False)
|
|
291
291
|
|
|
292
292
|
mock_update_process.assert_called_once()
|
|
293
293
|
mock_map_to_process.assert_called_once_with({"data": "test_data"})
|
|
@@ -299,7 +299,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
299
299
|
mock_get_process.return_value = {"data": "test_data"}
|
|
300
300
|
mock_map_to_process.return_value = AgenticProcess(id=self.process_id, name="test_process")
|
|
301
301
|
|
|
302
|
-
result = self.manager.get_process(
|
|
302
|
+
result = self.manager.get_process(process_id=self.process_id, filter_settings=self.filter_settings)
|
|
303
303
|
|
|
304
304
|
mock_get_process.assert_called_once()
|
|
305
305
|
mock_map_to_process.assert_called_once_with({"data": "test_data"})
|
|
@@ -311,7 +311,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
311
311
|
mock_list_processes.return_value = {"data": "test_data"}
|
|
312
312
|
mock_map_to_process_list.return_value = AgenticProcessList(processes=[])
|
|
313
313
|
|
|
314
|
-
result = self.manager.list_processes(self.
|
|
314
|
+
result = self.manager.list_processes(self.filter_settings)
|
|
315
315
|
|
|
316
316
|
mock_list_processes.assert_called_once()
|
|
317
317
|
mock_map_to_process_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -323,7 +323,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
323
323
|
mock_list_instances.return_value = {"data": "test_data"}
|
|
324
324
|
mock_map_to_instance_list.return_value = ProcessInstanceList(instances=[])
|
|
325
325
|
|
|
326
|
-
result = self.manager.list_process_instances(self.
|
|
326
|
+
result = self.manager.list_process_instances(self.process_id, self.filter_settings)
|
|
327
327
|
|
|
328
328
|
mock_list_instances.assert_called_once()
|
|
329
329
|
mock_map_to_instance_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -335,7 +335,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
335
335
|
mock_delete_process.return_value = {"data": "test_data"}
|
|
336
336
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
337
337
|
|
|
338
|
-
result = self.manager.delete_process(
|
|
338
|
+
result = self.manager.delete_process(process_id=self.process_id)
|
|
339
339
|
|
|
340
340
|
mock_delete_process.assert_called_once()
|
|
341
341
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -347,7 +347,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
347
347
|
mock_publish_process_revision.return_value = {"data": "test_data"}
|
|
348
348
|
mock_map_to_process.return_value = AgenticProcess(id=self.process_id, name="test_process")
|
|
349
349
|
|
|
350
|
-
result = self.manager.publish_process_revision(
|
|
350
|
+
result = self.manager.publish_process_revision(process_id=self.process_id, revision=self.revision)
|
|
351
351
|
|
|
352
352
|
mock_publish_process_revision.assert_called_once()
|
|
353
353
|
mock_map_to_process.assert_called_once_with({"data": "test_data"})
|
|
@@ -360,7 +360,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
360
360
|
mock_map_to_task.return_value = Task(id=self.task_id, name="test_task")
|
|
361
361
|
task = Task(name="test_task")
|
|
362
362
|
|
|
363
|
-
result = self.manager.create_task(
|
|
363
|
+
result = self.manager.create_task(task, automatic_publish=False)
|
|
364
364
|
|
|
365
365
|
mock_create_task.assert_called_once()
|
|
366
366
|
mock_map_to_task.assert_called_once_with({"data": "test_data"})
|
|
@@ -372,7 +372,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
372
372
|
mock_get_task.return_value = {"data": "test_data"}
|
|
373
373
|
mock_map_to_task.return_value = Task(id=self.task_id, name="test_task")
|
|
374
374
|
|
|
375
|
-
result = self.manager.get_task(
|
|
375
|
+
result = self.manager.get_task(task_id=self.task_id)
|
|
376
376
|
|
|
377
377
|
mock_get_task.assert_called_once()
|
|
378
378
|
mock_map_to_task.assert_called_once_with({"data": "test_data"})
|
|
@@ -384,7 +384,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
384
384
|
mock_list_tasks.return_value = {"data": "test_data"}
|
|
385
385
|
mock_map_to_task_list.return_value = TaskList(tasks=[])
|
|
386
386
|
|
|
387
|
-
result = self.manager.list_tasks(self.
|
|
387
|
+
result = self.manager.list_tasks(self.filter_settings)
|
|
388
388
|
|
|
389
389
|
mock_list_tasks.assert_called_once()
|
|
390
390
|
mock_map_to_task_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -397,7 +397,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
397
397
|
mock_map_to_task.return_value = Task(id=self.task_id, name="test_task")
|
|
398
398
|
task = Task(id=self.task_id, name="test_task")
|
|
399
399
|
|
|
400
|
-
result = self.manager.update_task(
|
|
400
|
+
result = self.manager.update_task(task, automatic_publish=False, upsert=False)
|
|
401
401
|
|
|
402
402
|
mock_update_task.assert_called_once()
|
|
403
403
|
mock_map_to_task.assert_called_once_with({"data": "test_data"})
|
|
@@ -409,7 +409,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
409
409
|
mock_delete_task.return_value = {"data": "test_data"}
|
|
410
410
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
411
411
|
|
|
412
|
-
result = self.manager.delete_task(
|
|
412
|
+
result = self.manager.delete_task(task_id=self.task_id)
|
|
413
413
|
|
|
414
414
|
mock_delete_task.assert_called_once()
|
|
415
415
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -421,7 +421,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
421
421
|
mock_publish_task_revision.return_value = {"data": "test_data"}
|
|
422
422
|
mock_map_to_task.return_value = Task(id=self.task_id, name="test_task")
|
|
423
423
|
|
|
424
|
-
result = self.manager.publish_task_revision(
|
|
424
|
+
result = self.manager.publish_task_revision(task_id=self.task_id, revision=self.revision)
|
|
425
425
|
|
|
426
426
|
mock_publish_task_revision.assert_called_once()
|
|
427
427
|
mock_map_to_task.assert_called_once_with({"data": "test_data"})
|
|
@@ -433,7 +433,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
433
433
|
mock_start_instance.return_value = {"data": "test_data"}
|
|
434
434
|
mock_map_to_instance.return_value = ProcessInstance(id=self.instance_id, subject="test_subject", process=AgenticProcess(name="test_process"))
|
|
435
435
|
|
|
436
|
-
result = self.manager.start_instance(
|
|
436
|
+
result = self.manager.start_instance("test_process", subject="test_subject", variables=VariableList())
|
|
437
437
|
|
|
438
438
|
mock_start_instance.assert_called_once()
|
|
439
439
|
mock_map_to_instance.assert_called_once_with({"data": "test_data"})
|
|
@@ -445,7 +445,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
445
445
|
mock_abort_instance.return_value = {"data": "test_data"}
|
|
446
446
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
447
447
|
|
|
448
|
-
result = self.manager.abort_instance(self.
|
|
448
|
+
result = self.manager.abort_instance(self.instance_id)
|
|
449
449
|
|
|
450
450
|
mock_abort_instance.assert_called_once()
|
|
451
451
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -457,7 +457,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
457
457
|
mock_get_instance.return_value = {"data": "test_data"}
|
|
458
458
|
mock_map_to_instance.return_value = ProcessInstance(id=self.instance_id, subject="test_subject", process=AgenticProcess(name="test_process"))
|
|
459
459
|
|
|
460
|
-
result = self.manager.get_instance(self.
|
|
460
|
+
result = self.manager.get_instance(self.instance_id)
|
|
461
461
|
|
|
462
462
|
mock_get_instance.assert_called_once()
|
|
463
463
|
mock_map_to_instance.assert_called_once_with({"data": "test_data"})
|
|
@@ -467,7 +467,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
467
467
|
def test_get_instance_history_success(self, mock_get_instance_history):
|
|
468
468
|
mock_get_instance_history.return_value = {"history": "test_history"}
|
|
469
469
|
|
|
470
|
-
result = self.manager.get_instance_history(self.
|
|
470
|
+
result = self.manager.get_instance_history(self.instance_id)
|
|
471
471
|
|
|
472
472
|
mock_get_instance_history.assert_called_once()
|
|
473
473
|
self.assertIsInstance(result, dict)
|
|
@@ -476,7 +476,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
476
476
|
def test_get_thread_information_success(self, mock_get_thread_information):
|
|
477
477
|
mock_get_thread_information.return_value = {"info": "test_info"}
|
|
478
478
|
|
|
479
|
-
result = self.manager.get_thread_information(
|
|
479
|
+
result = self.manager.get_thread_information("test_thread")
|
|
480
480
|
|
|
481
481
|
mock_get_thread_information.assert_called_once()
|
|
482
482
|
self.assertIsInstance(result, dict)
|
|
@@ -487,7 +487,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
487
487
|
mock_send_user_signal.return_value = {"data": "test_data"}
|
|
488
488
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
489
489
|
|
|
490
|
-
result = self.manager.send_user_signal(self.
|
|
490
|
+
result = self.manager.send_user_signal(self.instance_id, "test_signal")
|
|
491
491
|
|
|
492
492
|
mock_send_user_signal.assert_called_once()
|
|
493
493
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -500,7 +500,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
500
500
|
mock_map_to_kb.return_value = KnowledgeBase(id=self.kb_id, name="test_kb")
|
|
501
501
|
kb = KnowledgeBase(name="test_kb")
|
|
502
502
|
|
|
503
|
-
result = self.manager.create_knowledge_base(
|
|
503
|
+
result = self.manager.create_knowledge_base(kb)
|
|
504
504
|
|
|
505
505
|
mock_create_kb.assert_called_once()
|
|
506
506
|
mock_map_to_kb.assert_called_once_with({"data": "test_data"})
|
|
@@ -512,7 +512,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
512
512
|
mock_list_kbs.return_value = {"data": "test_data"}
|
|
513
513
|
mock_map_to_kb_list.return_value = KnowledgeBaseList(knowledge_bases=[])
|
|
514
514
|
|
|
515
|
-
result = self.manager.list_knowledge_bases(
|
|
515
|
+
result = self.manager.list_knowledge_bases(start=0, count=10)
|
|
516
516
|
|
|
517
517
|
mock_list_kbs.assert_called_once()
|
|
518
518
|
mock_map_to_kb_list.assert_called_once_with({"data": "test_data"})
|
|
@@ -524,7 +524,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
524
524
|
mock_get_kb.return_value = {"data": "test_data"}
|
|
525
525
|
mock_map_to_kb.return_value = KnowledgeBase(id=self.kb_id, name="test_kb")
|
|
526
526
|
|
|
527
|
-
result = self.manager.get_knowledge_base(
|
|
527
|
+
result = self.manager.get_knowledge_base(kb_id=self.kb_id)
|
|
528
528
|
|
|
529
529
|
mock_get_kb.assert_called_once()
|
|
530
530
|
mock_map_to_kb.assert_called_once_with({"data": "test_data"})
|
|
@@ -536,7 +536,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
536
536
|
mock_delete_kb.return_value = {"data": "test_data"}
|
|
537
537
|
mock_map_to_empty_response.return_value = {"status": "success"}
|
|
538
538
|
|
|
539
|
-
result = self.manager.delete_knowledge_base(
|
|
539
|
+
result = self.manager.delete_knowledge_base(kb_id=self.kb_id)
|
|
540
540
|
|
|
541
541
|
mock_delete_kb.assert_called_once()
|
|
542
542
|
mock_map_to_empty_response.assert_called_once()
|
|
@@ -548,7 +548,7 @@ class TestAILabManager(unittest.TestCase):
|
|
|
548
548
|
mock_list_jobs.return_value = {"data": "test_data"}
|
|
549
549
|
mock_map_to_job_list.return_value = JobList(jobs=[])
|
|
550
550
|
|
|
551
|
-
result = self.manager.list_jobs(self.
|
|
551
|
+
result = self.manager.list_jobs(self.filter_settings)
|
|
552
552
|
|
|
553
553
|
mock_list_jobs.assert_called_once()
|
|
554
554
|
mock_map_to_job_list.assert_called_once_with({"data": "test_data"})
|