# Restore-IntelligenceXThread

Rolls back the last N turns from a thread.

Command 

**Module**

`IntelligenceX.PowerShell`

**Inputs**

`IntelligenceX.OpenAI.IntelligenceXClient`

**Outputs**

`IntelligenceX.Json.JsonValue` `IntelligenceX.OpenAI.AppServer.Models.ThreadInfo`

Rolls back the last N turns from a thread.

## Syntax

```
Restore-IntelligenceXThread
-ThreadId <string>
-Turns <int>
[-Client <IntelligenceXClient>]
[-Raw]
[<CommonParameters>]
```

[#](#method-restore-intelligencexthread-string-int-intelligencexclient-switchparameter)

## Examples

### Example 1

```powershell
Restore-IntelligenceXThread -ThreadId $thread.Id -Turns 2
```

Rollback the last two turns

### Example 2

```powershell
Restore-IntelligenceXThread -ThreadId $thread.Id -Turns 1; Send-IntelligenceXMessage -ThreadId $thread.Id -Text "Use a shorter summary."
```

Rollback one turn and resend an adjusted message

### Example 3

```powershell
Restore-IntelligenceXThread -ThreadId $thread.Id -Turns 1 -Raw
```

Return raw JSON response

## Parameters

**-ThreadId string required**

Identifier of the thread to modify.

**-Turns int required**

Number of most recent turns to remove.

**-Client IntelligenceXClient optionalpipeline: true (ByValue)**

Client instance to use. Defaults to the active client.

**-Raw SwitchParameter optional**

Returns the raw JSON-RPC payload instead of typed thread info.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:B64541FE085143658BB1F4F57DAC4DFF3F018059B15E072BC599C017D1F0AF5F -->
