-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: begin work on docs for the runtime API (#259)
- Loading branch information
Showing
5 changed files
with
104 additions
and
4 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export default { | ||
runtime: "Runtime API", | ||
"-- integrations": { | ||
title: "Integrations", | ||
type: "separator", | ||
|
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
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,98 @@ | ||
--- | ||
title: Runtime API | ||
description: A React Hook Form integration for @assistant-ui. | ||
--- | ||
|
||
import { ParametersTable } from "@/components/docs"; | ||
|
||
### `AssistantRuntimeProvider` | ||
|
||
The `AssistantRuntimeProvider` is a React component that wraps your entire app and provides the `Runtime` to the rest of your app. | ||
|
||
```tsx {1, 8, 10} | ||
import { AssistantRuntimeProvider } from "@assistant-ui/react"; | ||
const MyApp = () => { | ||
const chat = useChat(); | ||
const runtime = useVercelUseChatRuntime(chat); | ||
return ( | ||
<AssistantRuntimeProvider runtime={runtime}> | ||
{/* your app */} | ||
</AssistantRuntimeProvider> | ||
); | ||
}; | ||
``` | ||
|
||
### Properties | ||
|
||
<ParametersTable | ||
parameters={[ | ||
{ | ||
name: "runtime", | ||
type: 'AssistantRuntime', | ||
required: true, | ||
description: "The runtime to provide to the rest of your app.", | ||
children: [ | ||
{ | ||
parameters: [ | ||
{ | ||
name: "messages", | ||
type: 'readonly ThreadMessage[]', | ||
required: true, | ||
description: "The messages in the thread.", | ||
}, | ||
{ | ||
name: "isRunning", | ||
type: 'boolean', | ||
required: true, | ||
description: "Whether the thread is running.", | ||
}, | ||
{ | ||
name: "getBranches", | ||
type: '(messageId: string) => readonly string[]', | ||
required: true, | ||
description: "A function to get the branches for a message.", | ||
}, | ||
{ | ||
name: "switchToBranch", | ||
type: '(branchId: string) => void', | ||
required: true, | ||
description: "A function to switch to a branch.", | ||
}, | ||
{ | ||
name: "append", | ||
type: '(message: AppendMessage) => void', | ||
required: true, | ||
description: "A function to append a message to the thread.", | ||
}, | ||
{ | ||
name: "startRun", | ||
type: '(parentId: string | null) => void', | ||
required: true, | ||
description: "A function to start a run.", | ||
}, | ||
{ | ||
name: "cancelRun", | ||
type: '() => void', | ||
required: true, | ||
description: "A function to cancel a run.", | ||
}, | ||
{ | ||
name: "subscribe", | ||
type: '(callback: () => void) => Unsubscribe', | ||
required: true, | ||
description: "A function to subscribe to updates.", | ||
}, | ||
{ | ||
name: "registerModelConfigProvider", | ||
type: '(provider: ModelConfigProvider) => Unsubscribe', | ||
required: true, | ||
description: "A function to register a model config provider.", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]} | ||
/> |
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