---
url: 'https://adk.nht.io/api/@nhtio/adk/batteries/functions/filterThoughts.md'
---

# Function: filterThoughts()

```ts
function filterThoughts(
  thoughts: Iterable<Thought>,
  mode: "all" | "all-self" | "latest-self",
  selfIdentity: string,
  replayCompatibility: readonly string[],
): Thought[];
```

Defined in: [src/batteries/llm/chat\_common/helpers.ts:795](https://github.com/NHTIO/ADK/blob/v1.20261003.0/src/src/batteries/llm/chat_common/helpers.ts#L795)

Implements [ChatHelpersCommon.filterThoughts](../llm/openai_responses/interfaces/ChatHelpersCommon.md#property-filterthoughts).

## Parameters

| Parameter             | Type                                                       |
| --------------------- | ---------------------------------------------------------- |
| `thoughts`            | `Iterable`<[`Thought`](../../common/classes/Thought.md)> |
| `mode`                | `"all"` | `"all-self"` | `"latest-self"`                 |
| `selfIdentity`        | `string`                                                   |
| `replayCompatibility` | readonly `string`\[]                                        |

## Returns

[`Thought`](../../common/classes/Thought.md)\[]
