diff --git a/trustgraph-base/trustgraph/api/flow.py b/trustgraph-base/trustgraph/api/flow.py index 744ad2e7..142a699b 100644 --- a/trustgraph-base/trustgraph/api/flow.py +++ b/trustgraph-base/trustgraph/api/flow.py @@ -28,42 +28,42 @@ class Flow: def id(self, id="default"): return FlowInstance(api=self, id=id) - def list_classes(self): + def list_blueprints(self): # The input consists of system and prompt strings input = { - "operation": "list-classes", + "operation": "list-blueprints", } - return self.request(request = input)["class-names"] + return self.request(request = input)["blueprint-names"] - def get_class(self, class_name): + def get_blueprint(self, blueprint_name): # The input consists of system and prompt strings input = { - "operation": "get-class", - "class-name": class_name, + "operation": "get-blueprint", + "blueprint-name": blueprint_name, } - return json.loads(self.request(request = input)["class-definition"]) + return json.loads(self.request(request = input)["blueprint-definition"]) - def put_class(self, class_name, definition): + def put_blueprint(self, blueprint_name, definition): # The input consists of system and prompt strings input = { - "operation": "put-class", - "class-name": class_name, - "class-definition": json.dumps(definition), + "operation": "put-blueprint", + "blueprint-name": blueprint_name, + "blueprint-definition": json.dumps(definition), } self.request(request = input) - def delete_class(self, class_name): + def delete_blueprint(self, blueprint_name): # The input consists of system and prompt strings input = { - "operation": "delete-class", - "class-name": class_name, + "operation": "delete-blueprint", + "blueprint-name": blueprint_name, } self.request(request = input) @@ -87,13 +87,13 @@ class Flow: return json.loads(self.request(request = input)["flow"]) - def start(self, class_name, id, description, parameters=None): + def start(self, blueprint_name, id, description, parameters=None): # The input consists of system and prompt strings input = { "operation": "start-flow", "flow-id": id, - "class-name": class_name, + "blueprint-name": blueprint_name, "description": description, } diff --git a/trustgraph-cli/trustgraph/cli/start_flow.py b/trustgraph-cli/trustgraph/cli/start_flow.py index 4f9954b0..e04e241d 100644 --- a/trustgraph-cli/trustgraph/cli/start_flow.py +++ b/trustgraph-cli/trustgraph/cli/start_flow.py @@ -1,5 +1,5 @@ """ -Starts a processing flow using a defined flow class. +Starts a processing flow using a defined flow blueprint. Parameters can be provided in three ways: 1. As key=value pairs: --param model=gpt-4 --param temp=0.7 @@ -19,12 +19,12 @@ import json default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/') default_token = os.getenv("TRUSTGRAPH_TOKEN", None) -def start_flow(url, class_name, flow_id, description, parameters=None, token=None): +def start_flow(url, blueprint_name, flow_id, description, parameters=None, token=None): api = Api(url, token=token).flow() api.start( - class_name = class_name, + blueprint_name = blueprint_name, id = flow_id, description = description, parameters = parameters, @@ -50,9 +50,9 @@ def main(): ) parser.add_argument( - '-n', '--class-name', + '-n', '--blueprint-name', required=True, - help=f'Flow class name', + help=f'Flow blueprint name', ) parser.add_argument( @@ -115,7 +115,7 @@ def main(): start_flow( url = args.api_url, - class_name = args.class_name, + blueprint_name = args.blueprint_name, flow_id = args.flow_id, description = args.description, parameters = parameters, diff --git a/trustgraph-cli/trustgraph/cli/verify_system_status.py b/trustgraph-cli/trustgraph/cli/verify_system_status.py index 294a3738..8cebc83f 100644 --- a/trustgraph-cli/trustgraph/cli/verify_system_status.py +++ b/trustgraph-cli/trustgraph/cli/verify_system_status.py @@ -194,21 +194,21 @@ def check_processors(url: str, min_processors: int, timeout: int, token: Optiona return False, f"Processor check error: {e}" -def check_flow_classes(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]: - """Check if flow classes are loaded.""" +def check_flow_blueprints(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]: + """Check if flow blueprints are loaded.""" try: api = Api(url, token=token, timeout=timeout) flow_api = api.flow() - classes = flow_api.list_classes() + blueprints = flow_api.list_blueprints() - if classes and len(classes) > 0: - return True, f"Found {len(classes)} flow class(es)" + if blueprints and len(blueprints) > 0: + return True, f"Found {len(blueprints)} flow blueprint(s)" else: - return False, "No flow classes found" + return False, "No flow blueprints found" except Exception as e: - return False, f"Flow classes check error: {e}" + return False, f"Flow blueprints check error: {e}" def check_flows(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]: @@ -416,8 +416,8 @@ def main(): ) checker.run_check( - "Flow Classes", - check_flow_classes, + "Flow Blueprints", + check_flow_blueprints, args.api_url, args.check_timeout, args.token diff --git a/trustgraph-flow/trustgraph/config/service/flow.py b/trustgraph-flow/trustgraph/config/service/flow.py index a9d6e43f..9a8647a1 100644 --- a/trustgraph-flow/trustgraph/config/service/flow.py +++ b/trustgraph-flow/trustgraph/config/service/flow.py @@ -102,7 +102,7 @@ class FlowConfig: async def handle_list_blueprints(self, msg): - names = list(await self.config.get("flow-blueprints").keys()) + names = list(await self.config.get("flow-blueprint").keys()) return FlowResponse( error = None, @@ -114,13 +114,13 @@ class FlowConfig: return FlowResponse( error = None, blueprint_definition = await self.config.get( - "flow-blueprints" + "flow-blueprint" ).get(msg.blueprint_name), ) async def handle_put_blueprint(self, msg): - await self.config.get("flow-blueprints").put( + await self.config.get("flow-blueprint").put( msg.blueprint_name, msg.blueprint_definition ) @@ -136,7 +136,7 @@ class FlowConfig: logger.debug(f"Flow config message: {msg}") - await self.config.get("flow-blueprints").delete(msg.blueprint_name) + await self.config.get("flow-blueprint").delete(msg.blueprint_name) await self.config.inc_version() @@ -181,11 +181,11 @@ class FlowConfig: if msg.description is None: raise RuntimeError("No description") - if msg.blueprint_name not in await self.config.get("flow-blueprints").keys(): + if msg.blueprint_name not in await self.config.get("flow-blueprint").keys(): raise RuntimeError("Blueprint does not exist") cls = json.loads( - await self.config.get("flow-blueprints").get(msg.blueprint_name) + await self.config.get("flow-blueprint").get(msg.blueprint_name) ) # Resolve parameters by merging user-provided values with defaults @@ -292,7 +292,7 @@ class FlowConfig: blueprint_name = flow["blueprint-name"] parameters = flow.get("parameters", {}) - cls = json.loads(await self.config.get("flow-blueprints").get(blueprint_name)) + cls = json.loads(await self.config.get("flow-blueprint").get(blueprint_name)) def repl_template(tmp): result = tmp.replace(