# Adapters
URL: /docs/ink/adapters

Title generation adapters for React Ink.

Adapters customize how the local runtime generates titles. Pass them to `useLocalRuntime` via options.

```tsx
import { useLocalRuntime, createSimpleTitleAdapter } from "@assistant-ui/react-ink";

const runtime = useLocalRuntime(chatModel, {
  titleGenerator: createSimpleTitleAdapter(),
});
```

TitleGenerationAdapter \[#titlegenerationadapter]

Generates a title for a thread based on its messages. Pass via the `titleGenerator` option on `useLocalRuntime`.

```tsx
interface TitleGenerationAdapter {
  generateTitle(messages: ThreadMessage[]): Promise<string>;
}
```

Custom implementation \[#custom-implementation]

```tsx
import type { TitleGenerationAdapter } from "@assistant-ui/react-ink";

const aiTitleGenerator: TitleGenerationAdapter = {
  async generateTitle(messages) {
    const response = await fetch("http://localhost:3000/api/generate-title", {
      method: "POST",
      body: JSON.stringify({ messages }),
    });
    const { title } = await response.json();
    return title;
  },
};

const runtime = useLocalRuntime(chatModel, {
  titleGenerator: aiTitleGenerator,
});
```

Which option to choose? \[#which-option-to-choose]

|                               | ChatModelAdapter + `useLocalRuntime` | RemoteThreadListAdapter + `useRemoteThreadListRuntime` |
| ----------------------------- | ------------------------------------ | ------------------------------------------------------ |
| **Thread storage**            | In-memory                            | Your backend                                           |
| **Message storage**           | In-memory                            | In-memory (can add history adapter for server-side)    |
| **Cross-session persistence** | No                                   | Yes                                                    |
| **Setup complexity**          | Minimal                              | Moderate                                               |
| **Best for**                  | CLI tools, demos, prototypes         | Production apps with persistence                       |
