ibm-watsonx-orchestrate 1.3.0__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.
Files changed (54) hide show
  1. ibm_watsonx_orchestrate/__init__.py +2 -1
  2. ibm_watsonx_orchestrate/agent_builder/agents/types.py +2 -0
  3. ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +10 -2
  4. ibm_watsonx_orchestrate/agent_builder/toolkits/base_toolkit.py +32 -0
  5. ibm_watsonx_orchestrate/agent_builder/toolkits/types.py +42 -0
  6. ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +10 -1
  7. ibm_watsonx_orchestrate/agent_builder/tools/python_tool.py +4 -2
  8. ibm_watsonx_orchestrate/agent_builder/tools/types.py +2 -1
  9. ibm_watsonx_orchestrate/cli/commands/agents/agents_command.py +29 -0
  10. ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +271 -12
  11. ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_controller.py +17 -2
  12. ibm_watsonx_orchestrate/cli/commands/models/env_file_model_provider_mapper.py +180 -0
  13. ibm_watsonx_orchestrate/cli/commands/models/models_command.py +199 -8
  14. ibm_watsonx_orchestrate/cli/commands/server/server_command.py +117 -48
  15. ibm_watsonx_orchestrate/cli/commands/server/types.py +105 -0
  16. ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_command.py +55 -7
  17. ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_controller.py +123 -42
  18. ibm_watsonx_orchestrate/cli/commands/tools/tools_command.py +22 -1
  19. ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +197 -12
  20. ibm_watsonx_orchestrate/client/agents/agent_client.py +4 -1
  21. ibm_watsonx_orchestrate/client/agents/assistant_agent_client.py +5 -1
  22. ibm_watsonx_orchestrate/client/agents/external_agent_client.py +5 -1
  23. ibm_watsonx_orchestrate/client/analytics/llm/analytics_llm_client.py +2 -6
  24. ibm_watsonx_orchestrate/client/base_api_client.py +5 -2
  25. ibm_watsonx_orchestrate/client/connections/connections_client.py +3 -9
  26. ibm_watsonx_orchestrate/client/model_policies/__init__.py +0 -0
  27. ibm_watsonx_orchestrate/client/model_policies/model_policies_client.py +47 -0
  28. ibm_watsonx_orchestrate/client/model_policies/types.py +36 -0
  29. ibm_watsonx_orchestrate/client/models/__init__.py +0 -0
  30. ibm_watsonx_orchestrate/client/models/models_client.py +46 -0
  31. ibm_watsonx_orchestrate/client/models/types.py +189 -0
  32. ibm_watsonx_orchestrate/client/toolkit/toolkit_client.py +20 -6
  33. ibm_watsonx_orchestrate/client/tools/tempus_client.py +40 -0
  34. ibm_watsonx_orchestrate/client/tools/tool_client.py +8 -0
  35. ibm_watsonx_orchestrate/docker/compose-lite.yml +68 -13
  36. ibm_watsonx_orchestrate/docker/default.env +22 -12
  37. ibm_watsonx_orchestrate/docker/tempus/common-config.yaml +1 -1
  38. ibm_watsonx_orchestrate/experimental/flow_builder/__init__.py +0 -0
  39. ibm_watsonx_orchestrate/experimental/flow_builder/data_map.py +19 -0
  40. ibm_watsonx_orchestrate/experimental/flow_builder/flows/__init__.py +42 -0
  41. ibm_watsonx_orchestrate/experimental/flow_builder/flows/constants.py +19 -0
  42. ibm_watsonx_orchestrate/experimental/flow_builder/flows/decorators.py +144 -0
  43. ibm_watsonx_orchestrate/experimental/flow_builder/flows/events.py +72 -0
  44. ibm_watsonx_orchestrate/experimental/flow_builder/flows/flow.py +1310 -0
  45. ibm_watsonx_orchestrate/experimental/flow_builder/node.py +116 -0
  46. ibm_watsonx_orchestrate/experimental/flow_builder/resources/flow_status.openapi.yml +66 -0
  47. ibm_watsonx_orchestrate/experimental/flow_builder/types.py +765 -0
  48. ibm_watsonx_orchestrate/experimental/flow_builder/utils.py +115 -0
  49. ibm_watsonx_orchestrate/utils/utils.py +5 -2
  50. {ibm_watsonx_orchestrate-1.3.0.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/METADATA +4 -1
  51. {ibm_watsonx_orchestrate-1.3.0.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/RECORD +54 -32
  52. {ibm_watsonx_orchestrate-1.3.0.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/WHEEL +0 -0
  53. {ibm_watsonx_orchestrate-1.3.0.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/entry_points.txt +0 -0
  54. {ibm_watsonx_orchestrate-1.3.0.dist-info → ibm_watsonx_orchestrate-1.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,116 @@
1
+ import json
2
+ from typing import Any, cast
3
+ import uuid
4
+
5
+ import yaml
6
+ from pydantic import BaseModel, Field, SerializeAsAny
7
+
8
+ from .types import EndNodeSpec, NodeSpec, AgentNodeSpec, PromptNodeSpec, StartNodeSpec, ToolNodeSpec, UserFieldKind, UserFieldOption, UserNodeSpec
9
+ from .data_map import DataMap
10
+
11
+ class Node(BaseModel):
12
+ spec: SerializeAsAny[NodeSpec]
13
+ input_map: DataMap | None = None
14
+
15
+ def __call__(self, **kwargs):
16
+ pass
17
+
18
+ def dump_spec(self, file: str) -> None:
19
+ dumped = self.spec.model_dump(mode='json',
20
+ exclude_unset=True, exclude_none=True, by_alias=True)
21
+ with open(file, 'w', encoding="utf-8") as f:
22
+ if file.endswith('.yaml') or file.endswith('.yml'):
23
+ yaml.dump(dumped, f)
24
+ elif file.endswith('.json'):
25
+ json.dump(dumped, f, indent=2)
26
+ else:
27
+ raise ValueError('file must end in .json, .yaml, or .yml')
28
+
29
+ def dumps_spec(self) -> str:
30
+ dumped = self.spec.model_dump(mode='json',
31
+ exclude_unset=True, exclude_none=True, by_alias=True)
32
+ return json.dumps(dumped, indent=2)
33
+
34
+ def __repr__(self):
35
+ return f"Node(name='{self.spec.name}', description='{self.spec.description}')"
36
+
37
+ def to_json(self) -> dict[str, Any]:
38
+ model_spec = {}
39
+ model_spec["spec"] = self.spec.to_json()
40
+ if self.input_map is not None:
41
+ model_spec['input_map'] = self.input_map.to_json()
42
+
43
+ return model_spec
44
+
45
+ class StartNode(Node):
46
+ def __repr__(self):
47
+ return f"StartNode(name='{self.spec.name}', description='{self.spec.description}')"
48
+
49
+ def get_spec(self) -> StartNodeSpec:
50
+ return cast(StartNodeSpec, self.spec)
51
+
52
+ class EndNode(Node):
53
+ def __repr__(self):
54
+ return f"EndNode(name='{self.spec.name}', description='{self.spec.description}')"
55
+
56
+ def get_spec(self) -> EndNodeSpec:
57
+ return cast(EndNodeSpec, self.spec)
58
+
59
+ class ToolNode(Node):
60
+ def __repr__(self):
61
+ return f"ToolNode(name='{self.spec.name}', description='{self.spec.description}')"
62
+
63
+ def get_spec(self) -> ToolNodeSpec:
64
+ return cast(ToolNodeSpec, self.spec)
65
+
66
+ class UserNode(Node):
67
+ def __repr__(self):
68
+ return f"UserNode(name='{self.spec.name}', description='{self.spec.description}')"
69
+
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)
94
+
95
+ class AgentNode(Node):
96
+ def __repr__(self):
97
+ return f"AgentNode(name='{self.spec.name}', description='{self.spec.description}')"
98
+
99
+ def get_spec(self) -> AgentNodeSpec:
100
+ return cast(AgentNodeSpec, self.spec)
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
+
109
+ class NodeInstance(BaseModel):
110
+ node: Node
111
+ id: str # unique id of this task instance
112
+ flow: Any # the flow this task belongs to
113
+
114
+ def __init__(self, **kwargs): # type: ignore
115
+ super().__init__(**kwargs)
116
+ self.id = uuid.uuid4().hex
@@ -0,0 +1,66 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Flow status
4
+ version: '0.1'
5
+ description: This tool allows you to check the status of a flow.
6
+ servers:
7
+ - url: http://wxo-tempus-runtime:9044
8
+ components:
9
+ schemas:
10
+ APIError:
11
+ type: object
12
+ properties:
13
+ data:
14
+ type: object
15
+ properties:
16
+ message:
17
+ type: string
18
+ additionalProperties: true
19
+ required:
20
+ - message
21
+ required:
22
+ - data
23
+ paths:
24
+ /v1/flows:
25
+ get:
26
+ description: Get the status of a flow instance.
27
+ operationId: get_flow_status
28
+ responses:
29
+ '200':
30
+ description: Return the status of a flow instance.
31
+ content:
32
+ application/json:
33
+ schema:
34
+ type: array
35
+ items:
36
+ type: object
37
+ '400':
38
+ description: Bad input
39
+ content:
40
+ application/json:
41
+ schema:
42
+ $ref: '#/components/schemas/APIError'
43
+ '500':
44
+ description: Internal server error
45
+ content:
46
+ application/json:
47
+ schema:
48
+ $ref: '#/components/schemas/APIError'
49
+ parameters:
50
+ - in: query
51
+ name: instance_id
52
+ description: Identifies the instance of the flow. This was provided when the flow tool was run.
53
+ required: false
54
+ schema:
55
+ type: string
56
+ - in: query
57
+ name: state
58
+ required: false
59
+ schema:
60
+ type: string
61
+ enum:
62
+ - completed
63
+ - in_progress
64
+ - interrupted
65
+ - failed
66
+