Connect Riza’s code interpreter to Gemini
google-generativeai
and rizaio
packages with pip
:
OB2XE4DMMUQG233ONNSXSIDENFZWQ53BONUGK4Q=
.
For a correct result, we can offer Gemini a tool to execute Python.
execute_python
helper function in our script. This function uses Riza to execute arbitrary Python:
execute_python()
function available to Gemini as a tool, and call Gemini with our query:
enable_automatic_function_calling
setting to allow Gemini to call any function without us having to explicitly handle the tool use. If you’d like to explicitly handle the tool use, you can disable this setting.
Finally, let’s print out the full chat history so we can see the function call: