Function: generateId()
@providerprotocol/ai / utils / generateId
Function: generateId()
Section titled “Function: generateId()”generateId():
string
Defined in: src/utils/id.ts:25
Generates a unique UUID v4 identifier.
Uses the native crypto.randomUUID() when available for cryptographically
secure randomness. Falls back to a Math.random-based implementation for
environments without Web Crypto API support.
Returns
Section titled “Returns”string
A UUID v4 string in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
Example
Section titled “Example”const messageId = generateId();// => "f47ac10b-58cc-4372-a567-0e02b2c3d479"