-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (docs): add generateId reference docs (#1942)
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
content/docs/07-reference/stream-helpers/50-generate-id.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: generateId | ||
description: Generate a unique identifier (API Reference) | ||
--- | ||
|
||
# `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. | ||
|
||
```ts | ||
import { generateId } from 'ai'; | ||
|
||
const id = generateId(); | ||
``` | ||
|
||
## Import | ||
|
||
<Snippet text={`import { generateId } from "ai"`} prompt={false} /> | ||
|
||
## API Signature | ||
|
||
### Parameters | ||
|
||
<PropertiesTable | ||
content={[ | ||
{ | ||
name: 'size', | ||
type: 'number', | ||
description: `The length of the generated ID. It defaults to 8.`, | ||
}, | ||
]} | ||
/> | ||
|
||
### Returns | ||
|
||
A string representing the generated ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters