@@ -6565,10 +6565,6 @@ def generate_content(
65656565 response = self ._generate_content (
65666566 model = model , contents = contents , config = parsed_config
65676567 )
6568- logger .info (f'AFC remote call { i } is done.' )
6569- remaining_remote_calls_afc -= 1
6570- if remaining_remote_calls_afc == 0 :
6571- logger .info ('Reached max remote calls for automatic function calling.' )
65726568
65736569 function_map = _extra_utils .get_function_map (parsed_config )
65746570 if not function_map :
@@ -6586,6 +6582,11 @@ def generate_content(
65866582 )
65876583 if not func_response_parts :
65886584 break
6585+ logger .info (f'AFC remote call { i } is done.' )
6586+ remaining_remote_calls_afc -= 1
6587+ if remaining_remote_calls_afc == 0 :
6588+ logger .info ('Reached max remote calls for automatic function calling.' )
6589+
65896590 func_call_content = response .candidates [0 ].content
65906591 func_response_content = types .Content (
65916592 role = 'user' ,
@@ -6703,10 +6704,6 @@ def generate_content_stream(
67036704 response = self ._generate_content_stream (
67046705 model = model , contents = contents , config = parsed_config
67056706 )
6706- logger .info (f'AFC remote call { i } is done.' )
6707- remaining_remote_calls_afc -= 1
6708- if remaining_remote_calls_afc == 0 :
6709- logger .info ('Reached max remote calls for automatic function calling.' )
67106707
67116708 function_map = _extra_utils .get_function_map (parsed_config )
67126709
@@ -6756,6 +6753,10 @@ def generate_content_stream(
67566753 break
67576754 if not func_response_parts :
67586755 break
6756+ logger .info (f'AFC remote call { i } is done.' )
6757+ remaining_remote_calls_afc -= 1
6758+ if remaining_remote_calls_afc == 0 :
6759+ logger .info ('Reached max remote calls for automatic function calling.' )
67596760
67606761 # Append function response parts to contents for the next request.
67616762 if chunk is not None and chunk .candidates is not None :
0 commit comments