@@ -379,6 +379,26 @@ def Flow(self, request: pb2.FlowRequest, context) -> pb2.FlowResponse:
379379 identifiers = flow_few_shot_flow_type_ids
380380 )
381381
382+ incoming_flow_function_ids = list ({
383+ node .function_identifier
384+ for node in incoming_flow .nodes
385+ })
386+ incoming_flow_flow_type_ids = [incoming_flow .type ] if incoming_flow .type else []
387+
388+ if incoming_flow_function_ids :
389+ log .debug (f"[Flow] Incoming-flow functions: { incoming_flow_function_ids } " )
390+ if incoming_flow_flow_type_ids :
391+ log .debug (f"[Flow] Incoming-flow flow types: { incoming_flow_flow_type_ids } " )
392+
393+ incoming_flow_functions = self .function_store .find_all (
394+ group_identifier = str (request .project_id ),
395+ identifiers = incoming_flow_function_ids
396+ )
397+ incoming_flow_flow_types = self .flow_type_store .find_all (
398+ group_identifier = str (request .project_id ),
399+ identifiers = incoming_flow_flow_type_ids
400+ )
401+
382402 few_shots = [
383403 msg
384404 for fS in flow_few_shots
@@ -388,8 +408,14 @@ def Flow(self, request: pb2.FlowRequest, context) -> pb2.FlowResponse:
388408 )
389409 ]
390410
391- combined_functions = self .function_store .combine (prompt_functions , flow_few_shot_functions )
392- combined_flow_types = self .flow_type_store .combine (prompt_flow_types , flow_few_shots_flow_types )
411+ combined_functions = self .function_store .combine (
412+ self .function_store .combine (prompt_functions , flow_few_shot_functions ),
413+ incoming_flow_functions
414+ )
415+ combined_flow_types = self .flow_type_store .combine (
416+ self .flow_type_store .combine (prompt_flow_types , flow_few_shots_flow_types ),
417+ incoming_flow_flow_types
418+ )
393419
394420 log .debug (
395421 f"[Flow] Combined — functions={ len (combined_functions )} "
0 commit comments