> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Completion

Generate a model response.

<Note>
  External Documentation

  To learn more, visit the [Gemini documentation](https://ai.google.dev/api/generate-content#method:-models.generatecontent).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter     | Description                                                                                                                                                                  |
  | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Content Parts | The content of the current conversation with the model.<br /><br />Example:<br /><pre><code>\[\{<br />  "text": "Write a story about a magic backpack."<br />}]</code></pre> |
  | Model         | The name of the model to use for generating the completion.<br /><br />Example: `models/gemini-2.0-flash`<br /><br />**Note**: Only the latest model versions are supported. |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
  | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Cached Content     | The name of the content cached to use as context to serve the prediction.<br />Cached content can be only used with model it was created for.<br /><br />Format: `cachedContents/{cachedContent}`<br /><br />For more information about the `Cached Content` parameter, visit [Gemini's API documentation](https://ai.google.dev/gemini-api/docs/caching?lang=rest).                                                                                                         |
  | Max Output Tokens  | The maximum number of tokens to include in a response.                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | Role               | The producer of the content. Useful to set for multi-turn conversations.                                                                                                                                                                                                                                                                                                                                                                                                     |
  | Safety Settings    | A list of unique safety setting instances for blocking unsafe content.<br /><br />Example:<br /><pre><code>\[<br />  \{"category": "HARM\_CATEGORY\_HARASSMENT", "threshold": "BLOCK\_ONLY\_HIGH"},<br />  \{"category": "HARM\_CATEGORY\_HATE\_SPEECH", "threshold": "BLOCK\_MEDIUM\_AND\_ABOVE"}<br />]</code></pre>For more information about the `Safety Settings` parameter, visit [Gemini's API documentation](https://ai.google.dev/gemini-api/docs/safety-settings). |
  | Seed               | Seed used in decoding. If not set, the request uses a randomly generated seed.                                                                                                                                                                                                                                                                                                                                                                                               |
  | Stop Sequences     | A comma-separated list of character sequences (up to 5) that will stop output generation. If specified, Gemini will stop at the first appearance of a `Stop Sequence`. The stop sequence will not be included as part of the response.<br /><br />Example: `STOP,END`                                                                                                                                                                                                        |
  | System Instruction | Developer set system instruction(s).<br /><br />For example:<br /><pre><code>\{<br />  "parts": \{<br />    "text": "You are a cat. Your name is Neko."<br />  },<br />  "contents": \{<br />    "parts": \{<br />      "text": "Hello there"<br />    }<br />  }<br />}</code></pre>For more information about the `System Instruction` parameter, visit [Gemini's API documentation](https://ai.google.dev/gemini-api/docs/text-generation?lang=rest#system-instructions). |
  | Temperature        | The randomness of the output. Values can range from `0.0` to `2.0`.                                                                                                                                                                                                                                                                                                                                                                                                          |
  | Tool Config        | Tool configuration for any tool specified in the `Tools` parameter.<br /><br />For more information about the `Tool Config` parameter, visit [Gemini's API documentation](https://ai.google.dev/api/caching#ToolConfig).                                                                                                                                                                                                                                                     |
  | Tools              | A list of tools the model may use to generate the next response.<br /><br />For more information about the `Tools` parameter, visit [Gemini's API documentation](https://ai.google.dev/api/caching#Tool).                                                                                                                                                                                                                                                                    |
</div>

## Example Output

```json theme={"dark"}
{
	"candidates": [
		{
			"content": {
				"parts": [
					{
						"text": "Maya hummed, tracing the faded patch on her worn-out backpack. It had been her grandma's, passed down along with stories of adventures"
					}
				],
				"role": "model"
			},
			"finishReason": "MAX_TOKENS",
			"avgLogprobs": -1.2023602803548177
		}
	],
	"usageMetadata": {
		"promptTokenCount": 8,
		"candidatesTokenCount": 30,
		"totalTokenCount": 38,
		"promptTokensDetails": [
			{
				"modality": "TEXT",
				"tokenCount": 8
			}
		]
	},
	"modelVersion": "gemini-2.0-flash-001"
}
```

## Workflow Library Example

[Generate Completion with Gemini and Send Results Via Email](https://library.blinkops.com/workflows/generate-completion-with-gemini-and-send-results-via-email)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/generate-completion-with-gemini-and-send-results-via-email/canvas" />
</div>
