Home APIs Knowledge Base for Gemini

To help you get the most accurate and context-aware answers for your Google Home platform projects, we have released an AI Knowledge Base file.

This file (google-home-api-knowledge-base.txt) is a curated "source of truth" document containing detailed API specifications and code examples. When you provide this file to a Large Language Model (LLM), it acts as a powerful "cheat sheet," allowing the AI to answer your specific Home APIs questions with greater precision.

We highly recommend using this with Gemini in Android Studio, but you can also use it with other LLMs (like Gemini on the web) by providing the file as context.

Prerequisites

  1. Android Studio: You must have Android Studio Narwhal (2024.2.1) or newer.
  2. Gemini Plugin: You must have the Gemini in Android Studio plugin installed and enabled.

Step-by-step instructions

  1. Get the Knowledge Base file

    The knowledge base file is available on our official Google Home sample app repository on GitHub. You can either:

  2. Add the file to Your project

    Place the google-home-api-knowledge-base.txt file anywhere inside your project. We recommend putting it in the /tools folder.

    Image showing where to place the file in the project.
    Where to place the file in the project.

  3. Attach the file in Gemini Chat

    Open the Gemini chat pane in Android Studio. To give Gemini the file's context, type the @ symbol. An autocomplete menu will pop up, showing available files. Select google-home-api-knowledge-base.txt from the list.

    For more information, see Attach a file to your query in Gemini in Android Studio.

    Animated image showing how to add context to Gemini.
    How to add context to Gemini.

  4. Ask your question

    With the file attached, you can now ask your detailed question. Gemini will now use the knowledge base to provide a detailed, accurate answer based on your file.