# TextGenerator

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/TextGenerator/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/TextGenerator

Gives access to a large language model for text generation.

## Properties

### Seed

```luau
TextGenerator.Seed: number = 0
```

- Tags: Capabilities: Basic

Sets a fixed seed for the random number generator, allowing reproducible responses in cases where the same input parameters are used across multiple requests.

### SystemPrompt

```luau
TextGenerator.SystemPrompt: string = ""
```

- Tags: Capabilities: Basic

Provides context to the model about its role, tone, or behavior during conversation.

### Temperature

```luau
TextGenerator.Temperature: number = 0.699999988
```

- Tags: Capabilities: Basic

Controls the "creativity" or randomness of the model's responses.

### TopP

```luau
TextGenerator.TopP: number = 0.899999976
```

- Tags: Capabilities: Basic

Helps the AI model narrow or expand the range of possible words to sample from while generating the next token.

## Methods

### GenerateTextAsync

```luau
TextGenerator:GenerateTextAsync(request: { [string]: any }): { [string]: any }
```

- Tags: Yields, Capabilities: Basic

Returns text generated by an LLM based on the provided system and user prompts.

Parameters:

- `request`: A dictionary containing optional parameters for the text generation request. The currently supported parameters are `UserPrompt`, `ContextToken`, and `MaxTokens`.

Returns: A dictionary containing the generated response.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
