generateId()
Generates a unique identifier. You can optionally provide the length of the ID.
This is the same id generator used by the AI SDK.
import { generateId } from 'ai';
const id = generateId();
Import
import { generateId } from "ai"
API Signature
Parameters
size:
number
The length of the generated ID. It defaults to 16.
Returns
A string representing the generated ID.