Too complicated function call = 500 server error

I have used gemini 1.5 flash with function calling to create all-in-one AI assistant, combing image-generation, web search, ChatGPT like memories remembering stuff across chats and code execution which can visualize data using matplotlib like libs and the second i give it a little complex prompt using those functions i get a 500 server error.