ibm-watsonx-orchestrate 1.7.0a0__py3-none-any.whl → 1.8.0b0__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 -1
- ibm_watsonx_orchestrate/agent_builder/agents/agent.py +3 -3
- ibm_watsonx_orchestrate/agent_builder/agents/assistant_agent.py +3 -2
- ibm_watsonx_orchestrate/agent_builder/agents/external_agent.py +3 -2
- ibm_watsonx_orchestrate/agent_builder/agents/types.py +26 -9
- ibm_watsonx_orchestrate/agent_builder/agents/webchat_customizations/prompts.py +1 -0
- ibm_watsonx_orchestrate/agent_builder/connections/connections.py +25 -10
- ibm_watsonx_orchestrate/agent_builder/connections/types.py +5 -9
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base_requests.py +1 -22
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +1 -17
- ibm_watsonx_orchestrate/agent_builder/tools/base_tool.py +2 -1
- ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +14 -13
- ibm_watsonx_orchestrate/agent_builder/tools/python_tool.py +136 -92
- ibm_watsonx_orchestrate/agent_builder/tools/types.py +10 -9
- ibm_watsonx_orchestrate/cli/commands/agents/agents_command.py +7 -7
- ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +35 -7
- ibm_watsonx_orchestrate/cli/commands/channels/webchat/channels_webchat_controller.py +33 -23
- ibm_watsonx_orchestrate/cli/commands/chat/chat_command.py +2 -0
- ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +6 -4
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_command.py +65 -0
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_controller.py +293 -0
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_server_controller.py +154 -0
- ibm_watsonx_orchestrate/cli/commands/environment/environment_controller.py +6 -6
- ibm_watsonx_orchestrate/cli/commands/environment/types.py +2 -0
- ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_command.py +118 -30
- ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_controller.py +22 -9
- ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_command.py +0 -18
- ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_controller.py +33 -19
- ibm_watsonx_orchestrate/cli/commands/models/models_command.py +1 -1
- ibm_watsonx_orchestrate/cli/commands/server/server_command.py +66 -9
- ibm_watsonx_orchestrate/cli/commands/toolkit/toolkit_command.py +1 -1
- ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +93 -14
- ibm_watsonx_orchestrate/cli/config.py +3 -3
- ibm_watsonx_orchestrate/cli/init_helper.py +10 -1
- ibm_watsonx_orchestrate/cli/main.py +5 -0
- ibm_watsonx_orchestrate/client/base_api_client.py +12 -0
- ibm_watsonx_orchestrate/client/copilot/cpe/copilot_cpe_client.py +66 -0
- ibm_watsonx_orchestrate/client/knowledge_bases/knowledge_base_client.py +1 -1
- ibm_watsonx_orchestrate/client/local_service_instance.py +3 -1
- ibm_watsonx_orchestrate/client/service_instance.py +33 -7
- ibm_watsonx_orchestrate/client/utils.py +48 -9
- ibm_watsonx_orchestrate/docker/compose-lite.yml +16 -4
- ibm_watsonx_orchestrate/docker/default.env +25 -15
- ibm_watsonx_orchestrate/flow_builder/flows/__init__.py +3 -1
- ibm_watsonx_orchestrate/flow_builder/flows/decorators.py +4 -2
- ibm_watsonx_orchestrate/flow_builder/flows/events.py +10 -9
- ibm_watsonx_orchestrate/flow_builder/flows/flow.py +91 -20
- ibm_watsonx_orchestrate/flow_builder/node.py +12 -1
- ibm_watsonx_orchestrate/flow_builder/types.py +169 -16
- ibm_watsonx_orchestrate/flow_builder/utils.py +121 -6
- ibm_watsonx_orchestrate/utils/exceptions.py +23 -0
- {ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/METADATA +5 -5
- {ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/RECORD +56 -52
- ibm_watsonx_orchestrate/flow_builder/resources/flow_status.openapi.yml +0 -66
- {ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/WHEEL +0 -0
- {ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/entry_points.txt +0 -0
- {ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
|
-
from enum import Enum
|
2
|
+
from enum import Enum, StrEnum, auto
|
3
3
|
import inspect
|
4
4
|
import logging
|
5
5
|
from typing import (
|
@@ -116,7 +116,7 @@ def _to_json_from_output_schema(schema: Union[ToolResponseBody, SchemaRef]) -> d
|
|
116
116
|
return model_spec
|
117
117
|
|
118
118
|
class NodeSpec(BaseModel):
|
119
|
-
kind: Literal["node", "tool", "user", "agent", "flow", "start", "decisions", "prompt", "branch", "wait", "foreach", "loop", "userflow", "end"] = "node"
|
119
|
+
kind: Literal["node", "tool", "user", "agent", "flow", "start", "decisions", "prompt", "branch", "wait", "foreach", "loop", "userflow", "end", "docproc" ] = "node"
|
120
120
|
name: str
|
121
121
|
display_name: str | None = None
|
122
122
|
description: str | None = None
|
@@ -162,6 +162,26 @@ class NodeSpec(BaseModel):
|
|
162
162
|
|
163
163
|
return model_spec
|
164
164
|
|
165
|
+
class DocProcTask(StrEnum):
|
166
|
+
'''
|
167
|
+
Possible names for the Document processing task parameter
|
168
|
+
'''
|
169
|
+
text_extraction = auto()
|
170
|
+
kvp_invoices_extraction = auto()
|
171
|
+
kvp_utility_bills_extraction = auto()
|
172
|
+
|
173
|
+
class DocProcSpec(NodeSpec):
|
174
|
+
task: DocProcTask = Field(description='The document processing operation name', default=DocProcTask.text_extraction)
|
175
|
+
|
176
|
+
def __init__(self, **data):
|
177
|
+
super().__init__(**data)
|
178
|
+
self.kind = "docproc"
|
179
|
+
|
180
|
+
def to_json(self) -> dict[str, Any]:
|
181
|
+
model_spec = super().to_json()
|
182
|
+
model_spec["task"] = self.task
|
183
|
+
return model_spec
|
184
|
+
|
165
185
|
class StartNodeSpec(NodeSpec):
|
166
186
|
def __init__(self, **data):
|
167
187
|
super().__init__(**data)
|
@@ -296,6 +316,8 @@ class UserField(BaseModel):
|
|
296
316
|
description: str | None = None
|
297
317
|
default: Any | None = None
|
298
318
|
option: UserFieldOption | None = None
|
319
|
+
min: Any | None = None,
|
320
|
+
max: Any | None = None,
|
299
321
|
is_list: bool = False
|
300
322
|
custom: dict[str, Any] | None = None
|
301
323
|
widget: str | None = None
|
@@ -314,6 +336,10 @@ class UserField(BaseModel):
|
|
314
336
|
model_spec["description"] = self.description
|
315
337
|
if self.default:
|
316
338
|
model_spec["default"] = self.default
|
339
|
+
if self.min:
|
340
|
+
model_spec["min"] = self.min
|
341
|
+
if self.max:
|
342
|
+
model_spec["min"] = self.max
|
317
343
|
if self.is_list:
|
318
344
|
model_spec["is_list"] = self.is_list
|
319
345
|
if self.option:
|
@@ -356,7 +382,10 @@ class UserNodeSpec(NodeSpec):
|
|
356
382
|
display_name: str | None = None,
|
357
383
|
description: str | None = None,
|
358
384
|
default: Any | None = None,
|
359
|
-
option: list[str] | None = None,
|
385
|
+
option: list[str] | None = None,
|
386
|
+
min: Any | None = None,
|
387
|
+
max: Any | None = None,
|
388
|
+
is_list: bool = False,
|
360
389
|
custom: dict[str, Any] | None = None,
|
361
390
|
widget: str | None = None):
|
362
391
|
userfield = UserField(name=name,
|
@@ -366,6 +395,8 @@ class UserNodeSpec(NodeSpec):
|
|
366
395
|
description=description,
|
367
396
|
default=default,
|
368
397
|
option=option,
|
398
|
+
min=min,
|
399
|
+
max=max,
|
369
400
|
is_list=is_list,
|
370
401
|
custom=custom,
|
371
402
|
widget=widget)
|
@@ -402,6 +433,8 @@ class UserNodeSpec(NodeSpec):
|
|
402
433
|
default=prop_schema.default,
|
403
434
|
option=self.setup_field_options(prop_schema.title, prop_schema.enum),
|
404
435
|
is_list=prop_schema.type == "array",
|
436
|
+
min=prop_schema.minimum,
|
437
|
+
max=prop_schema.maximum,
|
405
438
|
custom=prop_schema.model_extra))
|
406
439
|
|
407
440
|
def setup_field_options(self, name: str, enums: List[str]) -> UserFieldOption:
|
@@ -415,6 +448,7 @@ class UserNodeSpec(NodeSpec):
|
|
415
448
|
|
416
449
|
class AgentNodeSpec(ToolNodeSpec):
|
417
450
|
message: str | None = Field(default=None, description="The instructions for the task.")
|
451
|
+
title: str | None = Field(default=None, description="The title of the message.")
|
418
452
|
guidelines: str | None = Field(default=None, description="The guidelines for the task.")
|
419
453
|
agent: str
|
420
454
|
|
@@ -430,6 +464,8 @@ class AgentNodeSpec(ToolNodeSpec):
|
|
430
464
|
model_spec["guidelines"] = self.guidelines
|
431
465
|
if self.agent:
|
432
466
|
model_spec["agent"] = self.agent
|
467
|
+
if self.title:
|
468
|
+
model_spec["title"] = self.title
|
433
469
|
return model_spec
|
434
470
|
|
435
471
|
class PromptLLMParameters(BaseModel):
|
@@ -553,10 +589,9 @@ class WaitNodeSpec(FlowControlNodeSpec):
|
|
553
589
|
return my_dict
|
554
590
|
|
555
591
|
class FlowSpec(NodeSpec):
|
556
|
-
|
557
|
-
|
558
592
|
# who can initiate the flow
|
559
593
|
initiators: Sequence[str] = [ANY_USER]
|
594
|
+
schedulable: bool = False
|
560
595
|
|
561
596
|
def __init__(self, **kwargs):
|
562
597
|
super().__init__(**kwargs)
|
@@ -566,6 +601,8 @@ class FlowSpec(NodeSpec):
|
|
566
601
|
model_spec = super().to_json()
|
567
602
|
if self.initiators:
|
568
603
|
model_spec["initiators"] = self.initiators
|
604
|
+
|
605
|
+
model_spec["schedulable"] = self.schedulable
|
569
606
|
|
570
607
|
return model_spec
|
571
608
|
|
@@ -631,11 +668,11 @@ class TaskData(NamedTuple):
|
|
631
668
|
|
632
669
|
class TaskEventType(Enum):
|
633
670
|
|
634
|
-
ON_TASK_WAIT = "on_task_wait" # the task is waiting for inputs before proceeding
|
635
|
-
ON_TASK_START = "on_task_start"
|
636
|
-
ON_TASK_END = "on_task_end"
|
637
|
-
ON_TASK_STREAM = "on_task_stream"
|
638
|
-
ON_TASK_ERROR = "on_task_error"
|
671
|
+
ON_TASK_WAIT = "task:on_task_wait" # the task is waiting for inputs before proceeding
|
672
|
+
ON_TASK_START = "task:on_task_start"
|
673
|
+
ON_TASK_END = "task:on_task_end"
|
674
|
+
ON_TASK_STREAM = "task:on_task_stream"
|
675
|
+
ON_TASK_ERROR = "task:on_task_error"
|
639
676
|
|
640
677
|
class FlowData(BaseModel):
|
641
678
|
'''This class represents the data that is passed between tasks in a flow.'''
|
@@ -667,9 +704,9 @@ class FlowContext(BaseModel):
|
|
667
704
|
|
668
705
|
class FlowEventType(Enum):
|
669
706
|
|
670
|
-
ON_FLOW_START = "on_flow_start"
|
671
|
-
ON_FLOW_END = "on_flow_end"
|
672
|
-
ON_FLOW_ERROR = "on_flow_error"
|
707
|
+
ON_FLOW_START = "flow:on_flow_start"
|
708
|
+
ON_FLOW_END = "flow:on_flow_end"
|
709
|
+
ON_FLOW_ERROR = "flow:on_flow_error"
|
673
710
|
|
674
711
|
|
675
712
|
@dataclass
|
@@ -691,9 +728,125 @@ class Assignment(BaseModel):
|
|
691
728
|
e.g. "node.input.name" or "=f'{node.output.name}_{node.output.id}'"
|
692
729
|
|
693
730
|
'''
|
694
|
-
|
695
|
-
|
696
|
-
|
731
|
+
target_variable: str
|
732
|
+
value_expression: str | None = None
|
733
|
+
has_no_value: bool = False
|
734
|
+
default_value: Any | None = None
|
735
|
+
metadata: dict = Field(default_factory=dict[str, Any])
|
736
|
+
|
737
|
+
class LanguageCode(StrEnum):
|
738
|
+
'''
|
739
|
+
The ISO-639 language codes understood by Document Processing functions.
|
740
|
+
A special 'en_hw' code is used to enable an English handwritten model.
|
741
|
+
'''
|
742
|
+
en = auto()
|
743
|
+
fr = auto()
|
744
|
+
en_hw = auto()
|
745
|
+
|
746
|
+
class DocumentContent(BaseModel):
|
747
|
+
'''
|
748
|
+
This class represents the input of a Document processing task.
|
749
|
+
|
750
|
+
Attributes:
|
751
|
+
document_ref (bytes|str): This is either a URL to the location of the document bytes or an ID that we use to resolve the location of the document
|
752
|
+
language (LanguageCode): Optional language code used when processing the input document
|
753
|
+
'''
|
754
|
+
# This is declared as bytes but the runtime will understand if a URL is send in as input.
|
755
|
+
# We need to use bytes here for Chat-with-doc to recognize the input as a Document.
|
756
|
+
document_ref: bytes | str = Field(
|
757
|
+
description="Either an ID or a URL identifying the document to be used.",
|
758
|
+
title='Document reference',
|
759
|
+
default=None,
|
760
|
+
json_schema_extra={"format": "binary"})
|
761
|
+
language: Optional[LanguageCode] = Field(
|
762
|
+
description='Optional language code of the document, defaults to "en"',
|
763
|
+
title='Document language code',
|
764
|
+
default=LanguageCode.en)
|
765
|
+
|
766
|
+
class TextExtraction(BaseModel):
|
767
|
+
'''
|
768
|
+
This class represents the output generated by a "text_extraction" document processing (docproc) operation.
|
769
|
+
Attributes:
|
770
|
+
text (str): the text extracted from the input document.
|
771
|
+
'''
|
772
|
+
text: str = Field(description='The text extracted from the input document', title='Text extraction')
|
773
|
+
|
774
|
+
class TextExtractionResponse(BaseModel):
|
775
|
+
'''
|
776
|
+
The text extraction operation response.
|
777
|
+
Attributes:
|
778
|
+
output (TextExtraction): a wrapper for the text extraction response
|
779
|
+
'''
|
780
|
+
output: TextExtraction = Field(description='The text extraction response')
|
781
|
+
|
782
|
+
class Invoice(BaseModel):
|
783
|
+
'''
|
784
|
+
This class represents the fields extracted by the "kvp_invoices_extraction" document processing (docproc) operation.
|
785
|
+
'''
|
786
|
+
bank_account_number: Optional[str] = Field(title='Bank account number', default=None)
|
787
|
+
bank_name: Optional[str] = Field(title='Bank name', default=None)
|
788
|
+
bill_to_address: Optional[str] = Field(title='Bill-to address', default=None)
|
789
|
+
bill_to_name: Optional[str] = Field(title='Bill-to name', default=None)
|
790
|
+
invoice_date: Optional[str] = Field(title='Invoice date', format='date', default=None)
|
791
|
+
invoice_number: Optional[str] = Field(title='Invoice number', default=None)
|
792
|
+
invoice_total: Optional[float] = Field(title='Invoice total', default=None)
|
793
|
+
payment_due_date: Optional[str] = Field(title='Payment due date', format='date', default=None)
|
794
|
+
payment_terms: Optional[str] = Field(title='Payment terms', default=None)
|
795
|
+
purchase_order_number: Optional[str] = Field(title='Purchase order number', default=None)
|
796
|
+
ship_to_address: Optional[str] = Field(title='Ship-to address', default=None)
|
797
|
+
ship_to_name: Optional[str] = Field(title='Ship-to name', default=None)
|
798
|
+
shipping_amount: Optional[float] = Field(title='Shipping amount', default=None)
|
799
|
+
subtotal: Optional[float] = Field(title='Subtotal', default=None)
|
800
|
+
tax_amount: Optional[float] = Field(title='Tax amount', default=None)
|
801
|
+
tax_rate: Optional[float] = Field(title='Tax rate', default=None)
|
802
|
+
tax_type: Optional[str] = Field(title='Tax type', default=None)
|
803
|
+
vendor_address: Optional[str] = Field(title='Vendor address', default=None)
|
804
|
+
vendor_name: Optional[str] = Field(title='Vendor name', default=None)
|
805
|
+
|
806
|
+
|
807
|
+
class KVPInvoicesExtractionResponse(BaseModel):
|
808
|
+
'''
|
809
|
+
The response of a "kvp_invoices_extraction" document processing (docproc) operation.
|
810
|
+
Attributes:
|
811
|
+
invoice: an object with the fields extracted from the input invoice document
|
812
|
+
'''
|
813
|
+
output: Invoice = Field(
|
814
|
+
title='Invoice',
|
815
|
+
description='The fields extracted from an invoice document'
|
816
|
+
)
|
817
|
+
|
818
|
+
|
819
|
+
class UtilityBill(BaseModel):
|
820
|
+
'''
|
821
|
+
This class represents the fields extracted by the "kvp_utility_bills_extraction" document processing (docproc) operation.
|
822
|
+
'''
|
823
|
+
account_number: Optional[str] = Field(title='Account number', default=None)
|
824
|
+
amount_due: Optional[float] = Field(title='Amount due', default=None)
|
825
|
+
client_number: Optional[str] = Field(title='Client number', default=None)
|
826
|
+
company_name: Optional[str] = Field(title='Company name', default=None)
|
827
|
+
company_address: Optional[str] = Field(title='Company address', default=None)
|
828
|
+
customer_name: Optional[str] = Field(title='Customer name', default=None)
|
829
|
+
customer_address: Optional[str] = Field(title='Customer address', default=None)
|
830
|
+
due_date: Optional[str] = Field(title='Due date', format='date', default=None)
|
831
|
+
payment_received: Optional[float] = Field(title='Payment received', default=None)
|
832
|
+
previous_balance: Optional[float] = Field(title='Previous balance', default=None)
|
833
|
+
service_address: Optional[str] = Field(title='Service address', default=None)
|
834
|
+
statement_date: Optional[str] = Field(title='Statement date', format='date', default=None)
|
835
|
+
|
836
|
+
#class UtilityBillResponse(BaseModel):
|
837
|
+
# field_value: UtilityBill = Field(title='Field value')
|
838
|
+
|
839
|
+
class KVPUtilityBillsExtractionResponse(BaseModel):
|
840
|
+
'''
|
841
|
+
The response of a "kvp_utility_bills_extraction" document processing (docproc) operation.
|
842
|
+
Attributes:
|
843
|
+
utility_bull: an object with the fields extracted from the input utility bill document
|
844
|
+
'''
|
845
|
+
output: UtilityBill = Field(
|
846
|
+
title='Utility bill',
|
847
|
+
description='The fields extracted from a utility bill document'
|
848
|
+
)
|
849
|
+
|
697
850
|
def extract_node_spec(
|
698
851
|
fn: Callable | PythonTool,
|
699
852
|
name: Optional[str] = None,
|
@@ -87,9 +87,15 @@ def _get_tool_request_body(schema_obj: JsonSchemaObject) -> ToolRequestBody:
|
|
87
87
|
return None
|
88
88
|
|
89
89
|
if isinstance(schema_obj, JsonSchemaObject):
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
if schema_obj.type == "object":
|
91
|
+
request_obj = ToolRequestBody(type='object', properties=schema_obj.properties, required=schema_obj.required)
|
92
|
+
if schema_obj.model_extra:
|
93
|
+
request_obj.__pydantic_extra__ = schema_obj.model_extra
|
94
|
+
else: # we need to wrap a simple type with an object
|
95
|
+
request_obj = ToolRequestBody(type='object', properties={}, required=[])
|
96
|
+
request_obj.properties["data"] = schema_obj
|
97
|
+
if schema_obj.model_extra:
|
98
|
+
request_obj.__pydantic_extra__ = schema_obj.model_extra
|
93
99
|
|
94
100
|
return request_obj
|
95
101
|
|
@@ -162,17 +168,27 @@ async def import_flow_model(model):
|
|
162
168
|
|
163
169
|
return tool_id
|
164
170
|
|
165
|
-
def import_flow_support_tools():
|
171
|
+
def import_flow_support_tools(model):
|
166
172
|
|
167
173
|
if not is_local_dev():
|
168
174
|
# we can't import support tools into non-local environments yet
|
169
|
-
return
|
175
|
+
return []
|
176
|
+
|
177
|
+
|
178
|
+
schedulable = False
|
179
|
+
if "schedulable" in model["spec"]:
|
180
|
+
schedulable = model["spec"]["schedulable"]
|
170
181
|
|
171
182
|
client = instantiate_client(TempusClient)
|
172
183
|
|
173
184
|
logger.info(f"Import 'get_flow_status' tool spec...")
|
174
185
|
tools = [create_flow_status_tool("i__get_flow_status_intrinsic_tool__")]
|
175
186
|
|
187
|
+
if schedulable:
|
188
|
+
get_schedule_tool = create_get_schedule_tool("i__get_schedule_intrinsic_tool__")
|
189
|
+
delete_schedule_tool = create_delete_schedule_tool("i__delete_schedule_intrinsic_tool__")
|
190
|
+
tools.extend([get_schedule_tool, delete_schedule_tool])
|
191
|
+
|
176
192
|
return tools
|
177
193
|
|
178
194
|
# Assisted by watsonx Code Assistant
|
@@ -187,7 +203,7 @@ def create_flow_status_tool(flow_status_tool: str, TEMPUS_ENDPOINT: str="http://
|
|
187
203
|
)
|
188
204
|
|
189
205
|
openapi_binding = OpenApiToolBinding(
|
190
|
-
http_path="/flows",
|
206
|
+
http_path="/v1/flows",
|
191
207
|
http_method="GET",
|
192
208
|
security=[],
|
193
209
|
servers=[TEMPUS_ENDPOINT]
|
@@ -213,3 +229,102 @@ def create_flow_status_tool(flow_status_tool: str, TEMPUS_ENDPOINT: str="http://
|
|
213
229
|
|
214
230
|
return OpenAPITool(spec=spec)
|
215
231
|
|
232
|
+
|
233
|
+
def create_get_schedule_tool(name: str, TEMPUS_ENDPOINT: str="http://wxo-tempus-runtime:9044") -> dict:
|
234
|
+
|
235
|
+
spec = ToolSpec(
|
236
|
+
name=name,
|
237
|
+
description="Use this tool to show the current schedules.",
|
238
|
+
permission='read_only',
|
239
|
+
display_name= "Get Schedules"
|
240
|
+
)
|
241
|
+
|
242
|
+
openapi_binding = OpenApiToolBinding(
|
243
|
+
http_path="/v1/schedules/simple",
|
244
|
+
http_method="GET",
|
245
|
+
security=[],
|
246
|
+
servers=[TEMPUS_ENDPOINT]
|
247
|
+
)
|
248
|
+
|
249
|
+
spec.binding = ToolBinding(openapi=openapi_binding)
|
250
|
+
# Input Schema
|
251
|
+
properties = {
|
252
|
+
"query_schedule_id": {
|
253
|
+
"type": "string",
|
254
|
+
"title": "schedule_id",
|
255
|
+
"description": "Identifies the schedule instance.",
|
256
|
+
"in": "query"
|
257
|
+
},
|
258
|
+
"query_schedule_name": {
|
259
|
+
"type": "string",
|
260
|
+
"title": "schedule_name",
|
261
|
+
"description": "Identifies the schedule name.",
|
262
|
+
"in": "query"
|
263
|
+
},
|
264
|
+
}
|
265
|
+
|
266
|
+
spec.input_schema = ToolRequestBody(
|
267
|
+
type='object',
|
268
|
+
properties=properties,
|
269
|
+
required=[]
|
270
|
+
)
|
271
|
+
|
272
|
+
response_properties = {
|
273
|
+
"schedule_id": {
|
274
|
+
"type": "string",
|
275
|
+
},
|
276
|
+
"schedule_name": {
|
277
|
+
"type": "string",
|
278
|
+
},
|
279
|
+
"schedule_data": {
|
280
|
+
"type": "string",
|
281
|
+
},
|
282
|
+
"schedule_time": {
|
283
|
+
"type": "string",
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
spec.output_schema = ToolResponseBody(type='object',
|
288
|
+
properties=response_properties,
|
289
|
+
description='Return the information about the schedule.')
|
290
|
+
|
291
|
+
return OpenAPITool(spec=spec)
|
292
|
+
|
293
|
+
|
294
|
+
def create_delete_schedule_tool(name: str, TEMPUS_ENDPOINT: str="http://wxo-tempus-runtime:9044") -> dict:
|
295
|
+
|
296
|
+
spec = ToolSpec(
|
297
|
+
name=name,
|
298
|
+
description="Use this tool to delete/remove a schedule based on the schedule_id.",
|
299
|
+
permission='read_only',
|
300
|
+
display_name= "Delete Schedule"
|
301
|
+
)
|
302
|
+
|
303
|
+
openapi_binding = OpenApiToolBinding(
|
304
|
+
http_path="/v1/schedules/{schedule_id}",
|
305
|
+
http_method="DELETE",
|
306
|
+
security=[],
|
307
|
+
servers=[TEMPUS_ENDPOINT]
|
308
|
+
)
|
309
|
+
|
310
|
+
spec.binding = ToolBinding(openapi=openapi_binding)
|
311
|
+
# Input Schema
|
312
|
+
properties = {
|
313
|
+
"path_schedule_id": {
|
314
|
+
"type": "string",
|
315
|
+
"title": "schedule_id",
|
316
|
+
"description": "Identifies the schedule instance.",
|
317
|
+
"in": "query"
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
spec.input_schema = ToolRequestBody(
|
322
|
+
type='object',
|
323
|
+
properties=properties,
|
324
|
+
required=[]
|
325
|
+
)
|
326
|
+
|
327
|
+
spec.output_schema = ToolResponseBody(type='object',
|
328
|
+
description='Schedule deleted.')
|
329
|
+
|
330
|
+
return OpenAPITool(spec=spec)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import logging
|
2
|
+
import sys
|
3
|
+
import os
|
4
|
+
|
5
|
+
logger = logging.getLogger(__name__)
|
6
|
+
|
7
|
+
class BadRequest(Exception):
|
8
|
+
def __init__(self, message: str):
|
9
|
+
super().__init__(message)
|
10
|
+
self.message = message
|
11
|
+
logger.error(message)
|
12
|
+
|
13
|
+
# We need to exit to avoid getting 2 error messages printed
|
14
|
+
# We don't want to exit while running tests
|
15
|
+
# Only exit if not running in a test and no --debug
|
16
|
+
if not self._in_test() and "--debug" not in sys.argv:
|
17
|
+
sys.exit(1)
|
18
|
+
|
19
|
+
def _in_test(self):
|
20
|
+
return "PYTEST_CURRENT_TEST" in os.environ
|
21
|
+
|
22
|
+
def __str__(self):
|
23
|
+
return self.message
|
{ibm_watsonx_orchestrate-1.7.0a0.dist-info → ibm_watsonx_orchestrate-1.8.0b0.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ibm-watsonx-orchestrate
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.8.0b0
|
4
4
|
Summary: IBM watsonx.orchestrate SDK
|
5
5
|
Author-email: IBM <support@ibm.com>
|
6
6
|
License: MIT License
|
@@ -10,13 +10,13 @@ Requires-Dist: certifi>=2024.8.30
|
|
10
10
|
Requires-Dist: click<8.2.0,>=8.0.0
|
11
11
|
Requires-Dist: docstring-parser<1.0,>=0.16
|
12
12
|
Requires-Dist: httpx<1.0.0,>=0.28.1
|
13
|
-
Requires-Dist: ibm-cloud-sdk-core>=3.
|
14
|
-
Requires-Dist: ibm-watsonx-orchestrate-evaluation-framework==1.0.
|
13
|
+
Requires-Dist: ibm-cloud-sdk-core>=3.24.2
|
14
|
+
Requires-Dist: ibm-watsonx-orchestrate-evaluation-framework==1.0.6
|
15
15
|
Requires-Dist: jsonref==1.1.0
|
16
16
|
Requires-Dist: jsonschema<5.0.0,>=4.23.0
|
17
|
-
Requires-Dist: langchain-
|
17
|
+
Requires-Dist: langchain-core<=0.3.63
|
18
|
+
Requires-Dist: langsmith<=0.3.45
|
18
19
|
Requires-Dist: munch>=4.0.0
|
19
|
-
Requires-Dist: numpy>=1.26.0
|
20
20
|
Requires-Dist: packaging>=24.2
|
21
21
|
Requires-Dist: pydantic<3.0.0,>=2.10.3
|
22
22
|
Requires-Dist: pyjwt<3.0.0,>=2.10.1
|