ibm-watsonx-orchestrate 1.11.0b1__py3-none-any.whl → 1.12.0b1__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 +1 -2
- ibm_watsonx_orchestrate/agent_builder/agents/types.py +22 -5
- ibm_watsonx_orchestrate/agent_builder/connections/connections.py +3 -3
- ibm_watsonx_orchestrate/agent_builder/connections/types.py +14 -0
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +1 -1
- ibm_watsonx_orchestrate/agent_builder/models/types.py +1 -0
- ibm_watsonx_orchestrate/agent_builder/toolkits/base_toolkit.py +1 -1
- ibm_watsonx_orchestrate/agent_builder/tools/__init__.py +1 -0
- ibm_watsonx_orchestrate/agent_builder/tools/base_tool.py +1 -1
- ibm_watsonx_orchestrate/agent_builder/tools/langflow_tool.py +124 -0
- ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +9 -3
- ibm_watsonx_orchestrate/agent_builder/tools/types.py +20 -2
- ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +19 -6
- ibm_watsonx_orchestrate/cli/commands/connections/connections_command.py +18 -0
- ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +114 -0
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_controller.py +2 -6
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_server_controller.py +24 -91
- ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_command.py +49 -0
- ibm_watsonx_orchestrate/cli/commands/models/model_provider_mapper.py +23 -4
- ibm_watsonx_orchestrate/cli/commands/models/models_controller.py +3 -3
- ibm_watsonx_orchestrate/cli/commands/partners/offering/partners_offering_command.py +56 -0
- ibm_watsonx_orchestrate/cli/commands/partners/offering/partners_offering_controller.py +458 -0
- ibm_watsonx_orchestrate/cli/commands/partners/offering/types.py +107 -0
- ibm_watsonx_orchestrate/cli/commands/partners/partners_command.py +12 -0
- ibm_watsonx_orchestrate/cli/commands/partners/partners_controller.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/server/server_command.py +124 -637
- ibm_watsonx_orchestrate/cli/commands/server/types.py +1 -1
- ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_command.py +2 -2
- ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_controller.py +2 -2
- ibm_watsonx_orchestrate/cli/commands/tools/tools_command.py +2 -3
- ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +206 -43
- ibm_watsonx_orchestrate/cli/main.py +2 -0
- ibm_watsonx_orchestrate/client/connections/connections_client.py +4 -1
- ibm_watsonx_orchestrate/client/tools/tempus_client.py +3 -0
- ibm_watsonx_orchestrate/client/tools/tool_client.py +5 -2
- ibm_watsonx_orchestrate/client/utils.py +31 -1
- ibm_watsonx_orchestrate/docker/compose-lite.yml +68 -17
- ibm_watsonx_orchestrate/docker/default.env +21 -18
- ibm_watsonx_orchestrate/flow_builder/flows/decorators.py +8 -2
- ibm_watsonx_orchestrate/flow_builder/flows/flow.py +31 -7
- ibm_watsonx_orchestrate/flow_builder/node.py +1 -1
- ibm_watsonx_orchestrate/flow_builder/types.py +18 -3
- ibm_watsonx_orchestrate/utils/docker_utils.py +280 -0
- ibm_watsonx_orchestrate/utils/environment.py +369 -0
- ibm_watsonx_orchestrate/utils/utils.py +1 -1
- {ibm_watsonx_orchestrate-1.11.0b1.dist-info → ibm_watsonx_orchestrate-1.12.0b1.dist-info}/METADATA +2 -2
- {ibm_watsonx_orchestrate-1.11.0b1.dist-info → ibm_watsonx_orchestrate-1.12.0b1.dist-info}/RECORD +50 -42
- {ibm_watsonx_orchestrate-1.11.0b1.dist-info → ibm_watsonx_orchestrate-1.12.0b1.dist-info}/WHEEL +0 -0
- {ibm_watsonx_orchestrate-1.11.0b1.dist-info → ibm_watsonx_orchestrate-1.12.0b1.dist-info}/entry_points.txt +0 -0
- {ibm_watsonx_orchestrate-1.11.0b1.dist-info → ibm_watsonx_orchestrate-1.12.0b1.dist-info}/licenses/LICENSE +0 -0
@@ -49,8 +49,28 @@ services:
|
|
49
49
|
MAX_POOL: 60
|
50
50
|
DEPLOYMENT_MODE: laptop
|
51
51
|
SUFFIXLIST: ${CM_SUFFIXLIST:-[]}
|
52
|
+
BACKEND_BASE_URL: http://localhost:3001
|
53
|
+
CALLBACK_URL: http://localhost:3001/auth/oauth2/callback
|
52
54
|
ports:
|
53
55
|
- 3001:3001
|
56
|
+
|
57
|
+
wxo-server-connections-ui:
|
58
|
+
image: ${CONNECTIONS_UI_REGISTRY:-us.icr.io/watson-orchestrate-private}/wxo-connections-ui:${CONNECTIONS_UI_TAG:-latest}
|
59
|
+
platform: linux/amd64
|
60
|
+
profiles: [connections-ui]
|
61
|
+
environment:
|
62
|
+
PORT: 3412
|
63
|
+
WXO_CONNECTIONS_URL: http://wxo-server-connection-manager:3001
|
64
|
+
DEPLOYMENT_MODE: laptop
|
65
|
+
WXO_URL: http://localhost:3412
|
66
|
+
ENV: production
|
67
|
+
WXO_SERVER_URL: http://localhost:4321
|
68
|
+
TENANT_ID: ${REACT_APP_TENANT_ID}
|
69
|
+
WXO_CHAT_URL: http://localhost:3000
|
70
|
+
ports:
|
71
|
+
- "3412:3412"
|
72
|
+
networks:
|
73
|
+
- default
|
54
74
|
|
55
75
|
ai-gateway:
|
56
76
|
image: ${AI_GATEWAY_REGISTRY:-us.icr.io/watson-orchestrate-private}/ai-gateway:${AI_GATEWAY_TAG:-latest}
|
@@ -73,6 +93,24 @@ services:
|
|
73
93
|
environment:
|
74
94
|
JWT_SECRET: ${JWT_SECRET}
|
75
95
|
DEPLOYMENT_PLATFORM: laptop-lite
|
96
|
+
CALLBACK_HOST_URL: ${CALLBACK_HOST_URL:-}
|
97
|
+
REDIS_URL: redis://wxo-server-redis:6379/0
|
98
|
+
entrypoint: >
|
99
|
+
sh -c '
|
100
|
+
if [ ! -z "$$CALLBACK_HOST_URL" ]; then
|
101
|
+
GATEWAY_IP=$$(echo "$$CALLBACK_HOST_URL" | sed "s|http://||" | cut -d: -f1)
|
102
|
+
export CALL_BACK_URL="http://$$GATEWAY_IP:8989"
|
103
|
+
echo "Auto-configured CALL_BACK_URL: $$CALL_BACK_URL"
|
104
|
+
else
|
105
|
+
export CALL_BACK_URL="http://wxo-agent-gateway:8989"
|
106
|
+
echo "Using fallback CALL_BACK_URL: $$CALL_BACK_URL"
|
107
|
+
fi
|
108
|
+
if [ $$# -eq 0 ]; then
|
109
|
+
exec ./conditional_script.sh
|
110
|
+
else
|
111
|
+
exec "$$@"
|
112
|
+
fi
|
113
|
+
'
|
76
114
|
|
77
115
|
ui:
|
78
116
|
image: ${UI_REGISTRY:-us.icr.io/watson-orchestrate-private}/wxo-chat:${UITAG:-latest}
|
@@ -105,6 +143,7 @@ services:
|
|
105
143
|
STANDALONE: "true"
|
106
144
|
STREAM_TIMEOUT: ${STREAM_TIMEOUT:-120000}
|
107
145
|
WXO_VOICE_URL: http://localhost:9876/v1
|
146
|
+
DPS_CACHE_URL: http://localhost:18083
|
108
147
|
command: "./StartServer.sh"
|
109
148
|
ports:
|
110
149
|
- "3000:4002"
|
@@ -127,14 +166,15 @@ services:
|
|
127
166
|
AGENTS_OPS_RUNTIME_ENDPOINT: https://frontend-server:443
|
128
167
|
DPI_WO_WDU_SERVER_ENDPOINT: https://wxo-doc-processing-service:8080
|
129
168
|
DPI_RAG_SERVER_ENDPOINT: https://wxo-doc-processing-llm-service:8083
|
130
|
-
IBM_DPS_CACHE_SERVICE:
|
169
|
+
IBM_DPS_CACHE_SERVICE: http://wxo-doc-processing-cache:8080
|
131
170
|
DOCPROC_BASE_URL: http://wxo-doc-processing-infra-standalone:9080
|
132
171
|
BUILDER_ASYNC_CALLBACK_ENDPOINT: http://wxo-builder:4025
|
133
172
|
DOCPROC_ENABLED: ${DOCPROC_ENABLED:-false}
|
134
173
|
IS_OBSERVABILITY_FEATURE_ENABLED: "true"
|
135
174
|
ALLOW_INSECURE_TLS: "true"
|
136
|
-
ENABLE_EDIT_PROMPTS: "
|
175
|
+
ENABLE_EDIT_PROMPTS: "true"
|
137
176
|
LANGFLOW_ENABLED: ${LANGFLOW_ENABLED:-false}
|
177
|
+
ENABLE_EMBED_SCRIPT: "true"
|
138
178
|
command: 'npm start'
|
139
179
|
ports:
|
140
180
|
- "4025:4025"
|
@@ -352,6 +392,10 @@ services:
|
|
352
392
|
ES_HOST: http://elasticsearch:9200
|
353
393
|
ORIGIN_HEADER: "internal"
|
354
394
|
LANGFLOW_ENABLED: ${LANGFLOW_ENABLED:-false}
|
395
|
+
WATSONX_SERVER: WXO
|
396
|
+
EVALUATION_PLATFORM: lite-local
|
397
|
+
AGENTOPS_BACKEND_URL: https://frontend-server:443
|
398
|
+
OBSERVABILITY_POSTGRES_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@wxo-server-db:5432/wxo_observability
|
355
399
|
|
356
400
|
wxo-server-worker:
|
357
401
|
image: ${WORKER_REGISTRY:-us.icr.io/watson-orchestrate-private}/wxo-server-conversation_controller:${WORKER_TAG:-latest}
|
@@ -452,6 +496,10 @@ services:
|
|
452
496
|
CPD_VERIFY: ${CPD_VERIFY}
|
453
497
|
CALLBACK_HOST_URL: ${CALLBACK_HOST_URL:-http://wxo-server:4321}
|
454
498
|
LANGFLOW_ENABLED: ${LANGFLOW_ENABLED:-false}
|
499
|
+
WATSONX_SERVER: WXO
|
500
|
+
EVALUATION_PLATFORM: lite-local
|
501
|
+
AGENTOPS_BACKEND_URL: https://frontend-server:443
|
502
|
+
OBSERVABILITY_POSTGRES_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@wxo-server-db:5432/wxo_observability
|
455
503
|
|
456
504
|
tools-runtime-manager:
|
457
505
|
image: ${TRM_REGISTRY:-us.icr.io/watson-orchestrate-private}/tools-runtime-manager:${TRM_TAG:-latest}
|
@@ -812,6 +860,7 @@ services:
|
|
812
860
|
AUTHORIZATION_URL: ${AUTHORIZATION_URL}
|
813
861
|
WO_AUTH_TYPE: ${WO_AUTH_TYPE}
|
814
862
|
FLOW_CALLBACK_REQUEST_RETRIES: "1"
|
863
|
+
DOCPROC_CACHE_SERVER_URL: http://wxo-doc-processing-cache:8080
|
815
864
|
healthcheck:
|
816
865
|
test: curl -k http://localhost:9044/readiness --fail
|
817
866
|
interval: 30s
|
@@ -857,13 +906,13 @@ services:
|
|
857
906
|
SERVICE_NAME: wxo-doc-processing-service
|
858
907
|
LOG_LEVEL: info
|
859
908
|
VERIFY_CLIENT_CERT: 0
|
860
|
-
SERVICE_URL: ${SERVICE_URL:-
|
909
|
+
SERVICE_URL: ${SERVICE_URL:-http://wxo-doc-processing-cache:8080}
|
861
910
|
RATE_LIMITING_ENABLED: "false"
|
862
911
|
SHOULD_CACHE_IMAGES: "false"
|
863
912
|
HANDWRITING_ENABLED: "true"
|
864
913
|
WDU_RUNTIME_URL: wdu-runtime:8080
|
865
914
|
WDU_TIMEOUT_SECS: "180"
|
866
|
-
IBM_DPS_CACHE_SERVICE:
|
915
|
+
IBM_DPS_CACHE_SERVICE: http://wxo-doc-processing-cache:8080
|
867
916
|
profiles:
|
868
917
|
- docproc
|
869
918
|
depends_on:
|
@@ -887,18 +936,18 @@ services:
|
|
887
936
|
PREFLIGHT_MAX_SIZE: 10Mb
|
888
937
|
PREFLIGHT_MAX_PAGES: 600
|
889
938
|
RUNTIME_LIBRARY: "watson_doc_understanding"
|
890
|
-
WXAI_API_KEY: ${WXAI_API_KEY:-}
|
891
|
-
WXAI_IMAGE_DESCRIPTION_MODEL_ID: ${WXAI_IMAGE_DESCRIPTION_MODEL_ID:-mistralai/
|
892
|
-
|
893
|
-
WXAI_KVP_MODEL_ID: ${WXAI_KVP_MODEL_ID:-}
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
WXAI_URL: ${WXAI_URL:-}
|
939
|
+
WXAI_API_KEY: ${WXAI_API_KEY:-"gateway"}
|
940
|
+
WXAI_IMAGE_DESCRIPTION_MODEL_ID: ${WXAI_IMAGE_DESCRIPTION_MODEL_ID:-mistralai/mistral-small-3-1-24b-instruct-2503}
|
941
|
+
WXAI_IMAGE_DESCRIPTION_SPACE_ID: ${WATSONX_SPACE_ID:-}
|
942
|
+
WXAI_KVP_MODEL_ID: ${WXAI_KVP_MODEL_ID:-mistralai/mistral-small-3-1-24b-instruct-2503}
|
943
|
+
WXAI_KVP_SPACE_ID: ${WATSONX_SPACE_ID:-}
|
944
|
+
WXAI_SEMANTIC_KVP_MODEL_ID: ${WXAI_SEMANTIC_KVP_MODEL_ID:-mistralai/mistral-small-3-1-24b-instruct-2503}
|
945
|
+
WXAI_SEMANTIC_KVP_SPACE_ID: ${WATSONX_SPACE_ID:-}
|
946
|
+
WXAI_URL: ${AI_GATEWAY_BASE_URL:-}
|
899
947
|
WXAI_USERNAME: ${WXAI_USERNAME:-}
|
900
948
|
WXAI_INSTANCE_ID: ${WXAI_INSTANCE_ID:-}
|
901
|
-
WXAI_VERSION: ${WXAI_VERSION:-
|
949
|
+
WXAI_VERSION: ${WXAI_VERSION:-2023-05-29}
|
950
|
+
WXAI_PROVIDER: ${WXAI_PROVIDER:-gateway}
|
902
951
|
|
903
952
|
profiles:
|
904
953
|
- docproc
|
@@ -958,6 +1007,8 @@ services:
|
|
958
1007
|
VERIFY_CLIENT_CERT: 1
|
959
1008
|
# S3_USE_SSL: false
|
960
1009
|
# S3_VERIFY_CERT: false
|
1010
|
+
ISTIO_ENABLED: true
|
1011
|
+
IS_ADK_ENV: true
|
961
1012
|
profiles:
|
962
1013
|
- docproc
|
963
1014
|
depends_on:
|
@@ -970,7 +1021,7 @@ services:
|
|
970
1021
|
# volumes:
|
971
1022
|
# - ./docker/wo_doc_processing_rag_base/etc/certs:/etc/certs
|
972
1023
|
healthcheck:
|
973
|
-
test: ["CMD-SHELL", "curl -fk
|
1024
|
+
test: ["CMD-SHELL", "curl -fk http://localhost:8080/ping"]
|
974
1025
|
interval: 30s
|
975
1026
|
timeout: 30s
|
976
1027
|
retries: 10
|
@@ -1029,7 +1080,7 @@ services:
|
|
1029
1080
|
LOG_LEVEL: info
|
1030
1081
|
WATSONX_API_ENDPOINT: ${WATSONX_URL:-https://us-south.ml.cloud.ibm.com}
|
1031
1082
|
WXO_SERVER_BASE_URL : http://wxo-server:4321
|
1032
|
-
IBM_DPS_CACHE_SERVICE: 'wxo-doc-processing-cache:8080'
|
1083
|
+
IBM_DPS_CACHE_SERVICE: 'http://wxo-doc-processing-cache:8080'
|
1033
1084
|
profiles:
|
1034
1085
|
- docproc
|
1035
1086
|
depends_on:
|
@@ -1140,7 +1191,7 @@ services:
|
|
1140
1191
|
environment:
|
1141
1192
|
LANGFLOW_PORT: 7861
|
1142
1193
|
LANGFLOW_DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@wxo-server-db:5432/langflow
|
1143
|
-
LANGFLOW_CONFIG_DIR: app/langflow
|
1194
|
+
LANGFLOW_CONFIG_DIR: /app/app/langflow
|
1144
1195
|
volumes:
|
1145
1196
|
- langflow-data:/app/langflow
|
1146
1197
|
|
@@ -58,41 +58,44 @@ REGISTRY_URL=
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
-
SERVER_TAG=
|
61
|
+
SERVER_TAG=17-10-2025-8a9aff2
|
62
62
|
SERVER_REGISTRY=
|
63
63
|
|
64
|
-
WORKER_TAG=
|
64
|
+
WORKER_TAG=17-10-2025-8a9aff2
|
65
65
|
WORKER_REGISTRY=
|
66
66
|
|
67
67
|
AI_GATEWAY_TAG=20-08-2025-9ed6d40
|
68
68
|
AI_GATEWAY_REGISTRY=
|
69
69
|
|
70
|
-
AGENT_GATEWAY_TAG=
|
70
|
+
AGENT_GATEWAY_TAG=16-09-2025-115ef29
|
71
71
|
AGENT_GATEWAY_REGISTRY=
|
72
72
|
|
73
73
|
DB_REGISTRY=
|
74
74
|
# If you build multiarch set all three of these to the same, we have a pr against main
|
75
75
|
# to not have this separation, but we can merge it later
|
76
|
-
DBTAG=
|
77
|
-
AMDDBTAG=
|
78
|
-
ARM64DBTAG=
|
76
|
+
DBTAG=17-09-2025-8a9aff2
|
77
|
+
AMDDBTAG=17-09-2025-8a9aff2
|
78
|
+
ARM64DBTAG=17-09-2025-8a9aff2
|
79
79
|
|
80
80
|
UI_REGISTRY=
|
81
|
-
UITAG=
|
81
|
+
UITAG=19-09-2025-188b5fe
|
82
82
|
|
83
83
|
CM_REGISTRY=
|
84
|
-
CM_TAG=
|
84
|
+
CM_TAG=16-09-2025-e33b344
|
85
85
|
|
86
|
-
|
86
|
+
CONNECTIONS_UI_REGISTRY=
|
87
|
+
CONNECTIONS_UI_TAG=15-09-2025-98aa9da
|
88
|
+
|
89
|
+
TRM_TAG=15-09-2025-228f397
|
87
90
|
TRM_REGISTRY=
|
88
91
|
|
89
|
-
TR_TAG=
|
92
|
+
TR_TAG=15-09-2025-228f397
|
90
93
|
TR_REGISTRY=
|
91
94
|
|
92
|
-
BUILDER_TAG=
|
95
|
+
BUILDER_TAG=19-09-2025-4ab5c88
|
93
96
|
BUILDER_REGISTRY=
|
94
97
|
|
95
|
-
FLOW_RUNTIME_TAG=
|
98
|
+
FLOW_RUNTIME_TAG=15-09-2025-c208dc5
|
96
99
|
FLOW_RUMTIME_REGISTRY=
|
97
100
|
|
98
101
|
|
@@ -108,20 +111,20 @@ SOCKET_HANDLER_REGISTRY=
|
|
108
111
|
CPE_TAG=29-08-2025-e612bea
|
109
112
|
CPE_REGISTRY=
|
110
113
|
|
111
|
-
VOICE_CONTROLLER_TAG=12-
|
114
|
+
VOICE_CONTROLLER_TAG=12-09-2025-0e04772
|
112
115
|
VOICE_CONTROLLER_REGISTRY=
|
113
116
|
|
114
117
|
LANGFLOW_TAG=
|
115
118
|
LANGFLOW_IMAGE=
|
116
119
|
|
117
120
|
# IBM Document Processing
|
118
|
-
WDU_TAG=2.
|
121
|
+
WDU_TAG=2.7.0
|
119
122
|
WDU_REGISTRY=
|
120
123
|
|
121
|
-
DOCPROC_DPS_TAG=
|
122
|
-
DOCPROC_LLMSERVICE_TAG=
|
123
|
-
DOCPROC_CACHE_TAG=
|
124
|
-
DOCPROC_DPI_TAG=
|
124
|
+
DOCPROC_DPS_TAG=20250910-165658-290-c566031
|
125
|
+
DOCPROC_LLMSERVICE_TAG=20250915-main-139-7a36ad3
|
126
|
+
DOCPROC_CACHE_TAG=20250916-master-86-454157f
|
127
|
+
DOCPROC_DPI_TAG=20250910-214413-288-a348dfd9
|
125
128
|
DOCPROC_REGISTRY=
|
126
129
|
|
127
130
|
# END -- IMAGE REGISTRIES AND TAGS
|
@@ -8,6 +8,8 @@ import logging
|
|
8
8
|
import inspect
|
9
9
|
from typing import Callable, Optional, Sequence
|
10
10
|
from pydantic import BaseModel
|
11
|
+
|
12
|
+
from ...agent_builder.models.types import ListVirtualModel
|
11
13
|
from ..types import extract_node_spec, UserNodeSpec, FlowSpec
|
12
14
|
|
13
15
|
from .flow import FlowFactory, Flow
|
@@ -34,7 +36,9 @@ def flow(*args,
|
|
34
36
|
input_schema: type[BaseModel] | None = None,
|
35
37
|
output_schema: type[BaseModel] | None = None,
|
36
38
|
initiators: Sequence[str] = (),
|
37
|
-
schedulable: bool = False
|
39
|
+
schedulable: bool = False,
|
40
|
+
llm_model: str|ListVirtualModel|None=None,
|
41
|
+
agent_conversation_memory_turns_limit: int|None=None):
|
38
42
|
"""Decorator to mark a function as a flow model builder."""
|
39
43
|
|
40
44
|
def decorator(func: Callable):
|
@@ -60,7 +64,9 @@ def flow(*args,
|
|
60
64
|
input_schema = input_schema,
|
61
65
|
output_schema = output_schema,
|
62
66
|
initiators = initiators,
|
63
|
-
schedulable = schedulable
|
67
|
+
schedulable = schedulable,
|
68
|
+
llm_model = llm_model,
|
69
|
+
agent_conversation_memory_turns_limit = agent_conversation_memory_turns_limit)
|
64
70
|
|
65
71
|
# logger.info("Creating flow model: %s", a_model.spec.name)
|
66
72
|
|
@@ -21,6 +21,7 @@ from typing_extensions import Self
|
|
21
21
|
from pydantic import BaseModel, Field, SerializeAsAny, create_model, TypeAdapter
|
22
22
|
import yaml
|
23
23
|
from ibm_watsonx_orchestrate.agent_builder.tools.python_tool import PythonTool
|
24
|
+
from ibm_watsonx_orchestrate.agent_builder.models.types import ListVirtualModel
|
24
25
|
from ibm_watsonx_orchestrate.client.tools.tool_client import ToolClient
|
25
26
|
from ibm_watsonx_orchestrate.client.tools.tempus_client import TempusClient
|
26
27
|
from ibm_watsonx_orchestrate.client.utils import instantiate_client
|
@@ -84,6 +85,21 @@ class Flow(Node):
|
|
84
85
|
# get Tool Client
|
85
86
|
self._tool_client = instantiate_client(ToolClient)
|
86
87
|
|
88
|
+
# set llm_model to use for the flow if any
|
89
|
+
llm_model = kwargs.get("llm_model")
|
90
|
+
if llm_model:
|
91
|
+
if isinstance(llm_model, ListVirtualModel):
|
92
|
+
self.metadata["llm_model"] = llm_model.name
|
93
|
+
elif isinstance(llm_model, str):
|
94
|
+
self.metadata["llm_model"] = llm_model
|
95
|
+
else:
|
96
|
+
raise AssertionError(f"flow llm_model should be either a str or ListVirtualModel")
|
97
|
+
|
98
|
+
# set agent_conversation_memory_turns_limit for the flow if any
|
99
|
+
agent_conversation_memory_turns_limit = kwargs.get("agent_conversation_memory_turns_limit")
|
100
|
+
if agent_conversation_memory_turns_limit:
|
101
|
+
self.metadata["agent_conversation_memory_turns_limit"] = agent_conversation_memory_turns_limit
|
102
|
+
|
87
103
|
def _find_topmost_flow(self) -> Self:
|
88
104
|
if self.parent:
|
89
105
|
return self.parent._find_topmost_flow()
|
@@ -519,7 +535,9 @@ class Flow(Node):
|
|
519
535
|
fields: type[BaseModel]| None = None,
|
520
536
|
description: str | None = None,
|
521
537
|
input_map: DataMap = None,
|
522
|
-
enable_hw: bool = False
|
538
|
+
enable_hw: bool = False,
|
539
|
+
min_confidence: float = 0, # Setting a small value because htil is not supported for pro code.
|
540
|
+
review_fields: List[str] = []) -> tuple[DocExtNode, type[BaseModel]]:
|
523
541
|
|
524
542
|
if name is None :
|
525
543
|
raise ValueError("name must be provided.")
|
@@ -544,7 +562,9 @@ class Flow(Node):
|
|
544
562
|
output_schema_object = output_schema_obj,
|
545
563
|
config=doc_ext_config,
|
546
564
|
version=version,
|
547
|
-
enable_hw=enable_hw
|
565
|
+
enable_hw=enable_hw,
|
566
|
+
min_confidence=min_confidence,
|
567
|
+
review_fields=review_fields
|
548
568
|
)
|
549
569
|
node = DocExtNode(spec=task_spec)
|
550
570
|
|
@@ -609,7 +629,8 @@ class Flow(Node):
|
|
609
629
|
input_map: DataMap = None,
|
610
630
|
document_structure: bool = False,
|
611
631
|
kvp_schemas: list[DocProcKVPSchema] = None,
|
612
|
-
enable_hw: bool = False
|
632
|
+
enable_hw: bool = False,
|
633
|
+
kvp_model_name: str | None = None) -> DocProcNode:
|
613
634
|
|
614
635
|
if name is None :
|
615
636
|
raise ValueError("name must be provided.")
|
@@ -635,7 +656,8 @@ class Flow(Node):
|
|
635
656
|
document_structure=document_structure,
|
636
657
|
plain_text_reading_order=plain_text_reading_order,
|
637
658
|
enable_hw=enable_hw,
|
638
|
-
kvp_schemas=kvp_schemas
|
659
|
+
kvp_schemas=kvp_schemas,
|
660
|
+
kvp_model_name=kvp_model_name
|
639
661
|
)
|
640
662
|
|
641
663
|
node = DocProcNode(spec=task_spec)
|
@@ -1201,7 +1223,7 @@ class CompiledFlow(BaseModel):
|
|
1201
1223
|
dumped = self.flow.to_json()
|
1202
1224
|
with open(file, 'w') as f:
|
1203
1225
|
if file.endswith(".yaml") or file.endswith(".yml"):
|
1204
|
-
yaml.dump(dumped, f)
|
1226
|
+
yaml.dump(dumped, f, allow_unicode=True)
|
1205
1227
|
elif file.endswith(".json"):
|
1206
1228
|
json.dump(dumped, f, indent=2)
|
1207
1229
|
else:
|
@@ -1223,7 +1245,9 @@ class FlowFactory(BaseModel):
|
|
1223
1245
|
initiators: Sequence[str]|None=None,
|
1224
1246
|
input_schema: type[BaseModel]|None=None,
|
1225
1247
|
output_schema: type[BaseModel]|None=None,
|
1226
|
-
schedulable: bool=False
|
1248
|
+
schedulable: bool=False,
|
1249
|
+
llm_model: str|ListVirtualModel|None=None,
|
1250
|
+
agent_conversation_memory_turns_limit: int|None = None) -> Flow:
|
1227
1251
|
if isinstance(name, Callable):
|
1228
1252
|
flow_spec = getattr(name, "__flow_spec__", None)
|
1229
1253
|
if not flow_spec:
|
@@ -1248,7 +1272,7 @@ class FlowFactory(BaseModel):
|
|
1248
1272
|
schedulable=schedulable,
|
1249
1273
|
)
|
1250
1274
|
|
1251
|
-
return Flow(spec = flow_spec)
|
1275
|
+
return Flow(spec = flow_spec, llm_model=llm_model, agent_conversation_memory_turns_limit=agent_conversation_memory_turns_limit)
|
1252
1276
|
|
1253
1277
|
|
1254
1278
|
class FlowControl(Node):
|
@@ -23,7 +23,7 @@ class Node(BaseModel):
|
|
23
23
|
exclude_unset=True, exclude_none=True, by_alias=True)
|
24
24
|
with open(file, 'w', encoding="utf-8") as f:
|
25
25
|
if file.endswith('.yaml') or file.endswith('.yml'):
|
26
|
-
yaml.dump(dumped, f)
|
26
|
+
yaml.dump(dumped, f, allow_unicode=True)
|
27
27
|
elif file.endswith('.json'):
|
28
28
|
json.dump(dumped, f, indent=2)
|
29
29
|
else:
|
@@ -271,6 +271,8 @@ class DocClassifierSpec(DocProcCommonNodeSpec):
|
|
271
271
|
class DocExtSpec(DocProcCommonNodeSpec):
|
272
272
|
version : str = Field(description="A version of the spec")
|
273
273
|
config : DocExtConfig
|
274
|
+
min_confidence: float = Field(description="The minimal confidence acceptable for an extracted field value", default=0.0,le=1.0, ge=0.0 ,title="Minimum Confidence")
|
275
|
+
review_fields: List[str] = Field(description="The fields that require user to review", default=[])
|
274
276
|
|
275
277
|
def __init__(self, **data):
|
276
278
|
super().__init__(**data)
|
@@ -281,6 +283,8 @@ class DocExtSpec(DocProcCommonNodeSpec):
|
|
281
283
|
model_spec["version"] = self.version
|
282
284
|
model_spec["config"] = self.config.model_dump()
|
283
285
|
model_spec["task"] = DocProcTask.custom_field_extraction
|
286
|
+
model_spec["min_confidence"] = self.min_confidence
|
287
|
+
model_spec["review_fields"] = self.review_fields
|
284
288
|
return model_spec
|
285
289
|
|
286
290
|
class DocProcField(BaseModel):
|
@@ -337,6 +341,11 @@ class DocProcSpec(DocProcCommonNodeSpec):
|
|
337
341
|
title='KVP schemas',
|
338
342
|
description="Optional list of key-value pair schemas to use for extraction.",
|
339
343
|
default=None)
|
344
|
+
kvp_model_name: str | None = Field(
|
345
|
+
title='KVP Model Name',
|
346
|
+
description="The LLM model to be used for key-value pair extraction",
|
347
|
+
default=None
|
348
|
+
)
|
340
349
|
plain_text_reading_order : PlainTextReadingOrder = Field(default=PlainTextReadingOrder.block_structure)
|
341
350
|
document_structure: bool = Field(default=False,description="Requests the entire document structure computed by WDU to be returned")
|
342
351
|
|
@@ -352,6 +361,8 @@ class DocProcSpec(DocProcCommonNodeSpec):
|
|
352
361
|
model_spec["plain_text_reading_order"] = self.plain_text_reading_order
|
353
362
|
if self.kvp_schemas is not None:
|
354
363
|
model_spec["kvp_schemas"] = self.kvp_schemas
|
364
|
+
if self.kvp_model_name is not None:
|
365
|
+
model_spec["kvp_model_name"] = self.kvp_model_name
|
355
366
|
return model_spec
|
356
367
|
|
357
368
|
class StartNodeSpec(NodeSpec):
|
@@ -905,8 +916,7 @@ class UserFlowSpec(FlowSpec):
|
|
905
916
|
class ForeachPolicy(Enum):
|
906
917
|
|
907
918
|
SEQUENTIAL = 1
|
908
|
-
|
909
|
-
# PARALLEL = 2
|
919
|
+
PARALLEL = 2
|
910
920
|
|
911
921
|
class ForeachSpec(FlowSpec):
|
912
922
|
|
@@ -923,7 +933,7 @@ class ForeachSpec(FlowSpec):
|
|
923
933
|
if isinstance(self.item_schema, JsonSchemaObject):
|
924
934
|
my_dict["item_schema"] = _to_json_from_json_schema(self.item_schema)
|
925
935
|
else:
|
926
|
-
my_dict["item_schema"] = self.item_schema.model_dump(exclude_defaults=True, exclude_none=True, exclude_unset=True)
|
936
|
+
my_dict["item_schema"] = self.item_schema.model_dump(exclude_defaults=True, exclude_none=True, exclude_unset=True, by_alias=True)
|
927
937
|
|
928
938
|
my_dict["foreach_policy"] = self.foreach_policy.name
|
929
939
|
return my_dict
|
@@ -1312,6 +1322,11 @@ class DocProcInput(DocumentProcessingCommonInput):
|
|
1312
1322
|
title='KVP schemas',
|
1313
1323
|
description="Optional list of key-value pair schemas to use for extraction.",
|
1314
1324
|
default=None)
|
1325
|
+
kvp_model_name: str | None = Field(
|
1326
|
+
title='KVP Model Name',
|
1327
|
+
description="The LLM model to be used for key-value pair extraction",
|
1328
|
+
default=None
|
1329
|
+
)
|
1315
1330
|
|
1316
1331
|
class TextExtractionResponse(BaseModel):
|
1317
1332
|
'''
|