ibm-watsonx-orchestrate 1.0.0__tar.gz
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-1.0.0/.gitignore +77 -0
- ibm_watsonx_orchestrate-1.0.0/LICENSE +22 -0
- ibm_watsonx_orchestrate-1.0.0/PKG-INFO +34 -0
- ibm_watsonx_orchestrate-1.0.0/pyproject.toml +104 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/__init__.py +28 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/__init__.py +5 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/agent.py +27 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/assistant_agent.py +28 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/external_agent.py +28 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/types.py +204 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/connections/__init__.py +27 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/connections/connections.py +123 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/connections/types.py +260 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base.py +27 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base_requests.py +59 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +243 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/tools/__init__.py +4 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/tools/base_tool.py +36 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +332 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/tools/python_tool.py +195 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/tools/types.py +162 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/utils/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/utils/pydantic_utils.py +149 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/agents/agents_command.py +192 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +660 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/channels/channels_command.py +15 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/channels/channels_controller.py +16 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/channels/types.py +15 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/channels/webchat/channels_webchat_command.py +32 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/channels/webchat/channels_webchat_controller.py +141 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/chat/chat_command.py +43 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/connections/connections_command.py +307 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +517 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/environment/environment_command.py +78 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/environment/environment_controller.py +189 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/environment/types.py +9 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_command.py +79 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_controller.py +201 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/login/login_command.py +17 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/models/models_command.py +128 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/server/server_command.py +623 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/observability/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/observability/langfuse/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/observability/langfuse/langfuse_command.py +175 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/observability/observability_command.py +11 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/settings/settings_command.py +10 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/tools/tools_command.py +85 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +564 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/commands/tools/types.py +10 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/config.py +226 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/cli/main.py +32 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/agents/agent_client.py +46 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/agents/assistant_agent_client.py +38 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/agents/external_agent_client.py +38 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/analytics/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/analytics/llm/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/analytics/llm/analytics_llm_client.py +50 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/base_api_client.py +113 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/base_service_instance.py +10 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/client.py +71 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/client_errors.py +359 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/connections/__init__.py +10 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/connections/connections_client.py +162 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/connections/utils.py +27 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/credentials.py +123 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/knowledge_bases/knowledge_base_client.py +46 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/local_service_instance.py +91 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/service_instance.py +73 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/tools/tool_client.py +41 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/client/utils.py +95 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/compose-lite.yml +595 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/default.env +125 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0-py3-none-any.whl +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0.tar.gz +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/start-up.sh +61 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/docker/tempus/common-config.yaml +1 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/run/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/run/connections.py +40 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/utils/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/utils/logging/__init__.py +0 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/utils/logging/logger.py +26 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/utils/logging/logging.yaml +18 -0
- ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/utils/utils.py +15 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
# Byte-compiled Python files
|
2
|
+
*.py[cod]
|
3
|
+
__pycache__/
|
4
|
+
|
5
|
+
# C extensions
|
6
|
+
*.so
|
7
|
+
|
8
|
+
# Distribution / packaging
|
9
|
+
.Python
|
10
|
+
build/
|
11
|
+
develop-eggs/
|
12
|
+
dist/
|
13
|
+
downloads/
|
14
|
+
eggs/
|
15
|
+
.eggs/
|
16
|
+
lib/
|
17
|
+
lib64/
|
18
|
+
parts/
|
19
|
+
sdist/
|
20
|
+
var/
|
21
|
+
*.egg-info/
|
22
|
+
.installed.cfg
|
23
|
+
*.egg
|
24
|
+
|
25
|
+
# Virtual environments
|
26
|
+
venv/
|
27
|
+
ENV/
|
28
|
+
env/
|
29
|
+
.venv/
|
30
|
+
.env/
|
31
|
+
|
32
|
+
# Setuptools
|
33
|
+
*.lock
|
34
|
+
*.log
|
35
|
+
pip-log.txt
|
36
|
+
pip-delete-this-directory.txt
|
37
|
+
|
38
|
+
# Unit test / coverage reports
|
39
|
+
htmlcov/
|
40
|
+
.tox/
|
41
|
+
.nox/
|
42
|
+
.coverage
|
43
|
+
*.cover
|
44
|
+
coverage.*
|
45
|
+
.cache
|
46
|
+
.pytest_cache/
|
47
|
+
|
48
|
+
# Jupyter Notebook
|
49
|
+
.ipynb_checkpoints
|
50
|
+
|
51
|
+
# pyenv
|
52
|
+
.python-version
|
53
|
+
|
54
|
+
# Editor / IDE-specific files
|
55
|
+
.vscode/
|
56
|
+
.idea/
|
57
|
+
*.swp
|
58
|
+
*~
|
59
|
+
*.sublime-workspace
|
60
|
+
|
61
|
+
# SDK specific
|
62
|
+
sdk/python/ibm_watsonx_orchestrate/ibm_watsonx_orchestrate/__pycache__/
|
63
|
+
sdk/python/ibm_watsonx_orchestrate/ibm_watsonx_orchestrate/messages/__pycache__/
|
64
|
+
sdk/python/ibm_watsonx_orchestrate/ibm_watsonx_orchestrate/_wrappers/__pycache__/
|
65
|
+
sdk/python/ibm_watsonx_orchestrate/ibm_watsonx_orchestrate/utils/__pycache__/
|
66
|
+
|
67
|
+
# Build scripts
|
68
|
+
.DS_Store
|
69
|
+
*.bak
|
70
|
+
*.tmp
|
71
|
+
|
72
|
+
# Ignore local environment and configuration files
|
73
|
+
.env
|
74
|
+
.env.*
|
75
|
+
.idea/
|
76
|
+
.vscode/
|
77
|
+
coverage/
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2024, 2025 IBM Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: ibm-watsonx-orchestrate
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: IBM watsonx.orchestrate SDK
|
5
|
+
Author-email: IBM <support@ibm.com>
|
6
|
+
License: MIT License
|
7
|
+
License-File: LICENSE
|
8
|
+
Requires-Python: <3.14,>=3.11
|
9
|
+
Requires-Dist: certifi>=2024.8.30
|
10
|
+
Requires-Dist: docstring-parser<1.0,>=0.16
|
11
|
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
12
|
+
Requires-Dist: ibm-cloud-sdk-core>=3.22.0
|
13
|
+
Requires-Dist: jsonref==1.1.0
|
14
|
+
Requires-Dist: jsonschema<5.0.0,>=4.23.0
|
15
|
+
Requires-Dist: langchain-community<1.0.0,>=0.3.12
|
16
|
+
Requires-Dist: numpy>=1.26.0
|
17
|
+
Requires-Dist: packaging>=24.2
|
18
|
+
Requires-Dist: pydantic<3.0.0,>=2.10.3
|
19
|
+
Requires-Dist: pyjwt<3.0.0,>=2.10.1
|
20
|
+
Requires-Dist: python-dotenv>=1.0.0
|
21
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.2
|
22
|
+
Requires-Dist: requests>=2.32.3
|
23
|
+
Requires-Dist: rich<14.0.0,>=13.9.4
|
24
|
+
Requires-Dist: typer<1.0.0,>=0.15.1
|
25
|
+
Requires-Dist: urllib3>=2.2.3
|
26
|
+
Provides-Extra: dev
|
27
|
+
Requires-Dist: black~=22.3.0; extra == 'dev'
|
28
|
+
Requires-Dist: coverage[toml]>=6.5; extra == 'dev'
|
29
|
+
Requires-Dist: pylint~=2.16.4; extra == 'dev'
|
30
|
+
Requires-Dist: pytest-asyncio==0.25.1; extra == 'dev'
|
31
|
+
Requires-Dist: pytest-cov==6.0.0; extra == 'dev'
|
32
|
+
Requires-Dist: pytest-mock==3.14.0; extra == 'dev'
|
33
|
+
Requires-Dist: pytest<9.0.0,>=8.3.4; extra == 'dev'
|
34
|
+
Requires-Dist: snapshottest==1.0.0a1; extra == 'dev'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["hatchling"]
|
3
|
+
build-backend = "hatchling.build"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "ibm-watsonx-orchestrate"
|
7
|
+
dynamic = ["version"]
|
8
|
+
|
9
|
+
description = "IBM watsonx.orchestrate SDK"
|
10
|
+
authors = [
|
11
|
+
{ name = "IBM", email = "support@ibm.com" }
|
12
|
+
]
|
13
|
+
#readme = { file = "README.md", content-type = 'text/markdown'}
|
14
|
+
license = {text = "MIT License"}
|
15
|
+
license-files = ["LICENSE"]
|
16
|
+
requires-python = ">=3.11, <3.14"
|
17
|
+
classifiers = []
|
18
|
+
dependencies = [
|
19
|
+
"certifi>=2024.8.30",
|
20
|
+
"docstring-parser>=0.16,<1.0",
|
21
|
+
"httpx>=0.28.1,<1.0.0",
|
22
|
+
"ibm-cloud-sdk-core>=3.22.0",
|
23
|
+
"jsonref==1.1.0",
|
24
|
+
"jsonschema>=4.23.0,<5.0.0",
|
25
|
+
"langchain-community>=0.3.12,<1.0.0",
|
26
|
+
"numpy>=1.26.0",
|
27
|
+
"packaging>=24.2",
|
28
|
+
"pydantic>=2.10.3,<3.0.0",
|
29
|
+
"pyjwt>=2.10.1,<3.0.0",
|
30
|
+
"python-dotenv>=1.0.0",
|
31
|
+
"pyyaml>=6.0.2,<7.0.0",
|
32
|
+
"requests>=2.32.3",
|
33
|
+
"rich>=13.9.4,<14.0.0",
|
34
|
+
"typer>=0.15.1,<1.0.0",
|
35
|
+
"urllib3>=2.2.3"
|
36
|
+
]
|
37
|
+
|
38
|
+
[project.optional-dependencies]
|
39
|
+
dev = [
|
40
|
+
"pytest>=8.3.4,<9.0.0",
|
41
|
+
"pytest-cov==6.0.0",
|
42
|
+
"snapshottest==1.0.0a1",
|
43
|
+
"pytest-mock==3.14.0",
|
44
|
+
"pytest-asyncio==0.25.1",
|
45
|
+
"coverage[toml]>=6.5",
|
46
|
+
"black~=22.3.0",
|
47
|
+
"pylint~=2.16.4",
|
48
|
+
]
|
49
|
+
|
50
|
+
[tool.hatch.envs.default]
|
51
|
+
dependencies = [
|
52
|
+
"pkg[dev]"
|
53
|
+
]
|
54
|
+
detached = true
|
55
|
+
|
56
|
+
[tool.hatch.version]
|
57
|
+
path = "src/ibm_watsonx_orchestrate/__init__.py"
|
58
|
+
validate-bump=false
|
59
|
+
|
60
|
+
|
61
|
+
[tool.hatch.build.targets.wheel]
|
62
|
+
packages = ["src/ibm_watsonx_orchestrate"]
|
63
|
+
|
64
|
+
[tool.hatch.build]
|
65
|
+
include = [
|
66
|
+
"src/*"
|
67
|
+
]
|
68
|
+
|
69
|
+
[project.scripts]
|
70
|
+
orchestrate = "ibm_watsonx_orchestrate.cli.main:app"
|
71
|
+
|
72
|
+
[tool.hatch.envs.default.scripts]
|
73
|
+
test = "pytest {args:tests}"
|
74
|
+
test-cov = "coverage run -m pytest {args:tests}"
|
75
|
+
cov-report = [
|
76
|
+
"- coverage combine",
|
77
|
+
"coverage report",
|
78
|
+
]
|
79
|
+
cov = [
|
80
|
+
"test-cov",
|
81
|
+
"cov-report",
|
82
|
+
]
|
83
|
+
|
84
|
+
[tool.coverage.run]
|
85
|
+
omit = [
|
86
|
+
"*/__init__.py",
|
87
|
+
"tests/*"
|
88
|
+
]
|
89
|
+
|
90
|
+
[tool.hatch.envs.test]
|
91
|
+
dependencies = [
|
92
|
+
"pkg[dev]"
|
93
|
+
]
|
94
|
+
|
95
|
+
[[tool.hatch.envs.test.matrix]]
|
96
|
+
python = ["3.11", "3.12", "3.13"]
|
97
|
+
|
98
|
+
[tool.coverage.report]
|
99
|
+
show_missing=true
|
100
|
+
exclude_lines = [
|
101
|
+
"no cov",
|
102
|
+
"if __name__ == .__main__.:",
|
103
|
+
"if TYPE_CHECKING:",
|
104
|
+
]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -----------------------------------------------------------------------------------------
|
2
|
+
# (C) Copyright IBM Corp. 2023-2024.
|
3
|
+
# https://opensource.org/licenses/BSD-3-Clause
|
4
|
+
# -----------------------------------------------------------------------------------------
|
5
|
+
|
6
|
+
pkg_name = "ibm-watsonx-orchestrate"
|
7
|
+
|
8
|
+
__version__ = "1.0.0"
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
try:
|
13
|
+
from importlib.metadata import version
|
14
|
+
|
15
|
+
ver = version(pkg_name)
|
16
|
+
|
17
|
+
except (ModuleNotFoundError, AttributeError):
|
18
|
+
from importlib_metadata import version as imp_lib_ver
|
19
|
+
|
20
|
+
ver = imp_lib_ver(pkg_name)
|
21
|
+
|
22
|
+
from ibm_watsonx_orchestrate.client.client import Client
|
23
|
+
from ibm_watsonx_orchestrate.utils.logging.logger import setup_logging
|
24
|
+
|
25
|
+
Client.version = ver
|
26
|
+
__version__ = ver
|
27
|
+
setup_logging()
|
28
|
+
|
File without changes
|
@@ -0,0 +1,5 @@
|
|
1
|
+
from .agent import Agent, AgentSpec
|
2
|
+
from .external_agent import ExternalAgent, ExternalAgentSpec
|
3
|
+
from .assistant_agent import AssistantAgent, AssistantAgentSpec
|
4
|
+
# from .types import AgentKind, AgentStyle, ExternalAgentConfig, AssistantAgentConfig, SpecVersion
|
5
|
+
from .types import AgentKind, AgentStyle, SpecVersion, ExternalAgentAuthScheme, AgentProvider, AssistantAgentConfig
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import json
|
2
|
+
from ibm_watsonx_orchestrate.utils.utils import yaml_safe_load
|
3
|
+
from .types import AgentSpec
|
4
|
+
|
5
|
+
|
6
|
+
class Agent(AgentSpec):
|
7
|
+
|
8
|
+
@staticmethod
|
9
|
+
def from_spec(file: str) -> 'Agent':
|
10
|
+
with open(file, 'r') as f:
|
11
|
+
if file.endswith('.yaml') or file.endswith('.yml'):
|
12
|
+
content = yaml_safe_load(f)
|
13
|
+
elif file.endswith('.json'):
|
14
|
+
content = json.load(f)
|
15
|
+
else:
|
16
|
+
raise ValueError('file must end in .json, .yaml, or .yml')
|
17
|
+
if not content.get("spec_version"):
|
18
|
+
raise ValueError(f"Field 'spec_version' not provided. Please ensure provided spec conforms to a valid spec format")
|
19
|
+
agent = Agent.model_validate(content)
|
20
|
+
|
21
|
+
return agent
|
22
|
+
|
23
|
+
def __repr__(self):
|
24
|
+
return f"Agent(name='{self.name}', description='{self.description}')"
|
25
|
+
|
26
|
+
def __str__(self):
|
27
|
+
return self.__repr__()
|
ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/assistant_agent.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import json
|
2
|
+
from ibm_watsonx_orchestrate.utils.utils import yaml_safe_load
|
3
|
+
from .types import AssistantAgentSpec
|
4
|
+
|
5
|
+
|
6
|
+
class AssistantAgent(AssistantAgentSpec):
|
7
|
+
|
8
|
+
@staticmethod
|
9
|
+
def from_spec(file: str) -> 'AssistantAgent':
|
10
|
+
with open(file, 'r') as f:
|
11
|
+
if file.endswith('.yaml') or file.endswith('.yml'):
|
12
|
+
content = yaml_safe_load(f)
|
13
|
+
elif file.endswith('.json'):
|
14
|
+
content = json.load(f)
|
15
|
+
else:
|
16
|
+
raise ValueError('file must end in .json, .yaml, or .yml')
|
17
|
+
|
18
|
+
if not content.get("spec_version"):
|
19
|
+
raise ValueError(f"Field 'spec_version' not provided. Please ensure provided spec conforms to a valid spec format")
|
20
|
+
agent = AssistantAgent.model_validate(content)
|
21
|
+
|
22
|
+
return agent
|
23
|
+
|
24
|
+
def __repr__(self):
|
25
|
+
return f"AssistantAgent(name='{self.name}', description='{self.description}')"
|
26
|
+
|
27
|
+
def __str__(self):
|
28
|
+
return self.__repr__()
|
ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/agents/external_agent.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import json
|
2
|
+
from ibm_watsonx_orchestrate.utils.utils import yaml_safe_load
|
3
|
+
from .types import ExternalAgentSpec
|
4
|
+
|
5
|
+
|
6
|
+
class ExternalAgent(ExternalAgentSpec):
|
7
|
+
|
8
|
+
@staticmethod
|
9
|
+
def from_spec(file: str) -> 'ExternalAgent':
|
10
|
+
with open(file, 'r') as f:
|
11
|
+
if file.endswith('.yaml') or file.endswith('.yml'):
|
12
|
+
content = yaml_safe_load(f)
|
13
|
+
elif file.endswith('.json'):
|
14
|
+
content = json.load(f)
|
15
|
+
else:
|
16
|
+
raise ValueError('file must end in .json, .yaml, or .yml')
|
17
|
+
|
18
|
+
if not content.get("spec_version"):
|
19
|
+
raise ValueError(f"Field 'spec_version' not provided. Please ensure provided spec conforms to a valid spec format")
|
20
|
+
agent = ExternalAgent.model_validate(content)
|
21
|
+
|
22
|
+
return agent
|
23
|
+
|
24
|
+
def __repr__(self):
|
25
|
+
return f"ExternalAgent(name='{self.name}', description='{self.description}')"
|
26
|
+
|
27
|
+
def __str__(self):
|
28
|
+
return self.__repr__()
|
@@ -0,0 +1,204 @@
|
|
1
|
+
import json
|
2
|
+
import yaml
|
3
|
+
from enum import Enum
|
4
|
+
from typing import List, Optional, Dict
|
5
|
+
from pydantic import BaseModel, model_validator, ConfigDict
|
6
|
+
from ibm_watsonx_orchestrate.agent_builder.tools import BaseTool
|
7
|
+
from ibm_watsonx_orchestrate.agent_builder.knowledge_bases.types import KnowledgeBaseSpec
|
8
|
+
from pydantic import Field, AliasChoices
|
9
|
+
from typing import Annotated
|
10
|
+
|
11
|
+
# TO-DO: this is just a placeholder. Will update this later to align with backend
|
12
|
+
DEFAULT_LLM = "watsonx/meta-llama/llama-3-1-70b-instruct"
|
13
|
+
|
14
|
+
class SpecVersion(str, Enum):
|
15
|
+
V1 = "v1"
|
16
|
+
|
17
|
+
|
18
|
+
class AgentKind(str, Enum):
|
19
|
+
NATIVE = "native"
|
20
|
+
EXTERNAL = "external"
|
21
|
+
ASSISTANT = "assistant"
|
22
|
+
|
23
|
+
class ExternalAgentAuthScheme(str, Enum):
|
24
|
+
BEARER_TOKEN = 'BEARER_TOKEN'
|
25
|
+
API_KEY = "API_KEY"
|
26
|
+
NONE = 'NONE'
|
27
|
+
|
28
|
+
class AgentProvider(str, Enum):
|
29
|
+
WXAI = "wx.ai"
|
30
|
+
EXT_CHAT = "external_chat"
|
31
|
+
SALESFORCE = "salesforce"
|
32
|
+
WATSONX = "watsonx" #provider type returned from an assistant agent
|
33
|
+
|
34
|
+
|
35
|
+
class AssistantAgentAuthType(str, Enum):
|
36
|
+
ICP_IAM = "ICP_IAM"
|
37
|
+
IBM_CLOUD_IAM = "IBM_CLOUD_IAM"
|
38
|
+
MCSP = "MCSP"
|
39
|
+
BEARER_TOKEN = "BEARER_TOKEN"
|
40
|
+
HIDDEN = "<hidden>"
|
41
|
+
|
42
|
+
|
43
|
+
class BaseAgentSpec(BaseModel):
|
44
|
+
spec_version: SpecVersion = None
|
45
|
+
kind: AgentKind
|
46
|
+
id: Optional[Annotated[str, Field(json_schema_extra={"min_length_str": 1})]] = None
|
47
|
+
name: Annotated[str, Field(json_schema_extra={"min_length_str":1})]
|
48
|
+
description: Annotated[str, Field(json_schema_extra={"min_length_str":1})]
|
49
|
+
|
50
|
+
def dump_spec(self, file: str) -> None:
|
51
|
+
dumped = self.model_dump(mode='json', exclude_unset=True, exclude_none=True)
|
52
|
+
with open(file, 'w') as f:
|
53
|
+
if file.endswith('.yaml') or file.endswith('.yml'):
|
54
|
+
yaml.dump(dumped, f, sort_keys=False)
|
55
|
+
elif file.endswith('.json'):
|
56
|
+
json.dump(dumped, f, indent=2)
|
57
|
+
else:
|
58
|
+
raise ValueError('file must end in .json, .yaml, or .yml')
|
59
|
+
|
60
|
+
def dumps_spec(self) -> str:
|
61
|
+
dumped = self.model_dump(mode='json', exclude_none=True)
|
62
|
+
return json.dumps(dumped, indent=2)
|
63
|
+
|
64
|
+
# ===============================
|
65
|
+
# NATIVE AGENT TYPES
|
66
|
+
# ===============================
|
67
|
+
|
68
|
+
class AgentStyle(str, Enum):
|
69
|
+
DEFAULT = "default"
|
70
|
+
REACT = "react"
|
71
|
+
|
72
|
+
class AgentSpec(BaseAgentSpec):
|
73
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
74
|
+
|
75
|
+
kind: AgentKind = AgentKind.NATIVE
|
76
|
+
llm: str = DEFAULT_LLM
|
77
|
+
style: AgentStyle = AgentStyle.DEFAULT
|
78
|
+
instructions: Annotated[Optional[str], Field(json_schema_extra={"min_length_str":1})] = None
|
79
|
+
collaborators: Optional[List[str]] | Optional[List['BaseAgentSpec']] = []
|
80
|
+
tools: Optional[List[str]] | Optional[List['BaseTool']] = []
|
81
|
+
hidden: bool = False
|
82
|
+
knowledge_base: Optional[List[str]] | Optional[List['KnowledgeBaseSpec']] = []
|
83
|
+
|
84
|
+
|
85
|
+
def __init__(self, *args, **kwargs):
|
86
|
+
if "tools" in kwargs and kwargs["tools"]:
|
87
|
+
kwargs["tools"] = [x.__tool_spec__.name if isinstance(x, BaseTool) else x for x in kwargs["tools"]]
|
88
|
+
if "collaborators" in kwargs and kwargs["collaborators"]:
|
89
|
+
kwargs["collaborators"] = [x.name if isinstance(x, BaseAgentSpec) else x for x in kwargs["collaborators"]]
|
90
|
+
super().__init__(*args, **kwargs)
|
91
|
+
|
92
|
+
@model_validator(mode="before")
|
93
|
+
def validate_fields(cls, values):
|
94
|
+
return validate_agent_fields(values)
|
95
|
+
|
96
|
+
@model_validator(mode="after")
|
97
|
+
def validate_kind(self):
|
98
|
+
if self.kind != AgentKind.NATIVE:
|
99
|
+
raise ValueError(f"The specified kind '{self.kind}' cannot be used to create a native agent.")
|
100
|
+
return self
|
101
|
+
|
102
|
+
def validate_agent_fields(values: dict) -> dict:
|
103
|
+
# Check for empty strings or whitespace
|
104
|
+
for field in ["id", "name", "kind", "description", "collaborators", "tools"]:
|
105
|
+
value = values.get(field)
|
106
|
+
if value and not str(value).strip():
|
107
|
+
raise ValueError(f"{field} cannot be empty or just whitespace")
|
108
|
+
|
109
|
+
name = values.get("name")
|
110
|
+
collaborators = values.get("collaborators", []) if values.get("collaborators", []) else []
|
111
|
+
for collaborator in collaborators:
|
112
|
+
if collaborator == name:
|
113
|
+
raise ValueError(f"Circular reference detected. The agent '{name}' cannot contain itself as a collaborator")
|
114
|
+
|
115
|
+
|
116
|
+
return values
|
117
|
+
|
118
|
+
# ===============================
|
119
|
+
# EXTERNAL AGENT TYPES
|
120
|
+
# ===============================
|
121
|
+
|
122
|
+
class ExternalAgentConfig(BaseModel):
|
123
|
+
hidden: bool = False
|
124
|
+
enable_cot: bool = False
|
125
|
+
|
126
|
+
class ExternalAgentSpec(BaseAgentSpec):
|
127
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
128
|
+
|
129
|
+
kind: AgentKind = AgentKind.EXTERNAL
|
130
|
+
title: Annotated[str, Field(json_schema_extra={"min_length_str":1})]
|
131
|
+
tags: Optional[List[str]] = None
|
132
|
+
api_url: Annotated[str, Field(json_schema_extra={"min_length_str":1})]
|
133
|
+
auth_scheme: ExternalAgentAuthScheme = ExternalAgentAuthScheme.NONE
|
134
|
+
auth_config: dict = {}
|
135
|
+
provider: AgentProvider = AgentProvider.EXT_CHAT
|
136
|
+
chat_params: dict = None
|
137
|
+
config: ExternalAgentConfig = ExternalAgentConfig()
|
138
|
+
nickname: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
139
|
+
app_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
140
|
+
connection_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
141
|
+
|
142
|
+
@model_validator(mode="before")
|
143
|
+
def validate_fields_for_external(cls, values):
|
144
|
+
return validate_external_agent_fields(values)
|
145
|
+
|
146
|
+
@model_validator(mode="after")
|
147
|
+
def validate_kind_for_external(self):
|
148
|
+
if self.kind != AgentKind.EXTERNAL:
|
149
|
+
raise ValueError(f"The specified kind '{self.kind}' cannot be used to create an external agent.")
|
150
|
+
return self
|
151
|
+
|
152
|
+
def validate_external_agent_fields(values: dict) -> dict:
|
153
|
+
# Check for empty strings or whitespace
|
154
|
+
for field in ["name", "kind", "description", "title", "tags", "api_url", "chat_params", "nickname", "app_id"]:
|
155
|
+
value = values.get(field)
|
156
|
+
if value and not str(value).strip():
|
157
|
+
raise ValueError(f"{field} cannot be empty or just whitespace")
|
158
|
+
|
159
|
+
return values
|
160
|
+
|
161
|
+
# # ===============================
|
162
|
+
# # ASSISTANT AGENT TYPES
|
163
|
+
# # ===============================
|
164
|
+
|
165
|
+
class AssistantAgentConfig(BaseModel):
|
166
|
+
api_version: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
167
|
+
assistant_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
168
|
+
crn: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
169
|
+
service_instance_url: Annotated[str | None, Field(validation_alias=AliasChoices('instance_url', 'service_instance_url'), serialization_alias='service_instance_url')] = None
|
170
|
+
environment_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
171
|
+
auth_type: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
172
|
+
connection_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
173
|
+
api_key: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
174
|
+
authorization_url: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
175
|
+
auth_type: AssistantAgentAuthType = AssistantAgentAuthType.MCSP
|
176
|
+
|
177
|
+
class AssistantAgentSpec(BaseAgentSpec):
|
178
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
179
|
+
|
180
|
+
kind: AgentKind = AgentKind.ASSISTANT
|
181
|
+
title: Annotated[str, Field(json_schema_extra={"min_length_str":1})]
|
182
|
+
tags: Optional[List[str]] = None
|
183
|
+
config: AssistantAgentConfig = AssistantAgentConfig()
|
184
|
+
nickname: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
185
|
+
connection_id: Annotated[str | None, Field(json_schema_extra={"min_length_str":1})] = None
|
186
|
+
|
187
|
+
@model_validator(mode="before")
|
188
|
+
def validate_fields_for_external(cls, values):
|
189
|
+
return validate_assistant_agent_fields(values)
|
190
|
+
|
191
|
+
@model_validator(mode="after")
|
192
|
+
def validate_kind_for_external(self):
|
193
|
+
if self.kind != AgentKind.ASSISTANT:
|
194
|
+
raise ValueError(f"The specified kind '{self.kind}' cannot be used to create an assistant agent.")
|
195
|
+
return self
|
196
|
+
|
197
|
+
def validate_assistant_agent_fields(values: dict) -> dict:
|
198
|
+
# Check for empty strings or whitespace
|
199
|
+
for field in ["name", "kind", "description", "title", "tags", "nickname", "app_id"]:
|
200
|
+
value = values.get(field)
|
201
|
+
if value and not str(value).strip():
|
202
|
+
raise ValueError(f"{field} cannot be empty or just whitespace")
|
203
|
+
|
204
|
+
return values
|
ibm_watsonx_orchestrate-1.0.0/src/ibm_watsonx_orchestrate/agent_builder/connections/__init__.py
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
from .connections import (
|
2
|
+
get_application_connection_credentials,
|
3
|
+
get_connection_type
|
4
|
+
)
|
5
|
+
from .types import (
|
6
|
+
ConnectionType,
|
7
|
+
ConnectionKind,
|
8
|
+
ConnectionAuthType,
|
9
|
+
ConnectionConfiguration,
|
10
|
+
ConnectionEnvironment,
|
11
|
+
ConnectionPreference,
|
12
|
+
ConnectionSecurityScheme,
|
13
|
+
CREDENTIALS,
|
14
|
+
BasicAuthCredentials,
|
15
|
+
BearerTokenAuthCredentials,
|
16
|
+
APIKeyAuthCredentials,
|
17
|
+
OAuth2TokenCredentials,
|
18
|
+
# OAuth2AuthCodeCredentials,
|
19
|
+
# OAuth2ClientCredentials,
|
20
|
+
# OAuth2ImplicitCredentials,
|
21
|
+
# OAuth2PasswordCredentials,
|
22
|
+
OAuthOnBehalfOfCredentials,
|
23
|
+
KeyValueConnectionCredentials,
|
24
|
+
CONNECTION_KIND_SCHEME_MAPPING,
|
25
|
+
CONNECTION_TYPE_CREDENTIAL_MAPPING,
|
26
|
+
ExpectedCredentials
|
27
|
+
)
|