Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Kliknij dostawcę Gemini API, aby wyświetlić na tej stronie treści i kod dostawcy.
Gdy wysyłasz żądanie do modelu generatywnego, dołączasz do niego prompt. Starannie formułując te prompty, możesz pokierować modelem tak, aby uzyskać oczekiwany wynik.
Prompty dla modeli Gemini
Prompty dla modeli Gemini mogą zawierać pytania, instrukcje, informacje kontekstowe, przykłady z kilkoma odpowiedziami i częściowe dane wejściowe, które model ma uzupełnić lub kontynuować.
Więcej informacji o projektowaniu promptów znajdziesz w Gemini Developer APIdokumentacji:
Więcej informacji o Imagen znajdziesz w tym artykule.
Inne opcje sterowania generowaniem treści
Skonfiguruj parametry modelu, aby określić, jak model ma generować odpowiedź. W przypadku modeli Gemini te parametry obejmują maksymalną liczbę tokenów wyjściowych, temperaturę, topK i topP.
W przypadku Imagen obejmują one m.in. współczynnik proporcji, generowanie osób, znak wodny itp.
Użyj ustawień bezpieczeństwa, aby dostosować prawdopodobieństwo otrzymania odpowiedzi, które mogą być uznane za szkodliwe, w tym wypowiedzi szerzące nienawiść i treści o charakterze jednoznacznie seksualnym.
Ustaw instrukcje systemowe, aby sterować zachowaniem modelu. Ta funkcja działa jak wstęp, który dodajesz, zanim model otrzyma dalsze instrukcje od użytkownika.
[null,null,["Ostatnia aktualizacja: 2025-08-19 UTC."],[],[],null,["\u003cbr /\u003e\n\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| *Click your Gemini API provider to view provider-specific content and code on this page.* Gemini Developer API Vertex AI Gemini API |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWhen you make a request to a generative model, you send along a *prompt* with\nyour request. By carefully crafting these prompts, you can influence the model\nto generate output specific to your needs.\n\nPrompting for Gemini models\n\nPrompts for Gemini models can contain questions,\ninstructions, contextual information, few-shot examples, and partial input for\nthe model to complete or continue.\n\nLearn about prompt design in the Gemini Developer API documentation:\n\n- [Prompt design strategies](https://ai.google.dev/gemini-api/docs/prompting-strategies)\n\n- [Prompt samples](https://ai.google.dev/gemini-api/prompts)\n\n| **Tip:** You can experiment with prompts and model configurations and rapidly iterate using [Google AI Studio](https://aistudio.google.com).\n\nPrompting for Imagen models\n\nFor Imagen, learn about\n[specific prompting strategies and options](https://ai.google.dev/gemini-api/docs/imagen#imagen-prompt-guide)\n\nOther options to control content generation\n\n- Configure [model parameters](/docs/ai-logic/model-parameters) to control how the model generates a response. For Gemini models, these parameters include max output tokens, temperature, topK, and topP. For Imagen models, these include aspect ratio, person generation, watermarking, etc.\n- Use [safety settings](/docs/ai-logic/safety-settings) to adjust the likelihood of getting responses that may be considered harmful, including hate speech and sexually explicit content.\n- Set [system instructions](/docs/ai-logic/system-instructions) to steer the behavior of the model. This feature is like a preamble that you add before the model gets exposed to any further instructions from the end user.\n- Pass a [*response schema*](/docs/ai-logic/generate-structured-output) along with the prompt to specify a specific output schema. This feature is most commonly used when [generating JSON output](/docs/ai-logic/generate-structured-output#generate-json-basic), but it can also be used for [classification tasks](/docs/ai-logic/generate-structured-output#generate-enum-basic) (like when you want the model to use specific labels or tags)."]]