本文档介绍了如何优化您向 Gemini for Google Cloud 发送的提示以及 Gemini 提供的帮助类型,以便您更高效地使用 Google Cloud 产品和服务。
您可以通过不同的方式提示 Gemini for Google Cloud ,具体取决于您使用的Google Cloud 产品。对于某些产品,您可以在对话界面中提示 Gemini for Google Cloud ,而在其他产品中,您可以在代码或查询编辑器中提示。如需了解如何输入提示,请参阅您产品的文档。
说明您尝试完成任务的原因。详细说明您要完成的任务有助于 Gemini for Google Cloud 提供更实用的答案。例如,与其直接问“如何部署网站”,不如告诉 Gemini for Google Cloud 您希望“设置一个简单、安全的 Google Cloud 网站来托管博客”。由于通常有多种正确方式可以实现技术目标,因此为 Gemini for Google Cloud 提供充足的上下文信息有助于确保获得良好的回答。
当您就使用 Gemini for Google Cloud的对话式体验向我们提供正面或负面反馈时,您便在帮助我们改进用于向您提供回答的底层服务。借助反馈以及您的明确许可,我们可以改进 Gemini,以便 Google Cloud 提供更好的建议并减少错误,同时确保加强优质回答。如需了解详情,请参阅提供 Gemini for Google Cloud 反馈。
[[["易于理解","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-19。"],[[["\u003cp\u003eGemini for Google Cloud assists users in being more productive with Google Cloud products and services by providing responses to user prompts.\u003c/p\u003e\n"],["\u003cp\u003eTo get the best responses from Gemini, users should provide detailed context and specifics in their prompts, ideally keeping them under 4,000 characters, using a conversational tone, and breaking down complex tasks.\u003c/p\u003e\n"],["\u003cp\u003eGemini can provide various types of assistance, including information about Google Cloud products, analytical and operational suggestions, task guidance, and code generation.\u003c/p\u003e\n"],["\u003cp\u003eUsers can enhance Gemini's accuracy and helpfulness by giving positive or negative feedback on the responses they receive, to help improve future interactions and suggestions.\u003c/p\u003e\n"],["\u003cp\u003eGemini for Google Cloud can help users at any skill level by having the prompt request match the users expertise, and giving detailed instructions on the technologies and programming languages that they are using.\u003c/p\u003e\n"]]],[],null,["# Write better prompts for Gemini for Google Cloud\n\nThis document describes how to optimize the prompts that you send to\nGemini for Google Cloud and the type of assistance it provides so that you can be more\nproductive using Google Cloud products and services.\n\nYou can prompt Gemini for Google Cloud in different ways depending on which\nGoogle Cloud product you're using. For some products, you prompt\nGemini for Google Cloud in a conversational interface,\nwhile in others you prompt in code or query editors. For instructions on how to\nenter prompts, see the [documentation for your product](/gemini/docs/overview).\n\nFor more information about Gemini for Google Cloud, an\nAI-powered collaborator in Google Cloud, see\n[Gemini for Google Cloud overview](/gemini/docs/overview).\n\nProvide context and details in your prompts\n-------------------------------------------\n\nThe questions that you ask Gemini for Google Cloud,\nincluding any input information or code you want Gemini to\nanalyze or complete, are called *prompts* . The answers or code completions that\nyou receive from Gemini are called *responses*.\n\nWhen you ask Gemini for Google Cloud for help, you should\ninclude as much context and specific detail as possible. Because AI-generated\nresponses are based on a vast range of possibilities, it's important for you to\nbe precise. For the best results, your prompts shouldn't exceed 4,000 characters.\n\nHere are some ways to provide helpful context and detail in your prompts:\n\n- **Write your prompt like you're talking with a person.** Don't enter only\n keywords as you might when searching for a document online, but include the\n kind of detail you'd include when explaining a problem to someone. For\n example, instead of entering the terms \"workload GKE,\" ask a complete\n question: \"What kinds of workloads does GKE support?\"\n\n- **Describe why you're trying to accomplish a task.**\n Details about what you're trying to accomplish can help Gemini\n for Google Cloud provide a more useful answer. For example, telling\n Gemini for Google Cloud that you want to \"set up a\n simple, secure Google Cloud site for hosting a blog\" has more helpful\n details than only asking \"how to deploy a website.\" Because there are often\n multiple correct ways to accomplish a technical goal, providing\n Gemini for Google Cloud sufficient context can help\n ensure a good response.\n\n- **Ask to include all the parameters in a command.**\n For example, when you ask Gemini Code Assist to generate code\n functions, you are likely to produce a more useful and detailed response by\n telling it to \"make sure all methods use their required arguments.\"\n\n- **Include your level of expertise.** It's especially helpful to match your\n prompt request with your expertise level when you ask for a suggestion. Asking\n Gemini for Google Cloud to explain a concept or code as\n if you're an expert programmer--or a novice programmer--can give you different,\n and more appropriate, results.\n\n For example, to direct Gemini to respond from an expert\n context, you could prompt it with \"create Python code to list all\n Compute Engine instances. You are an expert software developer using\n Google Cloud.\" Similarly, you could ask Gemini for\n Google Cloud to \"explain Kubernetes and its benefits to me in the\n simplest terms possible.\"\n- **Include details about products and technologies.** If you're looking for\n answers about a specific product, technology, or technical capability, include\n that in your prompt. Similarly, specifying a programming language can help you get\n more relevant responses. If you're unsure about what technologies or products\n to consider, ask Gemini to compare different options for you.\n\n- **Break complex problems into multiple requests.** Writing separate prompts\n can help Gemini refine and focus the answers that it gives,\n helping you move progressively toward a solution.\n\nWhat types of assistance can Gemini give you?\n---------------------------------------------\n\nWhile there are many ways to use the language and code capabilities in\nGemini for Google Cloud, the following sections describe\nsome key areas where Gemini assistance can be most useful.\n\nRemember that Gemini for Google Cloud can produce\nunexpected, incomplete, or erroneous results when you ask for assistance.\nFor more information, see\n[Gemini for Google Cloud and responsible AI](/gemini/docs/discover/responsible-ai).\n\n### Information and reference prompts\n\nYou can ask Gemini for Google Cloud for information about\nGoogle Cloud products and services, general technologies, definitions, and\nhow those concepts and technologies relate to one another. For example, you can\nask the following:\n\n- \"What does \"serverless architecture\" mean in Google Cloud?\"\n- \"What Google Cloud products provide managed Kubernetes cluster support?\"\n- \"What are the key technical features of BigQuery?\"\n- \"When should I use Compute Engine instead of App Engine?\"\n- \"What kinds of model testing does Vertex AI support?\"\n- \"What vulnerability scanning does Google's Security Command Center offer?\"\n\n### Analytical and operational prompts\n\nYou can ask Gemini for Google Cloud to summarize and\nsimplify code functions, and give operational suggestions---for example:\n\n- \"Simplify the code I've selected\" (for example, after selecting Python code in an [IDE](/gemini/docs/codeassist/overview#ide)).\n- \"Summarize what this function does\" (for example, after selecting a C code function in an IDE).\n- \"How do I optimize IAM permissions?\"\n\n### Task prompts\n\nYou can ask Gemini for Google Cloud to help you accomplish\na specific task or set of tasks. For complex tasks, try breaking your prompts\ninto separate steps. For example, you can get procedures and task information\nwith questions like the following:\n\n- \"How do I set up a Google Cloud account?\"\n- \"How do I make a bucket public?\"\n- \"How can I pull messages from a Pub/Sub subscription?\"\n- \"How do I use Vertex AI to deploy a model?\"\n\n### Generative prompts\n\nGemini for Google Cloud can generate and complete code\nstructures as you enter a request from an\n[IDE](/gemini/docs/codeassist/overview#ide) or from the Google Cloud console.\nGemini for Google Cloud can also help you generate process\ndocumentation for code design and development.\n\nFor example, you can ask Gemini for Google Cloud to help\nyou do the following:\n\n- \"Create a function with specific variables in C.\"\n- \"Create a high-level plan for designing and building and deploying a web app in Google Cloud.\"\n- \"Create a bare metal kubernetes cluster YAML file with default IP addresses.\"\n- \"Create javascript code for a drop-down menu.\"\n- \"Create a brief, easy-to-understand user story about a data scientist named Kim designing a Vertex AI model.\"\n- \"Create a gcloud command to give the developer Google group access to view my Google Cloud project.\"\n\n### Application-related prompts\n\nIf you\n[set up Gemini Cloud Assist for a folder](/gemini/docs/cloud-assist/set-up-gemini)\nand are using the **Cloud Assist** panel at the folder level in the\nGoogle Cloud console, then assistance and responses are limited to\napplications related to the folder for products that support applications. The\nfollowing list includes Google Cloud products supported at the folder level:\n\n- [Application Design Center](/application-design-center/docs/overview)\n- [App Hub](/app-hub/docs/overview)\n- [Cloud Asset Inventory](/asset-inventory/docs/asset-inventory-overview)\n- [Cloud Monitoring](/monitoring/docs/monitoring-overview)\n- [Logs Explorer](/logging/docs/view/logs-explorer-interface)\n\nOnly prompts related to applications are supported in these Google Cloud\nproducts if you are scoped to a folder in the Google Cloud console. If you\nsubmit a question that doesn't relate to applications within this scope, then\nGemini Cloud Assist provides a generic response stating that folders\nare intended for application-related prompts. The following list shows example\napplication-related prompts:\n\n- \"How many applications are in production?\"\n- \"Help troubleshoot application example-application.\"\n\nTo get specific assistance on other products and resources, use project picker\nat the top of the Google Cloud console page to select a project resource.\n\nAdditionally, you must enable\n[application management](/app-hub/docs/overview#application-management) on the\nfolder to use the **Cloud Assist** panel at the folder level.\n\nProvide feedback\n----------------\n\nWhen you provide us with positive or negative feedback about your conversational\nexperience with Gemini for Google Cloud, you're helping us\nimprove the underlying services that we use to provide you with responses. With\nfeedback, [and your explicit permission](/gemini/docs/discover/data-governance),\nwe can improve Gemini for Google Cloud to make better\nsuggestions with fewer mistakes, as well as ensure that good responses are\nreinforced. For more information, see\n[Provide Gemini for Google Cloud feedback](/gemini/docs/support/feedback).\n\nWhat's next\n-----------\n\n- For more about large language model (LLM) prompt design, see [Introduction to prompt design](/vertex-ai/docs/generative-ai/learn/introduction-prompt-design).\n- To learn more about generative AI, see [Generative AI learning path](https://www.cloudskillsboost.google/journeys/118).\n- For more on Gemini and LLM models, see [Gemini for Google Cloud and responsible AI](/gemini/docs/discover/responsible-ai).\n- For more on how we only use your feedback data with your permission, see [How Gemini for Google Cloud uses your data](/gemini/docs/discover/data-governance)."]]