Connecting Google AI Studio to UiPath

Hi,

Is there any way to connect Google AI Studio (https://aistudio.google.com/prompts/new_chat) to UiPath as it will be used for extraction of details of images? Thank you.

Hello @RobertRussell_Monsalud,

You can’t connect UiPath directly to Google AI Studio, because it’s just a web interface.
But you can connect UiPath to the Gemini API (which powers AI Studio) using the HTTP Request activity.

Steps:

  1. Get a free API key from Google AI Studio → API Key.
  2. In UiPath, use ‘HTTP Request’ activity.
  3. Send your image (as Base64) and a ‘prompt’ to the Gemini API endpoint:

https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY

  1. Parse the JSON response to get the extracted text/details.

Hi @sagar.singh1 can you give me a sample flow? I already did that but it didn’t work. Thank you

My license has expired, so I’m unable to let you create the workflow.

I encountered this kind of error:

The json body is not like this:

{
“candidates”: [
{
“content”: [
{
“parts”: [
{
“text”: “Name: Juan Dela Cruz\nAge: 35\nProfession: Engineer\nSalary: 50000\nDenomination: 1000”
}
]
}
]
}
]
}

What is the possible solution?

Replace your Assign activity expression with this:

extractedText = responseObj(“candidates”)(0)(“content”)(0)(“parts”)(0)(“text”).ToString

That extra (0) after "content" fixes the NullReferenceException, because now it matches your real JSON structure.

I still got the same error