ibm-watsonx-orchestrate 1.11.1__py3-none-any.whl → 1.12.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 (52) hide show
  1. ibm_watsonx_orchestrate/__init__.py +1 -1
  2. ibm_watsonx_orchestrate/agent_builder/agents/types.py +22 -5
  3. ibm_watsonx_orchestrate/agent_builder/connections/connections.py +3 -3
  4. ibm_watsonx_orchestrate/agent_builder/connections/types.py +14 -0
  5. ibm_watsonx_orchestrate/agent_builder/models/types.py +1 -0
  6. ibm_watsonx_orchestrate/agent_builder/toolkits/base_toolkit.py +1 -1
  7. ibm_watsonx_orchestrate/agent_builder/tools/__init__.py +1 -0
  8. ibm_watsonx_orchestrate/agent_builder/tools/base_tool.py +1 -1
  9. ibm_watsonx_orchestrate/agent_builder/tools/langflow_tool.py +184 -0
  10. ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +9 -3
  11. ibm_watsonx_orchestrate/agent_builder/tools/types.py +20 -2
  12. ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +19 -6
  13. ibm_watsonx_orchestrate/cli/commands/connections/connections_command.py +18 -0
  14. ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +114 -0
  15. ibm_watsonx_orchestrate/cli/commands/copilot/copilot_controller.py +2 -6
  16. ibm_watsonx_orchestrate/cli/commands/copilot/copilot_server_controller.py +24 -91
  17. ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_command.py +52 -2
  18. ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_controller.py +1 -1
  19. ibm_watsonx_orchestrate/cli/commands/models/model_provider_mapper.py +23 -4
  20. ibm_watsonx_orchestrate/cli/commands/models/models_controller.py +3 -3
  21. ibm_watsonx_orchestrate/cli/commands/partners/offering/partners_offering_command.py +56 -0
  22. ibm_watsonx_orchestrate/cli/commands/partners/offering/partners_offering_controller.py +475 -0
  23. ibm_watsonx_orchestrate/cli/commands/partners/offering/types.py +99 -0
  24. ibm_watsonx_orchestrate/cli/commands/partners/partners_command.py +12 -0
  25. ibm_watsonx_orchestrate/cli/commands/partners/partners_controller.py +0 -0
  26. ibm_watsonx_orchestrate/cli/commands/server/server_command.py +124 -637
  27. ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_command.py +2 -2
  28. ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_controller.py +2 -2
  29. ibm_watsonx_orchestrate/cli/commands/tools/tools_command.py +2 -3
  30. ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +233 -44
  31. ibm_watsonx_orchestrate/cli/main.py +2 -0
  32. ibm_watsonx_orchestrate/client/connections/connections_client.py +4 -1
  33. ibm_watsonx_orchestrate/client/tools/tempus_client.py +3 -0
  34. ibm_watsonx_orchestrate/client/tools/tool_client.py +5 -2
  35. ibm_watsonx_orchestrate/client/utils.py +31 -1
  36. ibm_watsonx_orchestrate/docker/compose-lite.yml +58 -7
  37. ibm_watsonx_orchestrate/docker/default.env +20 -17
  38. ibm_watsonx_orchestrate/flow_builder/flows/decorators.py +10 -2
  39. ibm_watsonx_orchestrate/flow_builder/flows/flow.py +71 -9
  40. ibm_watsonx_orchestrate/flow_builder/node.py +14 -2
  41. ibm_watsonx_orchestrate/flow_builder/types.py +36 -3
  42. ibm_watsonx_orchestrate/langflow/__init__.py +0 -0
  43. ibm_watsonx_orchestrate/langflow/langflow_utils.py +195 -0
  44. ibm_watsonx_orchestrate/langflow/lfx_deps.py +84 -0
  45. ibm_watsonx_orchestrate/utils/docker_utils.py +280 -0
  46. ibm_watsonx_orchestrate/utils/environment.py +369 -0
  47. ibm_watsonx_orchestrate/utils/utils.py +7 -3
  48. {ibm_watsonx_orchestrate-1.11.1.dist-info → ibm_watsonx_orchestrate-1.12.0.dist-info}/METADATA +2 -2
  49. {ibm_watsonx_orchestrate-1.11.1.dist-info → ibm_watsonx_orchestrate-1.12.0.dist-info}/RECORD +52 -41
  50. {ibm_watsonx_orchestrate-1.11.1.dist-info → ibm_watsonx_orchestrate-1.12.0.dist-info}/WHEEL +0 -0
  51. {ibm_watsonx_orchestrate-1.11.1.dist-info → ibm_watsonx_orchestrate-1.12.0.dist-info}/entry_points.txt +0 -0
  52. {ibm_watsonx_orchestrate-1.11.1.dist-info → ibm_watsonx_orchestrate-1.12.0.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: https://wxo-doc-processing-cache:8080
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: "false"
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:-https://wxo-doc-processing-cache:8080}
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: https://wxo-doc-processing-cache:8080
915
+ IBM_DPS_CACHE_SERVICE: http://wxo-doc-processing-cache:8080
867
916
  profiles:
868
917
  - docproc
869
918
  depends_on:
@@ -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 https://localhost:8080/ping"]
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=09-09-2025-cff47f4
61
+ SERVER_TAG=24-09-2025-17d7c67
62
62
  SERVER_REGISTRY=
63
63
 
64
- WORKER_TAG=09-09-2025-cff47f4
64
+ WORKER_TAG=24-09-2025-17d7c67
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=29-07-2025
70
+ AGENT_GATEWAY_TAG=19-10-2025-e48ad3a
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=04-09-2025-48c39
77
- AMDDBTAG=04-09-2025-48c39
78
- ARM64DBTAG=04-09-2025-48c39
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=29-08-2025
81
+ UITAG=22-09-2025-e35f498
82
82
 
83
83
  CM_REGISTRY=
84
- CM_TAG=24-07-2025
84
+ CM_TAG=16-09-2025-e33b344
85
85
 
86
- TRM_TAG=19-08-2025-fe105eb0b950ff304f712a1a5b9fa3cba92d09da
86
+ CONNECTIONS_UI_REGISTRY=
87
+ CONNECTIONS_UI_TAG=15-09-2025-98aa9da
88
+
89
+ TRM_TAG=16-09-2025-cb6b9df
87
90
  TRM_REGISTRY=
88
91
 
89
- TR_TAG=25-08-2025-58ae475
92
+ TR_TAG=24-09-2025-a515038
90
93
  TR_REGISTRY=
91
94
 
92
- BUILDER_TAG=27-08-2025-7432aca
95
+ BUILDER_TAG=24-09-2025-f9b68d8
93
96
  BUILDER_REGISTRY=
94
97
 
95
- FLOW_RUNTIME_TAG=01-09-2025-8e6fcfc
98
+ FLOW_RUNTIME_TAG=22-09-2025-0bd3f58
96
99
  FLOW_RUMTIME_REGISTRY=
97
100
 
98
101
 
@@ -108,7 +111,7 @@ SOCKET_HANDLER_REGISTRY=
108
111
  CPE_TAG=29-08-2025-e612bea
109
112
  CPE_REGISTRY=
110
113
 
111
- VOICE_CONTROLLER_TAG=12-08-2025
114
+ VOICE_CONTROLLER_TAG=12-09-2025-0e04772
112
115
  VOICE_CONTROLLER_REGISTRY=
113
116
 
114
117
  LANGFLOW_TAG=
@@ -118,10 +121,10 @@ LANGFLOW_IMAGE=
118
121
  WDU_TAG=2.7.0
119
122
  WDU_REGISTRY=
120
123
 
121
- DOCPROC_DPS_TAG=20250904-181617-287-1ca2bf1
122
- DOCPROC_LLMSERVICE_TAG=20250904-main-136-b94360e
123
- DOCPROC_CACHE_TAG=20250902-master-83-748d456
124
- DOCPROC_DPI_TAG=20250905-092707-286-8c6b8f92
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
@@ -33,8 +35,11 @@ def flow(*args,
33
35
  description: str|None=None,
34
36
  input_schema: type[BaseModel] | None = None,
35
37
  output_schema: type[BaseModel] | None = None,
38
+ private_schema: type[BaseModel] | None = None,
36
39
  initiators: Sequence[str] = (),
37
- schedulable: bool = False):
40
+ schedulable: bool = False,
41
+ llm_model: str|ListVirtualModel|None=None,
42
+ agent_conversation_memory_turns_limit: int|None=None):
38
43
  """Decorator to mark a function as a flow model builder."""
39
44
 
40
45
  def decorator(func: Callable):
@@ -59,8 +64,11 @@ def flow(*args,
59
64
  description = node_spec.description,
60
65
  input_schema = input_schema,
61
66
  output_schema = output_schema,
67
+ private_schema = private_schema,
62
68
  initiators = initiators,
63
- schedulable = schedulable)
69
+ schedulable = schedulable,
70
+ llm_model = llm_model,
71
+ agent_conversation_memory_turns_limit = agent_conversation_memory_turns_limit)
64
72
 
65
73
  # logger.info("Creating flow model: %s", a_model.spec.name)
66
74
 
@@ -21,17 +21,18 @@ 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
27
28
  from ..types import (
28
- DocProcKVPSchema, Assignment, Conditions, EndNodeSpec, Expression, ForeachPolicy, ForeachSpec, LoopSpec, BranchNodeSpec, MatchPolicy, NodeIdCondition, PlainTextReadingOrder, PromptExample, PromptLLMParameters, PromptNodeSpec, TimerNodeSpec,
29
+ DocProcKVPSchema, Assignment, Conditions, EndNodeSpec, Expression, ForeachPolicy, ForeachSpec, LoopSpec, BranchNodeSpec, MatchPolicy, NodeIdCondition, PlainTextReadingOrder, PromptExample, PromptLLMParameters, PromptNodeSpec, ScriptNodeSpec, TimerNodeSpec,
29
30
  StartNodeSpec, ToolSpec, JsonSchemaObject, ToolRequestBody, ToolResponseBody, UserFieldKind, UserFieldOption, UserFlowSpec, UserNodeSpec, WaitPolicy,
30
31
  DocProcSpec, TextExtractionResponse, DocProcInput, DecisionsNodeSpec, DecisionsRule, DocExtSpec, File, DocumentClassificationResponse, DocClassifierSpec, DocumentProcessingCommonInput
31
32
  )
32
33
  from .constants import CURRENT_USER, START, END, ANY_USER
33
34
  from ..node import (
34
- EndNode, Node, PromptNode, StartNode, UserNode, AgentNode, DataMap, ToolNode, DocProcNode, DecisionsNode, DocExtNode, DocClassifierNode
35
+ EndNode, Node, PromptNode, ScriptNode, StartNode, UserNode, AgentNode, DataMap, ToolNode, DocProcNode, DecisionsNode, DocExtNode, DocClassifierNode
35
36
  )
36
37
  from ..types import (
37
38
  AgentNodeSpec, extract_node_spec, FlowContext, FlowEventType, FlowEvent, FlowSpec,
@@ -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()
@@ -341,6 +357,41 @@ class Flow(Node):
341
357
 
342
358
  node = self._add_node(node)
343
359
  return cast(ToolNode, node)
360
+
361
+
362
+ def script(
363
+ self,
364
+ script: str | None = "",
365
+ name: str | None = None,
366
+ display_name: str | None = None,
367
+ description: str | None = None,
368
+ input_schema: type[BaseModel] | None = None,
369
+ output_schema: type[BaseModel] | None = None,
370
+ input_map: DataMap = None
371
+ ) -> ScriptNode:
372
+ '''create a script node in the flow'''
373
+ name = name if name is not None and name != "" else ""
374
+
375
+ input_schema_obj = _get_json_schema_obj("input", input_schema)
376
+ output_schema_obj = _get_json_schema_obj("output", output_schema)
377
+
378
+ script_node_spec = ScriptNodeSpec(
379
+ name = name,
380
+ display_name = display_name,
381
+ description = description,
382
+ input_schema= _get_tool_request_body(input_schema_obj),
383
+ output_schema= _get_tool_response_body(output_schema_obj),
384
+ output_schema_object = output_schema_obj,
385
+ fn = script)
386
+
387
+ node = ScriptNode(spec=script_node_spec)
388
+
389
+ # setup input and output map
390
+ if input_map:
391
+ node.input_map = self._get_data_map(input_map)
392
+
393
+ node = self._add_node(node)
394
+ return cast(ScriptNode, node)
344
395
 
345
396
 
346
397
  def _add_node(self, node: Node) -> Node:
@@ -519,7 +570,9 @@ class Flow(Node):
519
570
  fields: type[BaseModel]| None = None,
520
571
  description: str | None = None,
521
572
  input_map: DataMap = None,
522
- enable_hw: bool = False) -> tuple[DocExtNode, type[BaseModel]]:
573
+ enable_hw: bool = False,
574
+ min_confidence: float = 0, # Setting a small value because htil is not supported for pro code.
575
+ review_fields: List[str] = []) -> tuple[DocExtNode, type[BaseModel]]:
523
576
 
524
577
  if name is None :
525
578
  raise ValueError("name must be provided.")
@@ -544,7 +597,9 @@ class Flow(Node):
544
597
  output_schema_object = output_schema_obj,
545
598
  config=doc_ext_config,
546
599
  version=version,
547
- enable_hw=enable_hw
600
+ enable_hw=enable_hw,
601
+ min_confidence=min_confidence,
602
+ review_fields=review_fields
548
603
  )
549
604
  node = DocExtNode(spec=task_spec)
550
605
 
@@ -609,7 +664,8 @@ class Flow(Node):
609
664
  input_map: DataMap = None,
610
665
  document_structure: bool = False,
611
666
  kvp_schemas: list[DocProcKVPSchema] = None,
612
- enable_hw: bool = False) -> DocProcNode:
667
+ enable_hw: bool = False,
668
+ kvp_model_name: str | None = None) -> DocProcNode:
613
669
 
614
670
  if name is None :
615
671
  raise ValueError("name must be provided.")
@@ -635,7 +691,8 @@ class Flow(Node):
635
691
  document_structure=document_structure,
636
692
  plain_text_reading_order=plain_text_reading_order,
637
693
  enable_hw=enable_hw,
638
- kvp_schemas=kvp_schemas
694
+ kvp_schemas=kvp_schemas,
695
+ kvp_model_name=kvp_model_name
639
696
  )
640
697
 
641
698
  node = DocProcNode(spec=task_spec)
@@ -1201,7 +1258,7 @@ class CompiledFlow(BaseModel):
1201
1258
  dumped = self.flow.to_json()
1202
1259
  with open(file, 'w') as f:
1203
1260
  if file.endswith(".yaml") or file.endswith(".yml"):
1204
- yaml.dump(dumped, f)
1261
+ yaml.dump(dumped, f, allow_unicode=True)
1205
1262
  elif file.endswith(".json"):
1206
1263
  json.dump(dumped, f, indent=2)
1207
1264
  else:
@@ -1223,7 +1280,10 @@ class FlowFactory(BaseModel):
1223
1280
  initiators: Sequence[str]|None=None,
1224
1281
  input_schema: type[BaseModel]|None=None,
1225
1282
  output_schema: type[BaseModel]|None=None,
1226
- schedulable: bool=False) -> Flow:
1283
+ private_schema: type[BaseModel]|None=None,
1284
+ schedulable: bool=False,
1285
+ llm_model: str|ListVirtualModel|None=None,
1286
+ agent_conversation_memory_turns_limit: int|None = None) -> Flow:
1227
1287
  if isinstance(name, Callable):
1228
1288
  flow_spec = getattr(name, "__flow_spec__", None)
1229
1289
  if not flow_spec:
@@ -1233,6 +1293,7 @@ class FlowFactory(BaseModel):
1233
1293
  input_schema_obj = _get_json_schema_obj(parameter_name = "input", type_def = input_schema)
1234
1294
  # create input spec
1235
1295
  output_schema_obj = _get_json_schema_obj("output", output_schema)
1296
+ private_schema_obj = _get_json_schema_obj("private", private_schema)
1236
1297
  if initiators is None:
1237
1298
  initiators = []
1238
1299
 
@@ -1244,11 +1305,12 @@ class FlowFactory(BaseModel):
1244
1305
  initiators=initiators,
1245
1306
  input_schema=_get_tool_request_body(input_schema_obj),
1246
1307
  output_schema=_get_tool_response_body(output_schema_obj),
1308
+ private_schema = private_schema_obj,
1247
1309
  output_schema_object = output_schema_obj,
1248
1310
  schedulable=schedulable,
1249
1311
  )
1250
1312
 
1251
- return Flow(spec = flow_spec)
1313
+ return Flow(spec = flow_spec, llm_model=llm_model, agent_conversation_memory_turns_limit=agent_conversation_memory_turns_limit)
1252
1314
 
1253
1315
 
1254
1316
  class FlowControl(Node):
@@ -6,7 +6,7 @@ import yaml
6
6
  from pydantic import BaseModel, Field, SerializeAsAny, create_model
7
7
  from enum import Enum
8
8
 
9
- from .types import Assignment, DocExtConfigField, EndNodeSpec, NodeSpec, AgentNodeSpec, PromptNodeSpec, TimerNodeSpec, StartNodeSpec, ToolNodeSpec, UserFieldKind, UserFieldOption, UserNodeSpec, DocProcSpec, \
9
+ from .types import Assignment, DocExtConfigField, EndNodeSpec, NodeSpec, AgentNodeSpec, PromptNodeSpec, ScriptNodeSpec, TimerNodeSpec, StartNodeSpec, ToolNodeSpec, UserFieldKind, UserFieldOption, UserNodeSpec, DocProcSpec, \
10
10
  DocExtSpec, DocExtConfig, DocClassifierSpec, DecisionsNodeSpec, DocClassifierConfig
11
11
 
12
12
  from .data_map import DataMap
@@ -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:
@@ -132,6 +132,18 @@ class ToolNode(Node):
132
132
 
133
133
  def get_spec(self) -> ToolNodeSpec:
134
134
  return cast(ToolNodeSpec, self.spec)
135
+
136
+
137
+ class ScriptNode(Node):
138
+ def __repr__(self):
139
+ return f"ScriptNode(name='{self.spec.name}', description='{self.spec.description}')"
140
+
141
+ def get_spec(self) -> ScriptNodeSpec:
142
+ return cast(ScriptNodeSpec, self.spec)
143
+
144
+ def updateScript(self, script: str):
145
+ '''Update the script of a script node'''
146
+ self.spec.fn = script
135
147
 
136
148
  class UserNode(Node):
137
149
  def __repr__(self):
@@ -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):
@@ -378,6 +389,19 @@ class ToolNodeSpec(NodeSpec):
378
389
  else:
379
390
  model_spec["tool"] = self.tool
380
391
  return model_spec
392
+
393
+ class ScriptNodeSpec(NodeSpec):
394
+ fn: str = Field(default = None, description="the script to execute")
395
+
396
+ def __init__(self, **data):
397
+ super().__init__(**data)
398
+ self.kind = "script"
399
+
400
+ def to_json(self) -> dict[str, Any]:
401
+ model_spec = super().to_json()
402
+ if self.fn:
403
+ model_spec["fn"] = self.fn
404
+ return model_spec
381
405
 
382
406
 
383
407
  class UserFieldValue(BaseModel):
@@ -860,6 +884,9 @@ class FlowSpec(NodeSpec):
860
884
  initiators: Sequence[str] = [ANY_USER]
861
885
  schedulable: bool = False
862
886
 
887
+ # flow can have private schema
888
+ private_schema: JsonSchemaObject | SchemaRef | None = None
889
+
863
890
  def __init__(self, **kwargs):
864
891
  super().__init__(**kwargs)
865
892
  self.kind = "flow"
@@ -868,6 +895,8 @@ class FlowSpec(NodeSpec):
868
895
  model_spec = super().to_json()
869
896
  if self.initiators:
870
897
  model_spec["initiators"] = self.initiators
898
+ if self.private_schema:
899
+ model_spec["private_schema"] = _to_json_from_json_schema(self.private_schema)
871
900
 
872
901
  model_spec["schedulable"] = self.schedulable
873
902
 
@@ -905,8 +934,7 @@ class UserFlowSpec(FlowSpec):
905
934
  class ForeachPolicy(Enum):
906
935
 
907
936
  SEQUENTIAL = 1
908
- # support only SEQUENTIAL for now
909
- # PARALLEL = 2
937
+ PARALLEL = 2
910
938
 
911
939
  class ForeachSpec(FlowSpec):
912
940
 
@@ -923,7 +951,7 @@ class ForeachSpec(FlowSpec):
923
951
  if isinstance(self.item_schema, JsonSchemaObject):
924
952
  my_dict["item_schema"] = _to_json_from_json_schema(self.item_schema)
925
953
  else:
926
- my_dict["item_schema"] = self.item_schema.model_dump(exclude_defaults=True, exclude_none=True, exclude_unset=True)
954
+ my_dict["item_schema"] = self.item_schema.model_dump(exclude_defaults=True, exclude_none=True, exclude_unset=True, by_alias=True)
927
955
 
928
956
  my_dict["foreach_policy"] = self.foreach_policy.name
929
957
  return my_dict
@@ -1312,6 +1340,11 @@ class DocProcInput(DocumentProcessingCommonInput):
1312
1340
  title='KVP schemas',
1313
1341
  description="Optional list of key-value pair schemas to use for extraction.",
1314
1342
  default=None)
1343
+ kvp_model_name: str | None = Field(
1344
+ title='KVP Model Name',
1345
+ description="The LLM model to be used for key-value pair extraction",
1346
+ default=None
1347
+ )
1315
1348
 
1316
1349
  class TextExtractionResponse(BaseModel):
1317
1350
  '''
File without changes