Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save donbcolab/f9d848c729f5b0499367626c1433d41f to your computer and use it in GitHub Desktop.
Save donbcolab/f9d848c729f5b0499367626c1433d41f to your computer and use it in GitHub Desktop.
intro_function_calling_with_gemini_and_python_output.ipynb
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donbcolab
Copy link
Author

donbcolab commented Apr 22, 2024

@donbcolab
Copy link
Author

Following error occurs when function calls are made out of sequence:

---------------------------------------------------------------------------
_InactiveRpcError                         Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs)
     71         try:
---> 72             return callable_(*args, **kwargs)
     73         except grpc.RpcError as exc:

8 frames
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.INVALID_ARGUMENT
	details = "Please ensure that function response turn comes immediately after a function call turn."
	debug_error_string = "UNKNOWN:Error received from peer ipv4:172.217.194.95:443 {created_time:"2024-04-22T00:26:46.692657746+00:00", grpc_status:3, grpc_message:"Please ensure that function response turn comes immediately after a function call turn."}"
>

The above exception was the direct cause of the following exception:

InvalidArgument                           Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs)
     72             return callable_(*args, **kwargs)
     73         except grpc.RpcError as exc:
---> 74             raise exceptions.from_grpc_error(exc) from exc
     75 
     76     return error_remapped_callable

InvalidArgument: 400 Please ensure that function response turn comes immediately after a function call turn.

@tytung2020
Copy link

I also encountered this error :
ERROR:root:Error in chat: 400 Please ensure that function response turn comes immediately after a function call turn. And the number of function response parts should be equal to number of function call parts of the function call turn.

but I've made sure the call response is returned right after function is called. I wonder what's the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment