> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TextGenerate - ComfyUI Built-in Node Documentation

> The TextGenerate node uses a CLIP model to create text based on a user's prompt.

The TextGenerate node uses a CLIP model to create text based on a user's prompt. It can optionally use images, video, or audio as additional context to guide the text generation. You can control the length of the output, enable a thinking mode for supported models, and choose whether to use random sampling with various settings or to generate text without sampling.

## Inputs

### Common Inputs

| Parameter              | Description                                                                                                                                                                                             | Data Type      | Required | Range               |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------- | ------------------- |
| `sampling_mode`        | Controls whether random sampling is used during text generation. When set to "on", additional sampling parameters become available. When set to "off", the node generates text without random sampling. | DYNAMIC\_COMBO | Yes      | `"on"`<br />`"off"` |
| `clip`                 | The CLIP model used for tokenizing the prompt and generating text.                                                                                                                                      | CLIP           | Yes      | N/A                 |
| `prompt`               | The text prompt that guides the generation. This field supports multiple lines and dynamic prompts. The default value is an empty string.                                                               | STRING         | Yes      | N/A                 |
| `image`                | An optional image that can be used alongside the text prompt to influence the generated text.                                                                                                           | IMAGE          | No       | N/A                 |
| `video`                | Video frames as an image batch. Assumed to be 24 FPS; subsampled to 1 FPS internally.                                                                                                                   | IMAGE          | No       | N/A                 |
| `audio`                | An optional audio input that can be used alongside the text prompt to influence the generated text.                                                                                                     | AUDIO          | No       | N/A                 |
| `max_length`           | The maximum number of tokens the model will generate. The default value is 512.                                                                                                                         | INT            | Yes      | 1 to 32768          |
| `thinking`             | Operate in thinking mode if the model supports it. The default value is False.                                                                                                                          | BOOLEAN        | No       | True or False       |
| `use_default_template` | Use the built in system prompt/template if the model has one. The default value is True. This is an advanced parameter.                                                                                 | BOOLEAN        | No       | True or False       |

### Sampling Parameters (when `sampling_mode` is "on")

| Parameter            | Description                                                                                                                                            | Data Type | Required | Range                     |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- | -------- | ------------------------- |
| `temperature`        | Controls the randomness of the output. Lower values make the output more predictable, higher values make it more creative. The default value is 0.7.   | FLOAT     | Yes      | 0.01 to 2.0               |
| `top_k`              | Limits the sampling pool to the top K most likely next tokens. A value of 0 disables this filter. The default value is 64.                             | INT       | Yes      | 0 to 1000                 |
| `top_p`              | Uses nucleus sampling, limiting choices to tokens whose cumulative probability is less than this value. The default value is 0.95.                     | FLOAT     | Yes      | 0.0 to 1.0                |
| `min_p`              | Sets a minimum probability threshold for tokens to be considered. The default value is 0.05.                                                           | FLOAT     | Yes      | 0.0 to 1.0                |
| `repetition_penalty` | Penalizes tokens that have already been generated to reduce repetition. A value of 1.0 applies no penalty. The default value is 1.05.                  | FLOAT     | Yes      | 0.0 to 5.0                |
| `seed`               | A number used to initialize the random number generator for reproducible results. The default value is 0.                                              | INT       | Yes      | 0 to 18446744073709551615 |
| `presence_penalty`   | Penalizes new tokens based on whether they have appeared in the text so far, encouraging the model to talk about new topics. The default value is 0.0. | FLOAT     | No       | 0.0 to 5.0                |

**Note:** The sampling parameters above are only active and visible in the node interface when `sampling_mode` is set to "on". When `sampling_mode` is set to "off", no sampling parameters are available and the node generates text without random sampling.

## Outputs

| Output Name      | Description                                                                                    | Data Type |
| ---------------- | ---------------------------------------------------------------------------------------------- | --------- |
| `generated_text` | The text generated by the model based on the input prompt and optional image, video, or audio. | STRING    |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/TextGenerate/en.md)

***

**Source fingerprint (SHA-256):** `6274a2db7c9a963304daf6df494b2b20879155e918d73429fd2ce7f3b5b9da02`
