firebase-realtime-databaseartificial-intelligence

Can I use Gemini to analyze a JSON firebase RTDB?


I have a DB at https://dbname-rtdb.firebaseio.com/. I would like to run a prompt in Gemini that says something like

"Do an analysis of the database on https://dbname-rtdb.firebaseio.com/companies/-idCompany/quantities/ and bring me the total quantity consumed for each type of product".

When I try to use Gemini AI Studio within my Firebase console, Gemini returns a message that it cannot read external databases and should load the JSON directly.

Gemini really can't connect to databases securely to better enhance business data analysis?


Solution

  • If the data at companies/$idCompany/quantities is publicly readable, you may be able to point Gemini to the REST endpoint by appending .json to the URL:

    https://dbname-rtdb.firebaseio.com/companies/-idCompany/quantities.json
    

    If the data is not publicly readable or Gemini can't read it, you'd have to read it in your own application code and pass the data into the Gemini prompt.

    You might also want to look into Function Calling with Gemini API, which is a relatively new way to get external data like this injected into your Gemini prompts.