> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-feat-openapi-i18n.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TextGenerate - ComfyUI Built-in Node Documentation

> Complete documentation for the TextGenerate node in ComfyUI. Learn its inputs, outputs, parameters and usage.

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

| Parameter              | Description                                                                                                                                                                                                           | Data Type | Required | Range                     |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- | ------------------------- |
| `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 256.                                                                                                                                       | INT       | Yes      | 1 to 2048                 |
| `sampling_mode`        | Controls whether random sampling is used during text generation. When set to "on", additional parameters for controlling the sampling become available. The default is "on".                                          | COMBO     | Yes      | `"on"`<br />`"off"`       |
| `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             |
| `temperature`          | Controls the randomness of the output. Lower values make the output more predictable, higher values make it more creative. This parameter is only available when `sampling_mode` is "on". The default value is 0.7.   | FLOAT     | No       | 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. This parameter is only available when `sampling_mode` is "on". The default value is 64.                             | INT       | No       | 0 to 1000                 |
| `top_p`                | Uses nucleus sampling, limiting choices to tokens whose cumulative probability is less than this value. This parameter is only available when `sampling_mode` is "on". The default value is 0.95.                     | FLOAT     | No       | 0.0 to 1.0                |
| `min_p`                | Sets a minimum probability threshold for tokens to be considered. This parameter is only available when `sampling_mode` is "on". The default value is 0.05.                                                           | FLOAT     | No       | 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. This parameter is only available when `sampling_mode` is "on". The default value is 1.05.                  | FLOAT     | No       | 0.0 to 5.0                |
| `presence_penalty`     | Penalizes new tokens based on whether they have appeared in the text so far, encouraging the model to talk about new topics. This parameter is only available when `sampling_mode` is "on". The default value is 0.0. | FLOAT     | No       | 0.0 to 5.0                |
| `seed`                 | A number used to initialize the random number generator for reproducible results when sampling is "on". The default value is 0.                                                                                       | INT       | No       | 0 to 18446744073709551615 |

**Note:** The parameters `temperature`, `top_k`, `top_p`, `min_p`, `repetition_penalty`, `presence_penalty`, and `seed` are only active and visible in the node interface when the `sampling_mode` is set to "on".

## 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):** `d2d08577e4d5aeea60f5517377730c4917df607be32f29227b07b1011b0f2c2d`
