mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
flow parameters (#526)
* Flow parameter tech spec * Flow configurable parameters implemented
This commit is contained in:
parent
3b0b13d74d
commit
dc2fa1f31e
8 changed files with 538 additions and 26 deletions
|
|
@ -87,7 +87,7 @@ class Flow:
|
|||
|
||||
return json.loads(self.request(request = input)["flow"])
|
||||
|
||||
def start(self, class_name, id, description):
|
||||
def start(self, class_name, id, description, parameters=None):
|
||||
|
||||
# The input consists of system and prompt strings
|
||||
input = {
|
||||
|
|
@ -97,6 +97,9 @@ class Flow:
|
|||
"description": description,
|
||||
}
|
||||
|
||||
if parameters:
|
||||
input["parameters"] = parameters
|
||||
|
||||
self.request(request = input)
|
||||
|
||||
def stop(self, id):
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ class FlowRequestTranslator(MessageTranslator):
|
|||
class_name=data.get("class-name"),
|
||||
class_definition=data.get("class-definition"),
|
||||
description=data.get("description"),
|
||||
flow_id=data.get("flow-id")
|
||||
flow_id=data.get("flow-id"),
|
||||
parameters=data.get("parameters")
|
||||
)
|
||||
|
||||
def from_pulsar(self, obj: FlowRequest) -> Dict[str, Any]:
|
||||
result = {}
|
||||
|
||||
|
||||
if obj.operation is not None:
|
||||
result["operation"] = obj.operation
|
||||
if obj.class_name is not None:
|
||||
|
|
@ -28,7 +29,9 @@ class FlowRequestTranslator(MessageTranslator):
|
|||
result["description"] = obj.description
|
||||
if obj.flow_id is not None:
|
||||
result["flow-id"] = obj.flow_id
|
||||
|
||||
if obj.parameters is not None:
|
||||
result["parameters"] = obj.parameters
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
|
@ -40,7 +43,7 @@ class FlowResponseTranslator(MessageTranslator):
|
|||
|
||||
def from_pulsar(self, obj: FlowResponse) -> Dict[str, Any]:
|
||||
result = {}
|
||||
|
||||
|
||||
if obj.class_names is not None:
|
||||
result["class-names"] = obj.class_names
|
||||
if obj.flow_ids is not None:
|
||||
|
|
@ -51,7 +54,9 @@ class FlowResponseTranslator(MessageTranslator):
|
|||
result["flow"] = obj.flow
|
||||
if obj.description is not None:
|
||||
result["description"] = obj.description
|
||||
|
||||
if obj.parameters is not None:
|
||||
result["parameters"] = obj.parameters
|
||||
|
||||
return result
|
||||
|
||||
def from_response_with_completion(self, obj: FlowResponse) -> Tuple[Dict[str, Any], bool]:
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ class FlowRequest(Record):
|
|||
# get_flow, start_flow, stop_flow
|
||||
flow_id = String()
|
||||
|
||||
# start_flow - optional parameters for flow customization
|
||||
parameters = Map(String())
|
||||
|
||||
class FlowResponse(Record):
|
||||
|
||||
# list_classes
|
||||
|
|
@ -52,6 +55,9 @@ class FlowResponse(Record):
|
|||
# get_flow
|
||||
description = String()
|
||||
|
||||
# get_flow - parameters used when flow was started
|
||||
parameters = Map(String())
|
||||
|
||||
# Everything
|
||||
error = Error()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue