pygeai 0.4.0b12__py3-none-any.whl → 0.5.0__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 -1
- pygeai/cli/__init__.py +1 -1
- pygeai/core/base/session.py +1 -1
- pygeai/tests/cli/docker/__init__.py +0 -0
- pygeai/tests/integration/assistants/rag/test_create_rag.py +24 -5
- pygeai/tests/integration/chat/test_generate_image.py +1 -5
- pygeai/tests/integration/lab/agents/test_create_agent.py +13 -7
- pygeai/tests/integration/lab/agents/test_create_sharing_link.py +4 -1
- pygeai/tests/integration/lab/agents/test_update_agent.py +15 -18
- pygeai/tests/integration/lab/processes/__init__.py +0 -0
- pygeai/tests/integration/lab/processes/test_create_process.py +345 -0
- pygeai/tests/integration/lab/processes/test_get_process.py +201 -0
- pygeai/tests/integration/lab/processes/test_update_process.py +289 -0
- pygeai/tests/integration/lab/reasoning_strategies/__init__.py +0 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +70 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +93 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +149 -0
- pygeai/tests/integration/lab/tools/test_create_tool.py +12 -16
- pygeai/tests/integration/lab/tools/test_delete_tool.py +3 -3
- pygeai/tests/integration/lab/tools/test_get_tool.py +3 -3
- pygeai/tests/integration/lab/tools/test_update_tool.py +8 -9
- pygeai/tests/snippets/lab/agentic_flow_example_4.py +23 -23
- pygeai/tests/snippets/lab/samples/summarize_files.py +3 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example.py +3 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +11 -11
- pygeai/tests/snippets/lab/use_cases/update_web_reader.py +1 -2
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/METADATA +44 -16
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/RECORD +32 -23
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/WHEEL +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/entry_points.txt +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
from unittest import TestCase
|
|
2
|
+
import unittest
|
|
3
|
+
import uuid
|
|
4
|
+
from pygeai.lab.managers import AILabManager
|
|
5
|
+
from pygeai.lab.models import LocalizedDescription, ReasoningStrategy
|
|
6
|
+
from pydantic import ValidationError
|
|
7
|
+
from pygeai.core.common.exceptions import APIError, APIResponseError
|
|
8
|
+
|
|
9
|
+
class TestAILabCreateReasoningStrategyIntegration(TestCase):
|
|
10
|
+
def setUp(self):
|
|
11
|
+
"""
|
|
12
|
+
Set up the test environment.
|
|
13
|
+
"""
|
|
14
|
+
self.ai_lab_manager = AILabManager(alias="beta")
|
|
15
|
+
self.strategy_to_update = self.__load_strategy()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def __load_strategy(self):
|
|
19
|
+
self.random_str = str(uuid.uuid4())
|
|
20
|
+
return ReasoningStrategy(
|
|
21
|
+
id="323f5f94-5a3d-4717-89f3-3554a33c093f",
|
|
22
|
+
name=f"UpdatedStrategy_{self.random_str}",
|
|
23
|
+
system_prompt=f"Let's think step by step. {self.random_str}",
|
|
24
|
+
access_scope="private",
|
|
25
|
+
type="addendum",
|
|
26
|
+
localized_descriptions=[
|
|
27
|
+
LocalizedDescription(language="spanish", description=f"RSName spanish description {self.random_str}"),
|
|
28
|
+
LocalizedDescription(language="english", description=f"RSName english description {self.random_str}"),
|
|
29
|
+
LocalizedDescription(language="japanese", description=f"RSName japanese description {self.random_str}")
|
|
30
|
+
]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def __update_strategy(self, strategy=None, upsert = False):
|
|
35
|
+
"""
|
|
36
|
+
Helper to create a reasoning strategy using ai_lab_manager.
|
|
37
|
+
"""
|
|
38
|
+
return self.ai_lab_manager.update_reasoning_strategy(
|
|
39
|
+
strategy=self.strategy_to_update if strategy is None else strategy,
|
|
40
|
+
upsert=upsert
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_update_strategy_full_data(self):
|
|
45
|
+
self.updated_strategy = self.__update_strategy()
|
|
46
|
+
|
|
47
|
+
self.assertEqual(self.updated_strategy.name, self.strategy_to_update.name)
|
|
48
|
+
self.assertEqual(self.updated_strategy.system_prompt, self.strategy_to_update.system_prompt)
|
|
49
|
+
|
|
50
|
+
for locale in self.updated_strategy.localized_descriptions:
|
|
51
|
+
self.assertIn(
|
|
52
|
+
self.random_str,
|
|
53
|
+
locale.description,
|
|
54
|
+
"Expected the localized description to be updated correctly"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_update_strategy_no_name(self):
|
|
59
|
+
self.strategy_to_update.name = None
|
|
60
|
+
|
|
61
|
+
with self.assertRaises(APIError) as exception:
|
|
62
|
+
self.__update_strategy()
|
|
63
|
+
self.assertIn(
|
|
64
|
+
"ReasoningStrategy name cannot be empty",
|
|
65
|
+
str(exception.exception),
|
|
66
|
+
"The expected error about empty name was not returned"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_update_strategy_no_system_prompt(self):
|
|
71
|
+
self.strategy_to_update.system_prompt = None
|
|
72
|
+
|
|
73
|
+
with self.assertRaises(APIError) as exception:
|
|
74
|
+
self.__update_strategy()
|
|
75
|
+
self.assertIn(
|
|
76
|
+
"ReasoningStrategy template or systemPrompt are required.",
|
|
77
|
+
str(exception.exception),
|
|
78
|
+
"The expected error about empty system_prompt was not returned"
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_update_strategy_no_public_name(self):
|
|
83
|
+
self.strategy_to_update.access_scope = "public"
|
|
84
|
+
with self.assertRaises(APIError) as exception:
|
|
85
|
+
self.__update_strategy()
|
|
86
|
+
self.assertIn(
|
|
87
|
+
"ReasoningStrategy publicName is required for public strategies",
|
|
88
|
+
str(exception.exception),
|
|
89
|
+
"The expected error about missing public name was not returned"
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_update_strategy_no_access_scope(self):
|
|
94
|
+
self.strategy_to_update.access_scope = ""
|
|
95
|
+
with self.assertRaises(ValueError) as exception:
|
|
96
|
+
self.__update_strategy()
|
|
97
|
+
self.assertIn(
|
|
98
|
+
"Access scope must be either 'public' or 'private'",
|
|
99
|
+
str(exception.exception),
|
|
100
|
+
"The expected error about missing access scope was not returned"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_update_strategy_no_type(self):
|
|
105
|
+
self.strategy_to_update.type = ""
|
|
106
|
+
with self.assertRaises(ValueError) as exception:
|
|
107
|
+
self.__update_strategy()
|
|
108
|
+
self.assertIn(
|
|
109
|
+
"Type must be 'addendum'",
|
|
110
|
+
str(exception.exception),
|
|
111
|
+
"The expected error about missing type was not returned"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_update_strategy_invalid_type(self):
|
|
116
|
+
self.strategy_to_update.type = "strategy_type"
|
|
117
|
+
|
|
118
|
+
with self.assertRaises(ValueError) as exception:
|
|
119
|
+
self.__update_strategy()
|
|
120
|
+
self.assertIn(
|
|
121
|
+
"Type must be 'addendum'",
|
|
122
|
+
str(exception.exception),
|
|
123
|
+
"The expected error about missing type was not returned"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_update_strategy_no_localized_descriptions(self):
|
|
128
|
+
self.strategy_to_update.localized_descriptions = []
|
|
129
|
+
updated_strategy = self.__update_strategy()
|
|
130
|
+
self.assertIsNone(
|
|
131
|
+
updated_strategy.localized_descriptions,
|
|
132
|
+
"Expected no localized descriptions after update"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
@unittest.skip("Skipping upsert test to avoid creating new strategies during routine testing before having a cleanup mechanism.")
|
|
136
|
+
def test_update_strategy_upsert(self):
|
|
137
|
+
new_id = str(uuid.uuid4())
|
|
138
|
+
new_strategy = ReasoningStrategy(
|
|
139
|
+
id=new_id,
|
|
140
|
+
name=f"UpsertStrategy_{self.random_str}",
|
|
141
|
+
system_prompt=f"Upsert system prompt {self.random_str}",
|
|
142
|
+
access_scope="private",
|
|
143
|
+
type="addendum",
|
|
144
|
+
localized_descriptions=[
|
|
145
|
+
LocalizedDescription(language="english", description=f"Upsert description {self.random_str}")
|
|
146
|
+
]
|
|
147
|
+
)
|
|
148
|
+
upserted_strategy = self.__update_strategy(strategy=new_strategy, upsert=True)
|
|
149
|
+
self.assertEqual(upserted_strategy.id, new_id, "Expected the reasoning strategy to be created via upsert")
|
|
@@ -2,8 +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, ToolParameter
|
|
5
|
-
from
|
|
6
|
-
from pygeai.core.common.exceptions import APIError
|
|
5
|
+
from pygeai.core.common.exceptions import APIResponseError
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class TestAILabCreateToolIntegration(TestCase):
|
|
@@ -94,15 +93,12 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
94
93
|
|
|
95
94
|
for auto_publish in test_params:
|
|
96
95
|
|
|
97
|
-
with self.subTest(input=auto_publish):
|
|
98
|
-
|
|
99
|
-
self.new_tool = Tool(
|
|
96
|
+
with self.subTest(input=auto_publish):
|
|
97
|
+
self.new_tool = Tool(
|
|
100
98
|
name=str(uuid.uuid4())
|
|
101
99
|
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
self.assertIn("description", str(context.exception))
|
|
105
|
-
self.assertIn("Field required", str(context.exception))
|
|
100
|
+
created_tool = self.__create_tool(automatic_publish=auto_publish)
|
|
101
|
+
self.assertTrue(isinstance(created_tool, Tool), "Expected a created tool")
|
|
106
102
|
|
|
107
103
|
|
|
108
104
|
def test_create_tool_no_name(self):
|
|
@@ -111,7 +107,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
111
107
|
for auto_publish in test_params:
|
|
112
108
|
with self.subTest(input=auto_publish):
|
|
113
109
|
self.new_tool.name = ""
|
|
114
|
-
with self.assertRaises(
|
|
110
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
115
111
|
self.__create_tool(automatic_publish=auto_publish)
|
|
116
112
|
|
|
117
113
|
self.assertIn(
|
|
@@ -128,7 +124,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
128
124
|
|
|
129
125
|
with self.subTest(input=auto_publish):
|
|
130
126
|
self.new_tool.name = "sdk_project_gemini_tool"
|
|
131
|
-
with self.assertRaises(
|
|
127
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
132
128
|
self.__create_tool(automatic_publish=auto_publish)
|
|
133
129
|
self.assertIn(
|
|
134
130
|
"Tool already exists [name=sdk_project_gemini_tool]..",
|
|
@@ -145,7 +141,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
145
141
|
new_tool = self.__load_tool()
|
|
146
142
|
new_tool2 = self.__load_tool()
|
|
147
143
|
|
|
148
|
-
with self.assertRaises(
|
|
144
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
149
145
|
new_tool.name = f"{new_tool.name}:invalid"
|
|
150
146
|
self.__create_tool(tool=new_tool, automatic_publish=auto_publish)
|
|
151
147
|
self.assertIn(
|
|
@@ -154,7 +150,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
154
150
|
f"Expected an error about invalid character (:) in tool name with autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
155
151
|
)
|
|
156
152
|
|
|
157
|
-
with self.assertRaises(
|
|
153
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
158
154
|
new_tool2.name = f"{new_tool2.name}/invalid"
|
|
159
155
|
self.__create_tool(tool=new_tool2, automatic_publish=auto_publish)
|
|
160
156
|
self.assertIn(
|
|
@@ -190,7 +186,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
190
186
|
with self.subTest(input=auto_publish):
|
|
191
187
|
self.new_tool.access_scope = "public"
|
|
192
188
|
self.new_tool.public_name = None
|
|
193
|
-
with self.assertRaises(
|
|
189
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
194
190
|
self.__create_tool(automatic_publish=auto_publish)
|
|
195
191
|
self.assertIn(
|
|
196
192
|
"Tool publicName is required for tools with accessScope=public.",
|
|
@@ -206,7 +202,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
206
202
|
with self.subTest(input=auto_publish):
|
|
207
203
|
self.new_tool.access_scope = "public"
|
|
208
204
|
self.new_tool.public_name = "com.sdk.testing#" # Add invalid character to public name
|
|
209
|
-
with self.assertRaises(
|
|
205
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
210
206
|
self.__create_tool(automatic_publish=auto_publish)
|
|
211
207
|
|
|
212
208
|
self.assertIn(
|
|
@@ -232,7 +228,7 @@ class TestAILabCreateToolIntegration(TestCase):
|
|
|
232
228
|
duplicated_pn_tool.access_scope = "public"
|
|
233
229
|
duplicated_pn_tool.public_name = self.created_tool.public_name
|
|
234
230
|
|
|
235
|
-
with self.assertRaises(
|
|
231
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
236
232
|
self.__create_tool(tool=duplicated_pn_tool, automatic_publish=auto_publish)
|
|
237
233
|
self.assertIn(
|
|
238
234
|
f"Tool already exists [publicName={self.created_tool.public_name}].",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
2
|
import uuid
|
|
3
3
|
from pygeai.lab.managers import AILabManager
|
|
4
|
-
from pygeai.lab.models import Tool
|
|
5
|
-
from pygeai.core.common.exceptions import MissingRequirementException, InvalidAPIResponseException
|
|
4
|
+
from pygeai.lab.models import Tool
|
|
5
|
+
from pygeai.core.common.exceptions import APIResponseError, MissingRequirementException, InvalidAPIResponseException
|
|
6
6
|
|
|
7
7
|
ai_lab_manager: AILabManager
|
|
8
8
|
|
|
@@ -66,7 +66,7 @@ class TestAILabDeleteToolIntegration(TestCase):
|
|
|
66
66
|
def test_delete_tool_invalid_id_valid_name(self):
|
|
67
67
|
invalid_id = "0026e53d-ea78-4cac-af9f-12650invalid"
|
|
68
68
|
created_tool = self.__create_tool()
|
|
69
|
-
with self.assertRaises(
|
|
69
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
70
70
|
self.__delete_tool(tool_name=created_tool.name, tool_id=invalid_id)
|
|
71
71
|
|
|
72
72
|
self.assertIn(
|
|
@@ -2,7 +2,7 @@ from unittest import TestCase
|
|
|
2
2
|
import unittest
|
|
3
3
|
from pygeai.lab.managers import AILabManager
|
|
4
4
|
from pygeai.lab.models import Tool, FilterSettings
|
|
5
|
-
from pygeai.core.common.exceptions import
|
|
5
|
+
from pygeai.core.common.exceptions import APIResponseError
|
|
6
6
|
import copy
|
|
7
7
|
|
|
8
8
|
ai_lab_manager: AILabManager
|
|
@@ -36,7 +36,7 @@ class TestAILabGetToolIntegration(TestCase):
|
|
|
36
36
|
|
|
37
37
|
def test_get_tool_invalid_tool_id(self):
|
|
38
38
|
invalid_id = "0026e53d-ea78-4cac-af9f-12650invalid"
|
|
39
|
-
with self.assertRaises(
|
|
39
|
+
with self.assertRaises(APIResponseError) as context:
|
|
40
40
|
self.__get_tool(tool_id=invalid_id)
|
|
41
41
|
self.assertIn(
|
|
42
42
|
f"Tool not found [IdOrName= {invalid_id}].",
|
|
@@ -65,7 +65,7 @@ class TestAILabGetToolIntegration(TestCase):
|
|
|
65
65
|
def test_get_tool_by_earlier_revision(self):
|
|
66
66
|
filter_settings = copy.deepcopy(self.filter_settings)
|
|
67
67
|
filter_settings.revision = "2"
|
|
68
|
-
with self.assertRaises(
|
|
68
|
+
with self.assertRaises(APIResponseError) as context:
|
|
69
69
|
self.__get_tool(filter_settings=filter_settings)
|
|
70
70
|
self.assertIn(
|
|
71
71
|
f"Requested revision not found [revision={filter_settings.revision}].",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
2
|
import uuid
|
|
3
|
-
from pygeai.core.common.exceptions import
|
|
3
|
+
from pygeai.core.common.exceptions import APIResponseError
|
|
4
4
|
from pygeai.lab.managers import AILabManager
|
|
5
5
|
from pygeai.lab.models import Tool, ToolParameter
|
|
6
6
|
|
|
@@ -65,7 +65,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
65
65
|
tool = self.__load_tool()
|
|
66
66
|
tool2 = self.__load_tool()
|
|
67
67
|
|
|
68
|
-
with self.assertRaises(
|
|
68
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
69
69
|
tool.name = f"{tool.name}:invalid"
|
|
70
70
|
self.__update_tool(tool=tool, automatic_publish=auto_publish)
|
|
71
71
|
self.assertIn(
|
|
@@ -74,7 +74,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
74
74
|
f"Expected an error about invalid character (:) in tool name with autopublish {'enabled' if auto_publish else 'disabled'}"
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
-
with self.assertRaises(
|
|
77
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
78
78
|
tool2.name = f"{tool2.name}/invalid"
|
|
79
79
|
self.__update_tool(tool=tool2, automatic_publish=auto_publish)
|
|
80
80
|
self.assertIn(
|
|
@@ -91,7 +91,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
91
91
|
|
|
92
92
|
with self.subTest(input=auto_publish):
|
|
93
93
|
self.tool_to_update.name = "sdk_project_gemini_tool"
|
|
94
|
-
with self.assertRaises(
|
|
94
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
95
95
|
self.__update_tool(automatic_publish=auto_publish)
|
|
96
96
|
self.assertIn(
|
|
97
97
|
"Tool already exists",
|
|
@@ -107,7 +107,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
107
107
|
|
|
108
108
|
with self.subTest(input=auto_publish):
|
|
109
109
|
self.tool_to_update.name = ""
|
|
110
|
-
with self.assertRaises(
|
|
110
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
111
111
|
self.__update_tool(automatic_publish=auto_publish)
|
|
112
112
|
self.assertIn(
|
|
113
113
|
"Tool name cannot be empty",
|
|
@@ -123,7 +123,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
123
123
|
with self.subTest(input=auto_publish):
|
|
124
124
|
invalid_id = "0026e53d-ea78-4cac-af9f-12650invalid"
|
|
125
125
|
self.tool_to_update.id = invalid_id
|
|
126
|
-
with self.assertRaises(
|
|
126
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
127
127
|
self.__update_tool(automatic_publish=auto_publish)
|
|
128
128
|
self.assertIn(
|
|
129
129
|
f"Tool not found [IdOrName= {invalid_id}",
|
|
@@ -172,7 +172,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
172
172
|
self.tool_to_update.public_name = "invalid#name"
|
|
173
173
|
for auto_publish in test_params:
|
|
174
174
|
with self.subTest(input=auto_publish):
|
|
175
|
-
with self.assertRaises(
|
|
175
|
+
with self.assertRaises(APIResponseError) as exception:
|
|
176
176
|
self.__update_tool(automatic_publish=auto_publish)
|
|
177
177
|
self.assertIn(
|
|
178
178
|
"Invalid public name, it can only contain lowercase letters, numbers, periods (.), dashes (-), and underscores (_). Please remove any other characters.",
|
|
@@ -219,7 +219,7 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
219
219
|
|
|
220
220
|
for auto_publish in test_params:
|
|
221
221
|
with self.subTest(input=auto_publish):
|
|
222
|
-
with self.assertRaises(
|
|
222
|
+
with self.assertRaises(APIResponseError) as exc:
|
|
223
223
|
self.__update_tool(automatic_publish=auto_publish)
|
|
224
224
|
self.assertIn(
|
|
225
225
|
"Either openApi (URL with the OpenAPI definition) or the openApiJson (with the conent) are required for api-tools.",
|
|
@@ -245,7 +245,6 @@ class TestAILabUpdateToolIntegration(TestCase):
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
def test_update_tool_upsert(self):
|
|
248
|
-
print(self.tool_to_update)
|
|
249
248
|
self.tool_to_update.id = str(uuid.uuid4())
|
|
250
249
|
self.tool_to_update.name = str(uuid.uuid4())
|
|
251
250
|
result = self.__update_tool(upsert=True)
|
|
@@ -22,23 +22,23 @@ def rollback():
|
|
|
22
22
|
print("\n=== Initiating Rollback ===")
|
|
23
23
|
if created_entities["instance_id"]:
|
|
24
24
|
print(f"Deleting instance {created_entities['instance_id']}...")
|
|
25
|
-
result = manager.abort_instance(
|
|
25
|
+
result = manager.abort_instance(instance_id=created_entities["instance_id"])
|
|
26
26
|
print(f"Rollback: {result}")
|
|
27
27
|
if created_entities["process_id"]:
|
|
28
28
|
print(f"Deleting process {created_entities['process_id']}...")
|
|
29
|
-
result = manager.delete_process(
|
|
29
|
+
result = manager.delete_process(process_id=created_entities["process_id"])
|
|
30
30
|
print(f"Rollback: {result}")
|
|
31
31
|
if created_entities["task_id"]:
|
|
32
32
|
print(f"Deleting task {created_entities['task_id']}...")
|
|
33
|
-
result = manager.delete_task(
|
|
33
|
+
result = manager.delete_task(task_id=created_entities["task_id"])
|
|
34
34
|
print(f"Rollback: {result}")
|
|
35
35
|
if created_entities["tool_id"]:
|
|
36
36
|
print(f"Deleting tool {created_entities['tool_id']}...")
|
|
37
|
-
result = manager.delete_tool(
|
|
37
|
+
result = manager.delete_tool(tool_id=created_entities["tool_id"])
|
|
38
38
|
print(f"Rollback: {result}")
|
|
39
39
|
if created_entities["agent_id"]:
|
|
40
40
|
print(f"Deleting agent {created_entities['agent_id']}...")
|
|
41
|
-
result = manager.delete_agent(
|
|
41
|
+
result = manager.delete_agent(agent_id=created_entities["agent_id"])
|
|
42
42
|
print(f"Rollback: {result}")
|
|
43
43
|
print("Rollback complete.")
|
|
44
44
|
|
|
@@ -82,7 +82,7 @@ def main():
|
|
|
82
82
|
revision=1,
|
|
83
83
|
status="pending"
|
|
84
84
|
)
|
|
85
|
-
create_tool_result = manager.create_tool(
|
|
85
|
+
create_tool_result = manager.create_tool(tool=tool, automatic_publish=False)
|
|
86
86
|
if isinstance(create_tool_result, Tool):
|
|
87
87
|
print(f"Success: Created Tool: {create_tool_result.name}, ID: {create_tool_result.id}")
|
|
88
88
|
created_entities["tool_id"] = create_tool_result.id
|
|
@@ -107,7 +107,7 @@ def main():
|
|
|
107
107
|
value="English"
|
|
108
108
|
)
|
|
109
109
|
)
|
|
110
|
-
update_tool_result = manager.update_tool(
|
|
110
|
+
update_tool_result = manager.update_tool(tool=tool, automatic_publish=False)
|
|
111
111
|
if isinstance(update_tool_result, Tool):
|
|
112
112
|
print(f"Success: Updated Tool: {update_tool_result.description}")
|
|
113
113
|
else:
|
|
@@ -116,7 +116,7 @@ def main():
|
|
|
116
116
|
exit()
|
|
117
117
|
|
|
118
118
|
print("Publishing tool revision '1'...")
|
|
119
|
-
publish_tool_result = manager.publish_tool_revision(
|
|
119
|
+
publish_tool_result = manager.publish_tool_revision(tool_id=created_entities["tool_id"], revision="1")
|
|
120
120
|
if isinstance(publish_tool_result, Tool):
|
|
121
121
|
print(f"Success: Published Tool Revision: {publish_tool_result.name}")
|
|
122
122
|
else:
|
|
@@ -125,7 +125,7 @@ def main():
|
|
|
125
125
|
exit()
|
|
126
126
|
|
|
127
127
|
print("Retrieving latest tool version...")
|
|
128
|
-
latest_tool = manager.get_tool(
|
|
128
|
+
latest_tool = manager.get_tool(tool_id=created_entities["tool_id"])
|
|
129
129
|
if isinstance(latest_tool, Tool):
|
|
130
130
|
print(f"Success: Latest Tool: {latest_tool.name}, Description: {latest_tool.description}")
|
|
131
131
|
else:
|
|
@@ -184,7 +184,7 @@ def main():
|
|
|
184
184
|
revision=1,
|
|
185
185
|
status="pending"
|
|
186
186
|
)
|
|
187
|
-
create_agent_result = manager.create_agent(
|
|
187
|
+
create_agent_result = manager.create_agent(agent=agent, automatic_publish=False)
|
|
188
188
|
if isinstance(create_agent_result, Agent):
|
|
189
189
|
print(f"Success: Created Agent: {create_agent_result.name}, ID: {create_agent_result.id}")
|
|
190
190
|
created_entities["agent_id"] = create_agent_result.id
|
|
@@ -200,7 +200,7 @@ def main():
|
|
|
200
200
|
agent.description = "Improved agent for text summarization tasks"
|
|
201
201
|
agent.job_description = "Summarizes text and extracts key insights"
|
|
202
202
|
|
|
203
|
-
update_agent_result = manager.update_agent(
|
|
203
|
+
update_agent_result = manager.update_agent(agent=agent, automatic_publish=False)
|
|
204
204
|
if isinstance(update_agent_result, Agent):
|
|
205
205
|
print(f"Success: Updated Agent: {update_agent_result.description}")
|
|
206
206
|
else:
|
|
@@ -209,7 +209,7 @@ def main():
|
|
|
209
209
|
exit()
|
|
210
210
|
|
|
211
211
|
print("Publishing agent revision '1'...")
|
|
212
|
-
publish_agent_result = manager.publish_agent_revision(
|
|
212
|
+
publish_agent_result = manager.publish_agent_revision(agent_id=created_entities["agent_id"], revision="1")
|
|
213
213
|
if isinstance(publish_agent_result, Agent):
|
|
214
214
|
print(f"Success: Published Agent Revision: {publish_agent_result.name}")
|
|
215
215
|
else:
|
|
@@ -218,7 +218,7 @@ def main():
|
|
|
218
218
|
exit()
|
|
219
219
|
|
|
220
220
|
print("Retrieving latest agent version...")
|
|
221
|
-
latest_agent = manager.get_agent(
|
|
221
|
+
latest_agent = manager.get_agent(agent_id=created_entities["agent_id"])
|
|
222
222
|
if isinstance(latest_agent, Agent):
|
|
223
223
|
print(f"Success: Latest Agent: {latest_agent.name}, Description: {latest_agent.description}")
|
|
224
224
|
else:
|
|
@@ -259,7 +259,7 @@ def main():
|
|
|
259
259
|
revision=1,
|
|
260
260
|
status="pending"
|
|
261
261
|
)
|
|
262
|
-
create_task_result = manager.create_task(
|
|
262
|
+
create_task_result = manager.create_task(task=task, automatic_publish=False)
|
|
263
263
|
if isinstance(create_task_result, Task):
|
|
264
264
|
print(f"Success: Created Task: {create_task_result.name}, ID: {create_task_result.id}")
|
|
265
265
|
created_entities["task_id"] = create_task_result.id
|
|
@@ -275,7 +275,7 @@ def main():
|
|
|
275
275
|
task.description = "Enhanced task for text summarization and analysis"
|
|
276
276
|
task.prompt_data.instructions = "Summarize text and highlight key insights."
|
|
277
277
|
|
|
278
|
-
update_task_result = manager.update_task(
|
|
278
|
+
update_task_result = manager.update_task(task=task, automatic_publish=False)
|
|
279
279
|
if isinstance(update_task_result, Task):
|
|
280
280
|
print(f"Success: Updated Task: {update_task_result.description}")
|
|
281
281
|
else:
|
|
@@ -284,7 +284,7 @@ def main():
|
|
|
284
284
|
exit()
|
|
285
285
|
|
|
286
286
|
print("Publishing task revision '1'...")
|
|
287
|
-
publish_task_result = manager.publish_task_revision(
|
|
287
|
+
publish_task_result = manager.publish_task_revision(task_id=created_entities["task_id"], revision="1")
|
|
288
288
|
if isinstance(publish_task_result, Task):
|
|
289
289
|
print(f"Success: Published Task Revision: {publish_task_result.name}")
|
|
290
290
|
else:
|
|
@@ -293,7 +293,7 @@ def main():
|
|
|
293
293
|
exit()
|
|
294
294
|
|
|
295
295
|
print("Retrieving latest task version...")
|
|
296
|
-
latest_task = manager.get_task(
|
|
296
|
+
latest_task = manager.get_task(task_id=created_entities["task_id"])
|
|
297
297
|
if isinstance(latest_task, Task):
|
|
298
298
|
print(f"Success: Latest Task: {latest_task.name}, Description: {latest_task.description}")
|
|
299
299
|
else:
|
|
@@ -358,7 +358,7 @@ def main():
|
|
|
358
358
|
revision=1,
|
|
359
359
|
status="pending"
|
|
360
360
|
)
|
|
361
|
-
create_process_result = manager.create_process(
|
|
361
|
+
create_process_result = manager.create_process(process=process, automatic_publish=False)
|
|
362
362
|
if isinstance(create_process_result, AgenticProcess):
|
|
363
363
|
print(f"Success: Created Process: {create_process_result.name}, ID: {create_process_result.id}")
|
|
364
364
|
created_entities["process_id"] = create_process_result.id
|
|
@@ -373,7 +373,7 @@ def main():
|
|
|
373
373
|
process.description = "Optimized process for text summarization workflows"
|
|
374
374
|
process.agentic_activities[0].name = "Advanced Text Summarization"
|
|
375
375
|
|
|
376
|
-
update_process_result = manager.update_process(
|
|
376
|
+
update_process_result = manager.update_process(process=process, automatic_publish=False)
|
|
377
377
|
if isinstance(update_process_result, AgenticProcess):
|
|
378
378
|
print(f"Success: Updated Process: {update_process_result.description}")
|
|
379
379
|
else:
|
|
@@ -382,7 +382,7 @@ def main():
|
|
|
382
382
|
exit()
|
|
383
383
|
|
|
384
384
|
print("Publishing process revision '1'...")
|
|
385
|
-
publish_process_result = manager.publish_process_revision(
|
|
385
|
+
publish_process_result = manager.publish_process_revision(process_id=created_entities["process_id"], revision="1")
|
|
386
386
|
if isinstance(publish_process_result, AgenticProcess):
|
|
387
387
|
print(f"Success: Published Process Revision: {publish_process_result.name}")
|
|
388
388
|
else:
|
|
@@ -391,7 +391,7 @@ def main():
|
|
|
391
391
|
exit()
|
|
392
392
|
|
|
393
393
|
print("Retrieving latest process version...")
|
|
394
|
-
latest_process = manager.get_process(
|
|
394
|
+
latest_process = manager.get_process(process_id=created_entities["process_id"])
|
|
395
395
|
if isinstance(latest_process, AgenticProcess):
|
|
396
396
|
print(f"Success: Latest Process: {latest_process.name}, Description: {latest_process.description}")
|
|
397
397
|
else:
|
|
@@ -417,7 +417,7 @@ def main():
|
|
|
417
417
|
exit()
|
|
418
418
|
|
|
419
419
|
print("Retrieving instance information...")
|
|
420
|
-
instance_info = manager.get_instance(
|
|
420
|
+
instance_info = manager.get_instance(instance_id=created_entities["instance_id"])
|
|
421
421
|
if isinstance(instance_info, ProcessInstance):
|
|
422
422
|
print(f"Success: Instance Info: Process: {instance_info.process.name}, Subject: {instance_info.subject}")
|
|
423
423
|
else:
|
|
@@ -426,7 +426,7 @@ def main():
|
|
|
426
426
|
exit()
|
|
427
427
|
|
|
428
428
|
print("Retrieving instance history...")
|
|
429
|
-
history = manager.get_instance_history(
|
|
429
|
+
history = manager.get_instance_history(instance_id=created_entities["instance_id"])
|
|
430
430
|
if isinstance(history, dict):
|
|
431
431
|
print(f"Success: Instance History: {history}")
|
|
432
432
|
else:
|
|
@@ -31,7 +31,7 @@ def rollback():
|
|
|
31
31
|
print("\n=== Initiating Rollback ===")
|
|
32
32
|
if created_entities["agent_id"]:
|
|
33
33
|
print(f"Deleting agent {created_entities['agent_id']}...")
|
|
34
|
-
result = lab_manager.delete_agent(
|
|
34
|
+
result = lab_manager.delete_agent(agent_id=created_entities["agent_id"])
|
|
35
35
|
print(f"Rollback: {result}")
|
|
36
36
|
if created_entities["file_id"]:
|
|
37
37
|
print(f"Deleting file {created_entities['file_id']}...")
|
|
@@ -107,7 +107,7 @@ def main():
|
|
|
107
107
|
revision=1,
|
|
108
108
|
status="pending"
|
|
109
109
|
)
|
|
110
|
-
create_agent_result = lab_manager.create_agent(
|
|
110
|
+
create_agent_result = lab_manager.create_agent(agent=agent, automatic_publish=False)
|
|
111
111
|
if isinstance(create_agent_result, Agent):
|
|
112
112
|
print(f"Success: Created Agent: {create_agent_result.name}, ID: {create_agent_result.id}")
|
|
113
113
|
created_entities["agent_id"] = create_agent_result.id
|
|
@@ -117,7 +117,7 @@ def main():
|
|
|
117
117
|
exit()
|
|
118
118
|
|
|
119
119
|
print("Publishing agent revision '1'...")
|
|
120
|
-
publish_agent_result = lab_manager.publish_agent_revision(
|
|
120
|
+
publish_agent_result = lab_manager.publish_agent_revision(agent_id=created_entities["agent_id"], revision="1")
|
|
121
121
|
if isinstance(publish_agent_result, Agent):
|
|
122
122
|
print(f"Success: Published Agent Revision: {publish_agent_result.name}")
|
|
123
123
|
else:
|
|
@@ -27,7 +27,7 @@ def rollback():
|
|
|
27
27
|
print("\n=== Initiating Rollback ===")
|
|
28
28
|
if created_entities["agent_id"]:
|
|
29
29
|
print(f"Deleting agent {created_entities['agent_id']}...")
|
|
30
|
-
result = lab_manager.delete_agent(
|
|
30
|
+
result = lab_manager.delete_agent(agent_id=created_entities["agent_id"])
|
|
31
31
|
print(f"Rollback: {result}")
|
|
32
32
|
if created_entities["file_id"]:
|
|
33
33
|
print(f"Deleting file {created_entities['file_id']}...")
|
|
@@ -102,7 +102,7 @@ def main():
|
|
|
102
102
|
revision=1,
|
|
103
103
|
status="pending"
|
|
104
104
|
)
|
|
105
|
-
create_agent_result = lab_manager.create_agent(
|
|
105
|
+
create_agent_result = lab_manager.create_agent(agent=agent, automatic_publish=False)
|
|
106
106
|
if isinstance(create_agent_result, Agent):
|
|
107
107
|
print(f"Success: Created Agent: {create_agent_result.name}, ID: {create_agent_result.id}")
|
|
108
108
|
created_entities["agent_id"] = create_agent_result.id
|
|
@@ -112,7 +112,7 @@ def main():
|
|
|
112
112
|
exit()
|
|
113
113
|
|
|
114
114
|
print("Publishing agent revision '1'...")
|
|
115
|
-
publish_agent_result = lab_manager.publish_agent_revision(
|
|
115
|
+
publish_agent_result = lab_manager.publish_agent_revision(agent_id=created_entities["agent_id"], revision="1")
|
|
116
116
|
if isinstance(publish_agent_result, Agent):
|
|
117
117
|
print(f"Success: Published Agent Revision: {publish_agent_result.name}")
|
|
118
118
|
else:
|