[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-25。"],[],[],null,["# Write LookML with Gemini assistance\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis documentation page describes how to use Gemini assistance to create dimensions, dimension groups, and measures, in a LookML project. Generating LookML code suggestions in response to written prompts is a Gemini in Looker feature that is available in Looker (original) and Looker (Google Cloud core) instances.\n\n[Gemini in Looker](/looker/docs/overview-gemini) provides generative AI-powered assistance to help you work with your data.\n\nLearn [how and when Gemini\nfor Google Cloud uses your data](/gemini/docs/discover/data-governance).\n\nThis page is intended for Looker developers.\n\nBefore you begin\n----------------\n\nTo use Gemini in the Looker IDE, note the following requirements:\n\n- Gemini in Looker must be enabled for your Looker instance:\n - For Looker (original), the instance must be running Looker 25.2 or later, and the instance must be enabled for Gemini in Looker in the Admin settings. For detailed enablement instructions, see the [Admin settings --- Gemini in Looker](/looker/docs/admin-panel-platform-gil) documentation page.\n - For [Looker (Google Cloud core)](/looker/docs/overview-gemini) the instance must be enabled for Gemini in Looker in the Google Cloud console. For detailed enablement instructions, see the [Administer Gemini on your Looker (Google Cloud core) instance](/looker/docs/looker-core-admin-gemini) documentation page.\n- You must be assigned a Looker role that contains the [`develop`](/looker/docs/admin-panel-users-roles#develop) permission for at least one model in a LookML project.\n- You must be assigned the Looker [**Gemini**](/looker/docs/admin-panel-users-roles#gemini) role.\n\nUse Gemini in the Looker IDE\n----------------------------\n\n| As an early-stage technology, Gemini for Google Cloud\n| products can generate output that seems plausible but is factually incorrect. We recommend that you\n| validate all output from Gemini for Google Cloud products before you use it.\n| For more information, see\n| [Gemini for Google Cloud and responsible AI](/gemini/docs/discover/responsible-ai).\n\nTo use Gemini for creating LookML in your Looker project, follow these steps:\n\n1. On your Looker instance, enable [Development Mode](/looker/docs/dev-mode-prod-mode#development_mode).\n2. [Open your project in the Looker IDE](/looker/docs/looker-ide#accessing-ide).\n3. Use the IDE [file browser](/looker/docs/ide-folders) to open a LookML view file in which you want to insert LookML.\n4. Select the **Help me code** icon from the side panel selector.\n\n5. With the the **Help me code** panel open, click to place your cursor on a line in your LookML view file. Based on the type of LookML file and where your cursor is placed in the file, Gemini provides appropriate options to guide you, such as **Create a dimension** or **Create a measure**.\n\n6. Select one of the following options from the **Help me code** panel:\n\n | **Note:** If you don't see all of these options, make sure that you are in a view file and that your cursor is placed at a location in the file where a dimension, dimension group, or measure is supported.\n - **Create a [dimension group](/looker/docs/reference/param-field-dimension-group)**\n - **Create a [dimension](/looker/docs/reference/param-field-dimension)**\n - **Create a [measure](/looker/docs/reference/param-field-measure)**\n - **Other code suggestion** : You can use the **other code suggestion** option if you want to try out different LookML elements. Remember that Gemini is an early-stage technology, so validate and test all output before deploying it.\n7. In the **Help me code** panel text field, use conversational language to describe the dimension, dimension group, or measure that you want to create. See the [Tips for using Gemini in the Looker IDE](#tips) and [Sample prompts](#samples) sections on this page for guidance.\n\n8. Press **Enter** or click the **Submit** icon to send your request to Gemini. Gemini will respond with suggested code.\n\n9. With the suggested code, you can do the following:\n\n - Hold your pointer over the **Insert** button to preview the suggested LookML in your file. You can move your cursor to a different line in your file to preview it in a different location before inserting the LookML in the file.\n - Click the **Edit** button to manually change the suggested LookML.\n - Click the **Insert** button to insert the LookML into your file at the location of your cursor.\n - Provide feedback about the suggested code by selecting the thumbs up icon (**This response was helpful** ) or thumbs down icon (**This response was not what I expected**).\n - Click the **New code suggestion** link to start over and enter a new prompt for Gemini.\n\n10. Click **Save Changes** in your LookML file.\n\n11. Verify the LookML by doing the following:\n\n - Use the [LookML Validator](/looker/docs/lookml-validation) to verify your LookML.\n - [Test your LookML in an Explore](/looker/docs/looker-ide#testing_the_fields_in_the_explore).\n\nTips for using Gemini in the Looker IDE\n---------------------------------------\n\nHere are some tips for using Gemini in the Looker IDE:\n\n- For best results, write your prompts in American English. See the [Gemini for Google Cloud limitations](/gemini/docs/discover/responsible-ai#gemini-limitations) documentation for more information.\n- The **Help me code** panel does not retain context from a previous prompt in the conversation and does not retain prompts across logins and refreshes.\n- When you use LookML that was suggested by Gemini, always validate your LookML with the [LookML Validator](/looker/docs/lookml-validation), and [test your new fields in an Explore](/looker/docs/looker-ide#testing_the_fields_in_the_explore).\n- Depending on your request, Gemini may suggest LookML that references fields in other view files. When you add suggested LookML to your file, save the file and run the LookML Validator. The LookML Validator will display errors if you need to add [`include`](/looker/docs/reference/param-model-include) statements to your model file.\n\nSample prompts\n--------------\n\nTo give you some ideas, here are some example prompts and their results:\n\n- [Create a dimension using longitude and latitude](#create-dimension)\n- [Create a measure for today's total sales](#create-measure)\n\n### Create a dimension using longitude and latitude\n\nHere is a prompt using the **Create a dimension** option that asks Gemini to create a new dimension based on the `longitude` and `latitude` fields that are defined in the view file:\n\n`show coordinates with longitude and latitude`\n\nGemini returns this suggested code: \n\n dimension: coordinates {\n type: location\n sql_latitude: ${TABLE}.latitude ;;\n sql_longitude: ${TABLE}.longitude ;;\n }\n\nYou can verify this LookML in an Explore by selecting the new `coordinates` field, along with the `longitude` and `latitude` fields it's based on. Because Gemini created the dimension using [`type:location`](/looker/docs/reference/param-dimension-filter-parameter-types#location), the Explore results include a hyperlink to view the coordinates on a map:\n\n### Create a measure for today's total sales\n\nHere is a prompt using the **Create a measure** option that asks Gemini to create a new measure for the sum of all of today's orders:\n\n`show the total sale price of today's orders`\n\nGemini returns this suggested code: \n\n measure: todays_orders {\n type: sum\n sql: ${basic_order_items.sale_price} ;;\n filters: [basic_order_items.created_at_date: \"today\"]\n }\n\nProvide feedback\n----------------\n\nYou can provide feedback for the generated LookML in the **Help me code** panel. If the generated LookML looks correct, click the thumb_up thumbs-up icon. If the generated LookML looks incorrect or isn't what you expected, click the thumb_down thumbs-down icon.\n| **Note:** Gemini in Looker is in preview with limited support. We encourage you to share your feedback to help us improve. To report bugs or issues, reach out to [Looker Support](/looker/docs/best-practices/looker-support-details) and be sure to include the following details:\n|\n| - A clear description of the problem and the expected behavior\n| - Steps to reproduce the issue\n| - Any additional relevant details\n\nRelated resources\n-----------------\n\n- [Learn more about Gemini for Google Cloud](/gemini/docs/overview)\n- [Learn more about Gemini in Looker](/looker/docs/overview-gemini)"]]