ibm-watsonx-orchestrate 1.4.2__py3-none-any.whl → 1.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.
- ibm_watsonx_orchestrate/__init__.py +2 -1
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +1 -0
- ibm_watsonx_orchestrate/cli/commands/models/models_command.py +7 -2
- ibm_watsonx_orchestrate/client/models/types.py +13 -1
- ibm_watsonx_orchestrate/client/toolkit/toolkit_client.py +13 -8
- ibm_watsonx_orchestrate/docker/default.env +9 -9
- ibm_watsonx_orchestrate/experimental/flow_builder/data_map.py +19 -0
- ibm_watsonx_orchestrate/experimental/flow_builder/flows/__init__.py +4 -3
- ibm_watsonx_orchestrate/experimental/flow_builder/flows/constants.py +3 -1
- ibm_watsonx_orchestrate/experimental/flow_builder/flows/decorators.py +3 -2
- ibm_watsonx_orchestrate/experimental/flow_builder/flows/flow.py +245 -223
- ibm_watsonx_orchestrate/experimental/flow_builder/node.py +34 -15
- ibm_watsonx_orchestrate/experimental/flow_builder/resources/flow_status.openapi.yml +7 -39
- ibm_watsonx_orchestrate/experimental/flow_builder/types.py +285 -12
- ibm_watsonx_orchestrate/experimental/flow_builder/utils.py +3 -1
- {ibm_watsonx_orchestrate-1.4.2.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/METADATA +1 -1
- {ibm_watsonx_orchestrate-1.4.2.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/RECORD +20 -20
- ibm_watsonx_orchestrate/experimental/flow_builder/flows/data_map.py +0 -91
- {ibm_watsonx_orchestrate-1.4.2.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/WHEEL +0 -0
- {ibm_watsonx_orchestrate-1.4.2.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/entry_points.txt +0 -0
- {ibm_watsonx_orchestrate-1.4.2.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -3,13 +3,10 @@ from typing import Any, cast
|
|
3
3
|
import uuid
|
4
4
|
|
5
5
|
import yaml
|
6
|
-
from pydantic import BaseModel, SerializeAsAny
|
6
|
+
from pydantic import BaseModel, Field, SerializeAsAny
|
7
7
|
|
8
|
-
from
|
9
|
-
from .
|
10
|
-
|
11
|
-
from .types import EndNodeSpec, JsonSchemaObjectRef, NodeSpec, AgentNodeSpec, StartNodeSpec, ToolNodeSpec
|
12
|
-
from .flows.data_map import DataMap
|
8
|
+
from .types import EndNodeSpec, NodeSpec, AgentNodeSpec, PromptNodeSpec, StartNodeSpec, ToolNodeSpec, UserFieldKind, UserFieldOption, UserNodeSpec
|
9
|
+
from .data_map import DataMap
|
13
10
|
|
14
11
|
class Node(BaseModel):
|
15
12
|
spec: SerializeAsAny[NodeSpec]
|
@@ -42,8 +39,6 @@ class Node(BaseModel):
|
|
42
39
|
model_spec["spec"] = self.spec.to_json()
|
43
40
|
if self.input_map is not None:
|
44
41
|
model_spec['input_map'] = self.input_map.to_json()
|
45
|
-
if hasattr(self, "output_map") and self.output_map is not None:
|
46
|
-
model_spec["output_map"] = self.output_map.to_json()
|
47
42
|
|
48
43
|
return model_spec
|
49
44
|
|
@@ -52,7 +47,6 @@ class StartNode(Node):
|
|
52
47
|
return f"StartNode(name='{self.spec.name}', description='{self.spec.description}')"
|
53
48
|
|
54
49
|
def get_spec(self) -> StartNodeSpec:
|
55
|
-
|
56
50
|
return cast(StartNodeSpec, self.spec)
|
57
51
|
|
58
52
|
class EndNode(Node):
|
@@ -60,7 +54,6 @@ class EndNode(Node):
|
|
60
54
|
return f"EndNode(name='{self.spec.name}', description='{self.spec.description}')"
|
61
55
|
|
62
56
|
def get_spec(self) -> EndNodeSpec:
|
63
|
-
|
64
57
|
return cast(EndNodeSpec, self.spec)
|
65
58
|
|
66
59
|
class ToolNode(Node):
|
@@ -68,25 +61,51 @@ class ToolNode(Node):
|
|
68
61
|
return f"ToolNode(name='{self.spec.name}', description='{self.spec.description}')"
|
69
62
|
|
70
63
|
def get_spec(self) -> ToolNodeSpec:
|
71
|
-
|
72
64
|
return cast(ToolNodeSpec, self.spec)
|
73
65
|
|
74
66
|
class UserNode(Node):
|
75
67
|
def __repr__(self):
|
76
68
|
return f"UserNode(name='{self.spec.name}', description='{self.spec.description}')"
|
77
69
|
|
78
|
-
def get_spec(self) ->
|
79
|
-
|
80
|
-
|
70
|
+
def get_spec(self) -> UserNodeSpec:
|
71
|
+
return cast(UserNodeSpec, self.spec)
|
72
|
+
|
73
|
+
def field(self,
|
74
|
+
name: str,
|
75
|
+
kind: UserFieldKind = UserFieldKind.Text,
|
76
|
+
text: str | None = None,
|
77
|
+
display_name: str | None = None,
|
78
|
+
description: str | None = None,
|
79
|
+
default: Any | None = None,
|
80
|
+
option: UserFieldOption | None = None,
|
81
|
+
is_list: bool = False,
|
82
|
+
custom: dict[str, Any] | None = None,
|
83
|
+
widget: str | None = None):
|
84
|
+
self.get_spec().field(name=name,
|
85
|
+
kind=kind,
|
86
|
+
text=text,
|
87
|
+
display_name=display_name,
|
88
|
+
description=description,
|
89
|
+
default=default,
|
90
|
+
option=option,
|
91
|
+
is_list=is_list,
|
92
|
+
custom=custom,
|
93
|
+
widget=widget)
|
81
94
|
|
82
95
|
class AgentNode(Node):
|
83
96
|
def __repr__(self):
|
84
97
|
return f"AgentNode(name='{self.spec.name}', description='{self.spec.description}')"
|
85
98
|
|
86
99
|
def get_spec(self) -> AgentNodeSpec:
|
87
|
-
|
88
100
|
return cast(AgentNodeSpec, self.spec)
|
89
101
|
|
102
|
+
class PromptNode(Node):
|
103
|
+
def __repr__(self):
|
104
|
+
return f"PromptNode(name='{self.spec.name}', description='{self.spec.description}')"
|
105
|
+
|
106
|
+
def get_spec(self) -> PromptNodeSpec:
|
107
|
+
return cast(PromptNodeSpec, self.spec)
|
108
|
+
|
90
109
|
class NodeInstance(BaseModel):
|
91
110
|
node: Node
|
92
111
|
id: str # unique id of this task instance
|
@@ -1,18 +1,11 @@
|
|
1
1
|
openapi: 3.0.3
|
2
2
|
info:
|
3
|
-
title:
|
3
|
+
title: Flow status
|
4
4
|
version: '0.1'
|
5
|
-
description:
|
6
|
-
security:
|
7
|
-
- IBM-WO-JWT: []
|
5
|
+
description: This tool allows you to check the status of a flow.
|
8
6
|
servers:
|
9
7
|
- url: http://wxo-tempus-runtime:9044
|
10
8
|
components:
|
11
|
-
securitySchemes:
|
12
|
-
IBM-WO-JWT:
|
13
|
-
type: http
|
14
|
-
scheme: bearer
|
15
|
-
bearerFormat: IBM-Watsonx-Orchestrate-JWT
|
16
9
|
schemas:
|
17
10
|
APIError:
|
18
11
|
type: object
|
@@ -30,15 +23,11 @@ components:
|
|
30
23
|
paths:
|
31
24
|
/v1/flows:
|
32
25
|
get:
|
33
|
-
description: Get
|
34
|
-
tags:
|
35
|
-
- Flow
|
26
|
+
description: Get the status of a flow instance.
|
36
27
|
operationId: get_flow_status
|
37
|
-
security:
|
38
|
-
- IBM-WO-JWT: []
|
39
28
|
responses:
|
40
29
|
'200':
|
41
|
-
description: Return the
|
30
|
+
description: Return the status of a flow instance.
|
42
31
|
content:
|
43
32
|
application/json:
|
44
33
|
schema:
|
@@ -59,12 +48,8 @@ paths:
|
|
59
48
|
$ref: '#/components/schemas/APIError'
|
60
49
|
parameters:
|
61
50
|
- in: query
|
62
|
-
name:
|
63
|
-
|
64
|
-
schema:
|
65
|
-
type: string
|
66
|
-
- in: query
|
67
|
-
name: version
|
51
|
+
name: instance_id
|
52
|
+
description: Identifies the instance of the flow. This was provided when the flow tool was run.
|
68
53
|
required: false
|
69
54
|
schema:
|
70
55
|
type: string
|
@@ -78,21 +63,4 @@ paths:
|
|
78
63
|
- in_progress
|
79
64
|
- interrupted
|
80
65
|
- failed
|
81
|
-
|
82
|
-
name: instance_id
|
83
|
-
required: false
|
84
|
-
schema:
|
85
|
-
type: string
|
86
|
-
- in: query
|
87
|
-
name: page
|
88
|
-
required: false
|
89
|
-
schema:
|
90
|
-
type: number
|
91
|
-
default: 1
|
92
|
-
- in: query
|
93
|
-
name: page_size
|
94
|
-
required: false
|
95
|
-
schema:
|
96
|
-
type: number
|
97
|
-
default: 20
|
98
|
-
tags: []
|
66
|
+
|
@@ -3,7 +3,7 @@ from enum import Enum
|
|
3
3
|
import inspect
|
4
4
|
import logging
|
5
5
|
from typing import (
|
6
|
-
Any, Callable, cast, Literal, List, NamedTuple, Optional, Sequence, Union
|
6
|
+
Any, Callable, Self, cast, Literal, List, NamedTuple, Optional, Sequence, Union
|
7
7
|
)
|
8
8
|
|
9
9
|
import docstring_parser
|
@@ -36,7 +36,7 @@ def _assign_attribute(obj, attr_name, schema):
|
|
36
36
|
def _to_json_from_json_schema(schema: JsonSchemaObject) -> dict[str, Any]:
|
37
37
|
model_spec = {}
|
38
38
|
if isinstance(schema, dict):
|
39
|
-
schema =
|
39
|
+
schema = JsonSchemaObject.model_validate(schema)
|
40
40
|
_assign_attribute(model_spec, "type", schema)
|
41
41
|
_assign_attribute(model_spec, "title", schema)
|
42
42
|
_assign_attribute(model_spec, "description", schema)
|
@@ -64,6 +64,11 @@ def _to_json_from_json_schema(schema: JsonSchemaObject) -> dict[str, Any]:
|
|
64
64
|
_assign_attribute(model_spec, "in_field", schema)
|
65
65
|
_assign_attribute(model_spec, "aliasName", schema)
|
66
66
|
|
67
|
+
if hasattr(schema, 'model_extra') and schema.model_extra:
|
68
|
+
# for each extra fiels, add it to the model spec
|
69
|
+
for key, value in schema.model_extra.items():
|
70
|
+
model_spec[key] = value
|
71
|
+
|
67
72
|
if isinstance(schema, JsonSchemaObjectRef):
|
68
73
|
model_spec["$ref"] = schema.ref
|
69
74
|
return model_spec
|
@@ -109,8 +114,7 @@ def _to_json_from_output_schema(schema: Union[ToolResponseBody, SchemaRef]) -> d
|
|
109
114
|
return model_spec
|
110
115
|
|
111
116
|
class NodeSpec(BaseModel):
|
112
|
-
|
113
|
-
kind: Literal["node", "tool", "user", "script", "agent", "flow", "start", "decisions", "prompt", "branch", "wait", "foreach", "loop", "end"] = "node"
|
117
|
+
kind: Literal["node", "tool", "user", "agent", "flow", "start", "decisions", "prompt", "branch", "wait", "foreach", "loop", "userflow", "end"] = "node"
|
114
118
|
name: str
|
115
119
|
display_name: str | None = None
|
116
120
|
description: str | None = None
|
@@ -167,7 +171,6 @@ class EndNodeSpec(NodeSpec):
|
|
167
171
|
self.kind = "end"
|
168
172
|
|
169
173
|
class ToolNodeSpec(NodeSpec):
|
170
|
-
|
171
174
|
tool: Union[str, ToolSpec] = Field(default = None, description="the tool to use")
|
172
175
|
|
173
176
|
def __init__(self, **data):
|
@@ -182,23 +185,233 @@ class ToolNodeSpec(NodeSpec):
|
|
182
185
|
else:
|
183
186
|
model_spec["tool"] = self.tool
|
184
187
|
return model_spec
|
188
|
+
|
189
|
+
|
190
|
+
class UserFieldValue(BaseModel):
|
191
|
+
text: str | None = None
|
192
|
+
value: str | None = None
|
193
|
+
|
194
|
+
def __init__(self, text: str | None = None, value: str | None = None):
|
195
|
+
super().__init__(text=text, value=value)
|
196
|
+
if self.value is None:
|
197
|
+
self.value = self.text
|
198
|
+
|
199
|
+
def to_json(self) -> dict[str, Any]:
|
200
|
+
model_spec = {}
|
201
|
+
if self.text:
|
202
|
+
model_spec["text"] = self.text
|
203
|
+
if self.value:
|
204
|
+
model_spec["value"] = self.value
|
205
|
+
|
206
|
+
return model_spec
|
207
|
+
|
208
|
+
class UserFieldOption(BaseModel):
|
209
|
+
label: str
|
210
|
+
values: list[UserFieldValue] | None = None
|
211
|
+
|
212
|
+
# create a constructor that will take a list and create UserFieldValue
|
213
|
+
def __init__(self, label: str, values=list[str]):
|
214
|
+
super().__init__(label=label)
|
215
|
+
self.values = []
|
216
|
+
for value in values:
|
217
|
+
item = UserFieldValue(text=value)
|
218
|
+
self.values.append(item)
|
219
|
+
|
220
|
+
def to_json(self) -> dict[str, Any]:
|
221
|
+
model_spec = {}
|
222
|
+
model_spec["label"] = self.label
|
223
|
+
if self.values and len(self.values) > 0:
|
224
|
+
model_spec["values"] = [value.to_json() for value in self.values]
|
225
|
+
return model_spec
|
226
|
+
|
227
|
+
class UserFieldKind(str, Enum):
|
228
|
+
Text: str = "text"
|
229
|
+
Date: str = "date"
|
230
|
+
DateTime: str = "datetime"
|
231
|
+
Time: str = "time"
|
232
|
+
Number: str = "number"
|
233
|
+
Document: str = "document"
|
234
|
+
Boolean: str = "boolean"
|
235
|
+
Object: str = "object"
|
236
|
+
|
237
|
+
def convert_python_type_to_kind(python_type: type) -> "UserFieldKind":
|
238
|
+
if inspect.isclass(python_type):
|
239
|
+
raise ValueError("Cannot convert class to kind")
|
240
|
+
|
241
|
+
if python_type == str:
|
242
|
+
return UserFieldKind.Text
|
243
|
+
elif python_type == int:
|
244
|
+
return UserFieldKind.Number
|
245
|
+
elif python_type == float:
|
246
|
+
return UserFieldKind.Number
|
247
|
+
elif python_type == bool:
|
248
|
+
return UserFieldKind.Boolean
|
249
|
+
elif python_type == list:
|
250
|
+
raise ValueError("Cannot convert list to kind")
|
251
|
+
elif python_type == dict:
|
252
|
+
raise ValueError("Cannot convert dict to kind")
|
253
|
+
|
254
|
+
return UserFieldKind.Text
|
185
255
|
|
256
|
+
def convert_kind_to_schema_property(kind: "UserFieldKind", name: str, description: str,
|
257
|
+
default: Any, option: UserFieldOption,
|
258
|
+
custom: dict[str, Any]) -> dict[str, Any]:
|
259
|
+
model_spec = {}
|
260
|
+
model_spec["title"] = name
|
261
|
+
model_spec["description"] = description
|
262
|
+
model_spec["default"] = default
|
263
|
+
|
264
|
+
model_spec["type"] = "string"
|
265
|
+
if kind == UserFieldKind.Date:
|
266
|
+
model_spec["format"] = "date"
|
267
|
+
elif kind == UserFieldKind.Time:
|
268
|
+
model_spec["format"] = "time"
|
269
|
+
elif kind == UserFieldKind.DateTime:
|
270
|
+
model_spec["format"] = "datetime"
|
271
|
+
elif kind == UserFieldKind.Number:
|
272
|
+
model_spec["format"] = "number"
|
273
|
+
elif kind == UserFieldKind.Boolean:
|
274
|
+
model_spec["type"] = "boolean"
|
275
|
+
elif kind == UserFieldKind.Document:
|
276
|
+
model_spec["format"] = "uri"
|
277
|
+
elif kind == UserFieldKind.Object:
|
278
|
+
raise ValueError("Object user fields are not supported.")
|
279
|
+
|
280
|
+
if option:
|
281
|
+
model_spec["enum"] = [value.text for value in option.values]
|
282
|
+
|
283
|
+
if custom:
|
284
|
+
for key, value in custom.items():
|
285
|
+
model_spec[key] = value
|
286
|
+
return model_spec
|
287
|
+
|
288
|
+
|
289
|
+
class UserField(BaseModel):
|
290
|
+
name: str
|
291
|
+
kind: UserFieldKind = UserFieldKind.Text
|
292
|
+
text: str | None = Field(default=None, description="A descriptive text that can be used to ask user about this field.")
|
293
|
+
display_name: str | None = None
|
294
|
+
description: str | None = None
|
295
|
+
default: Any | None = None
|
296
|
+
option: UserFieldOption | None = None
|
297
|
+
is_list: bool = False
|
298
|
+
custom: dict[str, Any] | None = None
|
299
|
+
widget: str | None = None
|
300
|
+
|
301
|
+
def to_json(self) -> dict[str, Any]:
|
302
|
+
model_spec = {}
|
303
|
+
if self.name:
|
304
|
+
model_spec["name"] = self.name
|
305
|
+
if self.kind:
|
306
|
+
model_spec["kind"] = self.kind.value
|
307
|
+
if self.text:
|
308
|
+
model_spec["text"] = self.text
|
309
|
+
if self.display_name:
|
310
|
+
model_spec["display_name"] = self.display_name
|
311
|
+
if self.description:
|
312
|
+
model_spec["description"] = self.description
|
313
|
+
if self.default:
|
314
|
+
model_spec["default"] = self.default
|
315
|
+
if self.is_list:
|
316
|
+
model_spec["is_list"] = self.is_list
|
317
|
+
if self.option:
|
318
|
+
model_spec["option"] = self.option.to_json()
|
319
|
+
if self.custom:
|
320
|
+
model_spec["custom"] = self.custom
|
321
|
+
if self.widget:
|
322
|
+
model_spec["widget"] = self.widget
|
323
|
+
return model_spec
|
324
|
+
|
186
325
|
class UserNodeSpec(NodeSpec):
|
187
|
-
|
188
|
-
|
326
|
+
owners: Sequence[str] | None = None
|
327
|
+
text: str | None = None
|
328
|
+
fields: list[UserField] | None = None
|
189
329
|
|
190
330
|
def __init__(self, **data):
|
191
331
|
super().__init__(**data)
|
332
|
+
self.fields = []
|
192
333
|
self.kind = "user"
|
193
334
|
|
194
335
|
def to_json(self) -> dict[str, Any]:
|
195
336
|
model_spec = super().to_json()
|
337
|
+
# remove input schema
|
338
|
+
# if "input_schema" in model_spec:
|
339
|
+
# raise ValueError("Input schema is not allowed for user node.")
|
340
|
+
# del model_spec["input_schema"]
|
341
|
+
|
196
342
|
if self.owners:
|
197
343
|
model_spec["owners"] = self.owners
|
344
|
+
if self.text:
|
345
|
+
model_spec["text"] = self.text
|
346
|
+
if self.fields and len(self.fields) > 0:
|
347
|
+
model_spec["fields"] = [field.to_json() for field in self.fields]
|
348
|
+
|
198
349
|
return model_spec
|
199
350
|
|
351
|
+
def field(self, name: str,
|
352
|
+
kind: UserFieldKind,
|
353
|
+
text: str | None = None,
|
354
|
+
display_name: str | None = None,
|
355
|
+
description: str | None = None,
|
356
|
+
default: Any | None = None,
|
357
|
+
option: list[str] | None = None, is_list: bool = False,
|
358
|
+
custom: dict[str, Any] | None = None,
|
359
|
+
widget: str | None = None):
|
360
|
+
userfield = UserField(name=name,
|
361
|
+
kind=kind,
|
362
|
+
text=text,
|
363
|
+
display_name=display_name,
|
364
|
+
description=description,
|
365
|
+
default=default,
|
366
|
+
option=option,
|
367
|
+
is_list=is_list,
|
368
|
+
custom=custom,
|
369
|
+
widget=widget)
|
370
|
+
|
371
|
+
# find the index of the field
|
372
|
+
i = 0
|
373
|
+
for field in self.fields:
|
374
|
+
if field.name == name:
|
375
|
+
break
|
376
|
+
|
377
|
+
if (len(self.fields) - 1) >= i:
|
378
|
+
self.fields[i] = userfield # replace
|
379
|
+
else:
|
380
|
+
self.fields.append(userfield) # append
|
381
|
+
|
382
|
+
def setup_fields(self):
|
383
|
+
# make sure fields are not there already
|
384
|
+
if hasattr(self, "fields") and len(self.fields) > 0:
|
385
|
+
raise ValueError("Fields are already defined.")
|
386
|
+
|
387
|
+
if self.output_schema:
|
388
|
+
if isinstance(self.output_schema, SchemaRef):
|
389
|
+
schema = dereference_refs(schema)
|
390
|
+
schema = self.output_schema
|
391
|
+
|
392
|
+
# get all the fields from JSON schema
|
393
|
+
if self.output_schema and isinstance(self.output_schema, ToolResponseBody):
|
394
|
+
self.fields = []
|
395
|
+
for prop_name, prop_schema in self.output_schema.properties.items():
|
396
|
+
self.fields.append(UserField(name=prop_name,
|
397
|
+
kind=UserFieldKind.convert_python_type_to_kind(prop_schema.type),
|
398
|
+
display_name=prop_schema.title,
|
399
|
+
description=prop_schema.description,
|
400
|
+
default=prop_schema.default,
|
401
|
+
option=self.setup_field_options(prop_schema.title, prop_schema.enum),
|
402
|
+
is_list=prop_schema.type == "array",
|
403
|
+
custom=prop_schema.model_extra))
|
404
|
+
|
405
|
+
def setup_field_options(self, name: str, enums: List[str]) -> UserFieldOption:
|
406
|
+
if enums:
|
407
|
+
option = UserFieldOption(label=name, values=enums)
|
408
|
+
return option
|
409
|
+
else:
|
410
|
+
return None
|
411
|
+
|
412
|
+
|
413
|
+
|
200
414
|
class AgentNodeSpec(ToolNodeSpec):
|
201
|
-
|
202
415
|
message: str | None = Field(default=None, description="The instructions for the task.")
|
203
416
|
guidelines: str | None = Field(default=None, description="The guidelines for the task.")
|
204
417
|
agent: str
|
@@ -217,6 +430,54 @@ class AgentNodeSpec(ToolNodeSpec):
|
|
217
430
|
model_spec["agent"] = self.agent
|
218
431
|
return model_spec
|
219
432
|
|
433
|
+
class PromptLLMParameters(BaseModel):
|
434
|
+
temperature: Optional[float] = None
|
435
|
+
min_new_tokens: Optional[int] = None
|
436
|
+
max_new_tokens: Optional[int] = None
|
437
|
+
top_k: Optional[int] = None
|
438
|
+
top_p: Optional[float] = None
|
439
|
+
stop_sequences: Optional[list[str]] = None
|
440
|
+
|
441
|
+
def to_json(self) -> dict[str, Any]:
|
442
|
+
model_spec = {}
|
443
|
+
if self.temperature:
|
444
|
+
model_spec["temperature"] = self.temperature
|
445
|
+
if self.min_new_tokens:
|
446
|
+
model_spec["min_new_tokens"] = self.min_new_tokens
|
447
|
+
if self.max_new_tokens:
|
448
|
+
model_spec["max_new_tokens"] = self.max_new_tokens
|
449
|
+
if self.top_k:
|
450
|
+
model_spec["top_k"] = self.top_k
|
451
|
+
if self.top_p:
|
452
|
+
model_spec["top_p"] = self.top_p
|
453
|
+
if self.stop_sequences:
|
454
|
+
model_spec["stop_sequences"] = self.stop_sequences
|
455
|
+
return model_spec
|
456
|
+
|
457
|
+
|
458
|
+
class PromptNodeSpec(NodeSpec):
|
459
|
+
system_prompt: str | list[str]
|
460
|
+
user_prompt: str | list[str]
|
461
|
+
llm: Optional[str]
|
462
|
+
llm_parameters: Optional[PromptLLMParameters]
|
463
|
+
|
464
|
+
def __init__(self, **kwargs):
|
465
|
+
super().__init__(**kwargs)
|
466
|
+
self.kind = "prompt"
|
467
|
+
|
468
|
+
def to_json(self) -> dict[str, Any]:
|
469
|
+
model_spec = super().to_json()
|
470
|
+
if self.system_prompt:
|
471
|
+
model_spec["system_prompt"] = self.system_prompt
|
472
|
+
if self.user_prompt:
|
473
|
+
model_spec["user_prompt"] = self.user_prompt
|
474
|
+
if self.llm:
|
475
|
+
model_spec["llm"] = self.llm
|
476
|
+
if self.llm_parameters:
|
477
|
+
model_spec["llm_parameters"] = self.llm_parameters.to_json()
|
478
|
+
|
479
|
+
return model_spec
|
480
|
+
|
220
481
|
class Expression(BaseModel):
|
221
482
|
'''An expression could return a boolean or a value'''
|
222
483
|
expression: str = Field(description="A python expression to be run by the flow engine")
|
@@ -293,7 +554,7 @@ class FlowSpec(NodeSpec):
|
|
293
554
|
|
294
555
|
|
295
556
|
# who can initiate the flow
|
296
|
-
initiators: Sequence[str] = ANY_USER
|
557
|
+
initiators: Sequence[str] = [ANY_USER]
|
297
558
|
|
298
559
|
def __init__(self, **kwargs):
|
299
560
|
super().__init__(**kwargs)
|
@@ -321,6 +582,20 @@ class LoopSpec(FlowSpec):
|
|
321
582
|
|
322
583
|
return model_spec
|
323
584
|
|
585
|
+
class UserFlowSpec(FlowSpec):
|
586
|
+
owners: Sequence[str] = [ANY_USER]
|
587
|
+
|
588
|
+
def __init__(self, **kwargs):
|
589
|
+
super().__init__(**kwargs)
|
590
|
+
self.kind = "userflow"
|
591
|
+
|
592
|
+
def to_json(self) -> dict[str, Any]:
|
593
|
+
model_spec = super().to_json()
|
594
|
+
if self.initiators:
|
595
|
+
model_spec["owners"] = self.initiators
|
596
|
+
|
597
|
+
return model_spec
|
598
|
+
|
324
599
|
class ForeachPolicy(Enum):
|
325
600
|
|
326
601
|
SEQUENTIAL = 1
|
@@ -367,8 +642,6 @@ class FlowContext(BaseModel):
|
|
367
642
|
flow_id: str | None = None # id of the flow, this is at the flow definition level
|
368
643
|
instance_id: str | None = None
|
369
644
|
thread_id: str | None = None
|
370
|
-
instance_id: str | None = None
|
371
|
-
thread_id: str | None = None
|
372
645
|
parent_context: Any | None = None
|
373
646
|
child_context: List["FlowContext"] | None = None
|
374
647
|
metadata: dict = Field(default_factory=dict[str, Any])
|
@@ -452,7 +725,7 @@ def extract_node_spec(
|
|
452
725
|
|
453
726
|
if not return_type or return_type == inspect._empty:
|
454
727
|
pass
|
455
|
-
elif
|
728
|
+
elif inspect.isclass(return_type) and issubclass(return_type, BaseModel):
|
456
729
|
output_schema_json = return_type.model_json_schema()
|
457
730
|
output_schema_obj = JsonSchemaObject(**output_schema_json)
|
458
731
|
output_schema = ToolResponseBody(
|
@@ -48,7 +48,9 @@ def _get_json_schema_obj(parameter_name: str, type_def: type[BaseModel] | None)
|
|
48
48
|
schema_type = 'number'
|
49
49
|
elif type_def == bool:
|
50
50
|
schema_type = 'boolean'
|
51
|
-
|
51
|
+
else:
|
52
|
+
schema_type = 'string'
|
53
|
+
# TODO: inspect the list item type and use that as the item type
|
52
54
|
return JsonSchemaObject(type=schema_type, properties={}, required=[])
|
53
55
|
|
54
56
|
raise ValueError(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
ibm_watsonx_orchestrate/__init__.py,sha256=
|
1
|
+
ibm_watsonx_orchestrate/__init__.py,sha256=HkgVWpfnW0TcCxqwwErauelzqXxc9LTYV_TACkT1qYo,426
|
2
2
|
ibm_watsonx_orchestrate/agent_builder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
ibm_watsonx_orchestrate/agent_builder/agents/__init__.py,sha256=v4G0MGh11eOCkUJP_4AMOcFgzW14oE41G3iFp7G2vvw,376
|
4
4
|
ibm_watsonx_orchestrate/agent_builder/agents/agent.py,sha256=PcBg2dRi-IOzvl24u8fa3B0jLaM5hzgkpTS8k56L9Ag,919
|
@@ -10,7 +10,7 @@ ibm_watsonx_orchestrate/agent_builder/connections/connections.py,sha256=DImRGTXi
|
|
10
10
|
ibm_watsonx_orchestrate/agent_builder/connections/types.py,sha256=znSOdikTv_yIZaVDwoHwOSPu6b9hajj8miCMKOBmi2w,9280
|
11
11
|
ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base.py,sha256=_KuGF0RZpKpwdt31rzjlTjrhGRFz2RtLzleNkhMNX4k,1831
|
12
12
|
ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base_requests.py,sha256=mRow0rf5EHeJCCsTrONeTq10jShs_yIBQjpgDY_mTrI,1641
|
13
|
-
ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py,sha256=
|
13
|
+
ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py,sha256=fPkjWhWEnQcZvZSBYDd_El2kF6LVMBnmQhS1dc8LW6s,7641
|
14
14
|
ibm_watsonx_orchestrate/agent_builder/toolkits/base_toolkit.py,sha256=KXRPgBK-F9Qa6IYqEslkN3ANj3cmZoZQnlSiy_-iXCk,1054
|
15
15
|
ibm_watsonx_orchestrate/agent_builder/toolkits/types.py,sha256=yY-V4Hqct91-Rs4rJ3rY9OhzKkSMdOT63o224o-U9eg,959
|
16
16
|
ibm_watsonx_orchestrate/agent_builder/tools/__init__.py,sha256=adkYX0wgB-RKFCUBw6LPJhNVelUjUdsxipGPk2ghLns,479
|
@@ -42,7 +42,7 @@ ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_command.py,
|
|
42
42
|
ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_controller.py,sha256=vLe1PV_qohLMctKl1Rajzyyhb0JfDC_XV_7vIfs_E8A,9595
|
43
43
|
ibm_watsonx_orchestrate/cli/commands/login/login_command.py,sha256=xArMiojoozg7Exn6HTpbTcjDO2idZRA-y0WV-_Ic1Sk,651
|
44
44
|
ibm_watsonx_orchestrate/cli/commands/models/env_file_model_provider_mapper.py,sha256=Ixz5TC5BbdoFx8zC5TAqHvDQWlmUI4clQxHN3JegIYI,7700
|
45
|
-
ibm_watsonx_orchestrate/cli/commands/models/models_command.py,sha256=
|
45
|
+
ibm_watsonx_orchestrate/cli/commands/models/models_command.py,sha256=M1E6zFd1_0VytKsjuPZ_eqC8QYIMJjSAAKEpU8Dvec0,12315
|
46
46
|
ibm_watsonx_orchestrate/cli/commands/server/server_command.py,sha256=b_AngUTqGTUbOMpzE8ZQhM4J41gK-oIOhmeby3kOg9s,31973
|
47
47
|
ibm_watsonx_orchestrate/cli/commands/server/types.py,sha256=WaaIKB8IzDdxcetkdtHbupXr4u2VDcSRdHPrxh2oQ3E,4169
|
48
48
|
ibm_watsonx_orchestrate/cli/commands/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -80,27 +80,27 @@ ibm_watsonx_orchestrate/client/model_policies/model_policies_client.py,sha256=qQ
|
|
80
80
|
ibm_watsonx_orchestrate/client/model_policies/types.py,sha256=_EpN7IDIxPxO8ZzZmXdBHXUGsg0weusg0ITaSKnfVcE,881
|
81
81
|
ibm_watsonx_orchestrate/client/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
ibm_watsonx_orchestrate/client/models/models_client.py,sha256=vy4dNWULRuRzER2WOqwsFQX1l4hKcTuDpA86TyuDkk8,1251
|
83
|
-
ibm_watsonx_orchestrate/client/models/types.py,sha256=
|
84
|
-
ibm_watsonx_orchestrate/client/toolkit/toolkit_client.py,sha256=
|
83
|
+
ibm_watsonx_orchestrate/client/models/types.py,sha256=66ArfM01whmzpkr37yJnh1ZWpURY8f4OMpuGbPA5VIg,8175
|
84
|
+
ibm_watsonx_orchestrate/client/toolkit/toolkit_client.py,sha256=TLFNS39EeBD_t4Y-rX9sGp4sWBDr--mE5qVtHq8Q2hk,3121
|
85
85
|
ibm_watsonx_orchestrate/client/tools/tempus_client.py,sha256=Q6h-ynbjU1GBYweeNORgqhsP6nvLE2sKjS7sk7VFZP0,1678
|
86
86
|
ibm_watsonx_orchestrate/client/tools/tool_client.py,sha256=lcu6xhWfSVSC4ZuhWMGr__V9PErEMMPRlocRsFu2ZRE,1959
|
87
87
|
ibm_watsonx_orchestrate/docker/compose-lite.yml,sha256=AQxBjE_FbyPpnE0ZcsnyO4C4f_VACwYx6GX7b2XaYGQ,26541
|
88
|
-
ibm_watsonx_orchestrate/docker/default.env,sha256=
|
88
|
+
ibm_watsonx_orchestrate/docker/default.env,sha256=It1j1nzfiyU915yMYz8fne3oAwOBBcBDenPjfPQQkPU,5106
|
89
89
|
ibm_watsonx_orchestrate/docker/start-up.sh,sha256=LTtwHp0AidVgjohis2LXGvZnkFQStOiUAxgGABOyeUI,1811
|
90
90
|
ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0-py3-none-any.whl,sha256=Hi3-owh5OM0Jz2ihX9nLoojnr7Ky1TV-GelyqLcewLE,2047417
|
91
91
|
ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0.tar.gz,sha256=e5T-q7XPAtiCyQljwZp6kk3Q_4Tg6y5sijHTkscmqqQ,2025466
|
92
92
|
ibm_watsonx_orchestrate/docker/tempus/common-config.yaml,sha256=Zo3F36F5DV4VO_vUg1RG-r4WhcukVh79J2fXhGl6j0A,22
|
93
93
|
ibm_watsonx_orchestrate/experimental/flow_builder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/
|
95
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/
|
96
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/
|
97
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/
|
98
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/flows/
|
99
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/flows/
|
100
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/flows/decorators.py,sha256=
|
94
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/data_map.py,sha256=1brmWWFERDsNG2XGais-5-r58LKUUwBtqwdaLQIFRhE,503
|
95
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/node.py,sha256=tp_ssBOSDDi8q-ET2bP7xRPwNOLmLUgQ7v9zZZqn9SU,4090
|
96
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/types.py,sha256=SEl4v2jUJtL8hfE5T6p93B-na9_FI_WJk9AKd_TU2V0,27324
|
97
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/utils.py,sha256=XoKzocDzOuUp4q8JkCG0YHni1MkL-ddO-OviF90A4-4,4425
|
98
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/flows/__init__.py,sha256=MkPxvsXyMCd9jE6Vh70j0YEHQIKmwllPd635vmeTyeU,888
|
99
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/flows/constants.py,sha256=XXYtL5Y1OTjj3jKo2zoJiwb7FCUNu_M43fgU8w591TY,322
|
100
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/flows/decorators.py,sha256=krJHviV7rfPlW2TDveKA0XA9yrnaQeQiNpwcxg7SP4o,5441
|
101
101
|
ibm_watsonx_orchestrate/experimental/flow_builder/flows/events.py,sha256=tfTOiBP1MbaTpe89PKeHuo96amrPKOBqYh8cU9M_YdA,2743
|
102
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/flows/flow.py,sha256=
|
103
|
-
ibm_watsonx_orchestrate/experimental/flow_builder/resources/flow_status.openapi.yml,sha256=
|
102
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/flows/flow.py,sha256=_UDDGVshez3PpJXA2t1ISjnvlrQZKO7i6vBDTUg-IFI,51186
|
103
|
+
ibm_watsonx_orchestrate/experimental/flow_builder/resources/flow_status.openapi.yml,sha256=UkQ4FD_ZhvZuMOjrgLm7cx8zJFZD7Ri-MPCe_zktU-8,1664
|
104
104
|
ibm_watsonx_orchestrate/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
ibm_watsonx_orchestrate/run/connections.py,sha256=o5TjSqxLG8zLk6UGWCcz_UdylMWZOyUT1o3i1XkL5Uc,1844
|
106
106
|
ibm_watsonx_orchestrate/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -108,8 +108,8 @@ ibm_watsonx_orchestrate/utils/utils.py,sha256=U7z_2iASoFiZ2zM0a_2Mc2Y-P5oOT7hOwu
|
|
108
108
|
ibm_watsonx_orchestrate/utils/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
109
109
|
ibm_watsonx_orchestrate/utils/logging/logger.py,sha256=FzeGnidXAjC7yHrvIaj4KZPeaBBSCniZFlwgr5yV3oA,1037
|
110
110
|
ibm_watsonx_orchestrate/utils/logging/logging.yaml,sha256=9_TKfuFr1barnOKP0fZT5D6MhddiwsXVTFjtRbcOO5w,314
|
111
|
-
ibm_watsonx_orchestrate-1.
|
112
|
-
ibm_watsonx_orchestrate-1.
|
113
|
-
ibm_watsonx_orchestrate-1.
|
114
|
-
ibm_watsonx_orchestrate-1.
|
115
|
-
ibm_watsonx_orchestrate-1.
|
111
|
+
ibm_watsonx_orchestrate-1.5.0.dist-info/METADATA,sha256=ytK3t1eJUlxhl6rv8-U602eSrxp-vzvzRJC8CzLE1rg,1370
|
112
|
+
ibm_watsonx_orchestrate-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
113
|
+
ibm_watsonx_orchestrate-1.5.0.dist-info/entry_points.txt,sha256=SfIT02-Jen5e99OcLhzbcM9Bdyf8SGVOCtnSplgZdQI,69
|
114
|
+
ibm_watsonx_orchestrate-1.5.0.dist-info/licenses/LICENSE,sha256=Shgxx7hTdCOkiVRmfGgp_1ISISrwQD7m2f0y8Hsapl4,1083
|
115
|
+
ibm_watsonx_orchestrate-1.5.0.dist-info/RECORD,,
|