> ## 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.

# Get Text Completion

Generate a text completion from a model based on a prompt. The action will return the generated text along with token usage statistics.

<Note>
  External Documentation

  To learn more, visit the [LiteLLM documentation](https://docs.litellm.ai/docs/text_completion).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter          | Description                                                                                                                                              |
  | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Completions Number | The number of completions to generate.                                                                                                                   |
  | Max Tokens         | The maximum number of tokens to generate in the completion.                                                                                              |
  | Model ID           | The ID of the model to get text completions with.                                                                                                        |
  | Prompt             | The prompt to send to the model.                                                                                                                         |
  | Stop Tokens        | A comma-separated list of tokens that will stop the generation.<br /><br />Example: `\n`, `END`, `---`                                                   |
  | Temperature        | The degree of randomness to use in the generation. Valid range is `0.0` - `2.0`.                                                                         |
  | Top P              | An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with `Top P` probability mass. |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter                 | Description                                                                                                                                                                                                                                                                                                                                                                                |
  | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
  | Additional Parameters     | A JSON object for additional body parameters. Values specified in this parameter will override equivalent parameters.<br /><br />For example:<br /><pre><code>\{<br />    "first\_key": 12345,<br />    "second\_key": "some\_value"<br />}</code></pre>The object must follow the vendor's structure as defined in the [API documentation](https://docs.litellm.ai/docs/text_completion). |
  | Frequency Penalty         | Penalize new tokens based on their existing frequency. Accept values from `-2.0` to `2.0`.                                                                                                                                                                                                                                                                                                 |
  | Include Log Probabilities | Select to include the log probabilities for the most likely tokens.                                                                                                                                                                                                                                                                                                                        |
  | Logit Bias                | A JSON object mapping token IDs to bias values. This modifies the probability of generating specific tokens.<br />        <br />Example:<br /><pre><code>\{<br />  "2683": -100,<br />  "7211": 5<br />}</code></pre>                                                                                                                                                                      |
  | Presence Penalty          | Penalize tokens based on whether they appear in the text so far. Valid range is `-2.0` - `2.0`.                                                                                                                                                                                                                                                                                            |
  | Seed                      | A seed to make the generated output more deterministic.                                                                                                                                                                                                                                                                                                                                    |
  | User ID                   | The ID of the user to associate with the request.                                                                                                                                                                                                                                                                                                                                          |
</div>

## Example Output

```json theme={"dark"}
{
	"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
	"object": "text_completion",
	"created": 1589478378,
	"model": "gpt-3.5-turbo-instruct",
	"system_fingerprint": "fp_44709d6fcb",
	"choices": [
		{
			"text": "\n\nThis is indeed a test",
			"index": 0,
			"logprobs": null,
			"finish_reason": "length"
		}
	],
	"usage": {
		"prompt_tokens": 5,
		"completion_tokens": 7,
		"total_tokens": 12
	}
}
```

## Workflow Library Example

[Get Text Completion with Litellm and Send Results Via Email](https://library.blinkops.com/workflows/get-text-completion-with-litellm-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/get-text-completion-with-litellm-and-send-results-via-email/canvas" />
</div>
