Gemini in Firebase for Data Connect queries

Now that Firebase Data Connect is in public preview, we’re excited to announce the integration with Gemini in Firebase, an AI-powered conversational assistant that can provide answers to Firebase-related questions, coding assistance, troubleshooting help, and more.

You can now use natural language prompts in Data Connect to generate GraphQL code, which makes creating GraphQL queries more streamlined, speeds up the development process, increases accuracy by reducing the risk of syntax errors and faulty queries being executed, and ensures that you retrieve accurate data. Gemini in Firebase will let you access and interact with your Data Connect data more effectively.

What are the benefits?

At a high level, using natural language prompts to generate GraphQL code means you can manage and deploy data with greater ease, efficiency, and accuracy.

When you use plain English, Gemini automatically generates GraphQL code, and because Gemini understands your schema, it can build intelligent queries. Therefore, you can skip the lengthy process of learning the ins and outs of GraphQL, which means you can start accessing and managing your database right away. You can do so regardless of the size or complexity of the necessary query. As data structures and r​elationships become increasingly complex, writing these queries could be difficult, time-consuming, and prone to errors. Development time will decrease when using Gemini, as you won’t have to worry about perfectly structuring a query every time you want to access or update some data.

Get started!

You can use Gemini in Firebase in the Firebase console to help you create queries and mutations to include in your client-side code. Describe the query or mutation you want to generate in natural language, and Gemini in Firebase will provide you with its GraphQL equivalent. Populate data in test environments, explore data with complex queries, and find relevant results to questions about your users. Afterward, run and test the output in the Firebase console, then copy your finalized queries and mutations into your code.

To set up AI assistance in Data Connect, set up Gemini in Firebase, and then you’ll be ready to generate GraphQL queries and mutations with Gemini in Firebase! You do this directly from the Firebase console for Data Connect, and once generated, you can try the output in the console’s data editor to ensure correctness before using it in your development environment.

For example, if you’re using the Movies data source referenced in the Firebase Data Connect quickstart and the Build with Data Connect codelab, you could ask, “Return the top five movies of 2022, in descending order by rating,” which might return a result like the following:

query TopMovies2022 {
  movies(where: {releaseYear: {eq: 2022}}, orderBy: [{rating: DESC}], limit: 5) {
    id
    title
    rating
    releaseYear
  }
}

With this, you can review the response and test it out in Firebase console’s code editor.

If you have any questions about pricing, see Gemini in Firebase pricing for more information.

Try out Gemini in Firebase for Data Connect and experience the magic of AI-powered development!