@@ -71,22 +71,24 @@ def Prompt(self, request: pb2.PromptRequest, context) -> pb2.FlowResponse:
7171 details = f"The specified model_identifier '{ request .model_identifier } ' does not exist. Please provide a valid model_identifier for flow generation."
7272 )
7373
74- if len (
75- self .function_store .get_all (
76- group_identifier = str (request .project_id )
77- )
78- ) <= 0 and (len (request .functions ) <= 0 ):
74+ stored_functions_count = len (self .function_store .get_all (group_identifier = str (request .project_id )))
75+ stored_flow_types_count = len (self .flow_type_store .get_all (group_identifier = str (request .project_id )))
76+ stored_few_shots_count = len (self .few_shots_store .get_all (group_identifier = "global" ))
77+ log .info (
78+ f"[Prompt] Store state — project={ request .project_id } "
79+ f"functions={ stored_functions_count } "
80+ f"flow_types={ stored_flow_types_count } "
81+ f"few_shots={ stored_few_shots_count } "
82+ )
83+
84+ if stored_functions_count <= 0 and (len (request .functions ) <= 0 ):
7985 log .warning (f"[Prompt] Rejected — no functions for project={ request .project_id } " )
8086 context .abort (
8187 code = grpc .StatusCode .ABORTED ,
8288 details = "No functions found for the given project_id. Please add functions before requesting a prompt generation."
8389 )
8490
85- if len (
86- self .flow_type_store .get_all (
87- group_identifier = str (request .project_id )
88- )
89- ) <= 0 and (len (request .flow_types ) <= 0 ):
91+ if stored_flow_types_count <= 0 and (len (request .flow_types ) <= 0 ):
9092 log .warning (f"[Prompt] Rejected — no flow types for project={ request .project_id } " )
9193 context .abort (
9294 code = grpc .StatusCode .ABORTED ,
@@ -272,22 +274,24 @@ def Flow(self, request: pb2.FlowRequest, context) -> pb2.FlowResponse:
272274 details = f"The specified model_identifier '{ request .model_identifier } ' does not exist. Please provide a valid model_identifier for flow generation."
273275 )
274276
275- if len (
276- self .function_store .get_all (
277- group_identifier = str (request .project_id )
278- )
279- ) <= 0 and (len (request .functions ) <= 0 ):
277+ stored_functions_count = len (self .function_store .get_all (group_identifier = str (request .project_id )))
278+ stored_flow_types_count = len (self .flow_type_store .get_all (group_identifier = str (request .project_id )))
279+ stored_few_shots_count = len (self .few_shots_store .get_all (group_identifier = "global" ))
280+ log .info (
281+ f"[Flow] Store state — project={ request .project_id } "
282+ f"functions={ stored_functions_count } "
283+ f"flow_types={ stored_flow_types_count } "
284+ f"few_shots={ stored_few_shots_count } "
285+ )
286+
287+ if stored_functions_count <= 0 and (len (request .functions ) <= 0 ):
280288 log .warning (f"[Flow] Rejected — no functions for project={ request .project_id } " )
281289 context .abort (
282290 code = grpc .StatusCode .ABORTED ,
283291 details = "No functions found for the given project_id. Please add functions before requesting a prompt generation."
284292 )
285293
286- if len (
287- self .flow_type_store .get_all (
288- group_identifier = str (request .project_id )
289- )
290- ) <= 0 and (len (request .flow_types ) <= 0 ):
294+ if stored_flow_types_count <= 0 and (len (request .flow_types ) <= 0 ):
291295 log .warning (f"[Flow] Rejected — no flow types for project={ request .project_id } " )
292296 context .abort (
293297 code = grpc .StatusCode .ABORTED ,
0 commit comments