Skip to content

Commit

Permalink
feat (docs): add generateId reference docs (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel committed Jun 13, 2024
1 parent 6a0fcc9 commit 17e5bbb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
38 changes: 38 additions & 0 deletions content/docs/07-reference/stream-helpers/50-generate-id.mdx
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.
9 changes: 8 additions & 1 deletion content/docs/07-reference/stream-helpers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,12 @@ description: Learn to use help functions that help stream generations from diffe
"Transforms the response from Inkeeps's language models into a readable stream.",
href: '/docs/reference/stream-helpers/inkeep-stream',
},
]}
{
title: 'generateId()',
description:
'Helper function for generating unique IDs',
href: '/docs/reference/stream-helpers/generate-id',
}

]}
/>

0 comments on commit 17e5bbb

Please sign in to comment.