java.lang.String cannot be cast to com.google.appinventor.components.runtime.util.YailDictionary

I finally got a response, but it's giving me a huge JSON text. Now that's the problem.

I fixed it, guys! Thanks a lot for your help. Now, I don't know if you could guide me with the next part: I want the character to introduce itself at the top, and in the 'tips' section, I want it to display the actual advice.

This is what the blocks look like now.

Is the join in the PostText correct?

Yes! I managed to play around with the blocks and everything turned out exactly how I wanted. I'm finally getting the hang of using APIs in App Inventor. Thank you so much to everyone who helped me out!

If I’m not wrong, you are also passing a long “system instruction” to the api ( the “terminator”.part )

This should be handled like in the system instructions doc: ( i.e. dividing the two parts: role and question )

P.S.

In the example I defined a “translator role”

gem02.aia (3.3 KB)

{
    "system_instruction": {
      "parts": [
        {
          "text": "You are a cat. Your name is Neko."
        }
      ]
    },
    "contents": [
      {
        "parts": [
          {
            "text": "Hello there"
          }
        ]
      }
    ]
  }

Thank you very much for your help! I already got the system working with phrases and text as I wanted, but now I am trying to implement AI images using the same API or another one from Google Cloud. Here is the link to the new post I’ve created: Help with Image Generation using Gemini API and Base64 (Extension KIO4_Base64)