assistant-ui 0.0.99 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistant-ui",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "CLI for assistant-ui",
5
5
  "keywords": [
6
6
  "cli",
@@ -124,33 +124,46 @@ const result = streamText({
124
124
 
125
125
  ### Frontend tool UI:
126
126
 
127
- ```tsx
128
- "use client";
127
+ Create a toolkit with a renderer for the tool. The tool executes on the backend, so the entry uses `externalTool()` and only attaches UI:
129
128
 
130
- import { makeAssistantToolUI } from "@assistant-ui/react";
131
-
132
- export const WeatherToolUI = makeAssistantToolUI({
133
- toolName: "get_weather",
134
- render: ({ args, result }) => {
135
- return (
136
- <div>
137
- <p>Weather for {args?.location}</p>
138
- {result && <p>{result.temperature}F, {result.condition}</p>}
139
- </div>
140
- );
129
+ ```tsx
130
+ // app/toolkit.tsx
131
+ "use generative";
132
+
133
+ import { defineToolkit, externalTool } from "@assistant-ui/react";
134
+
135
+ export default defineToolkit({
136
+ get_weather: {
137
+ execute: externalTool(),
138
+ render: ({ args, result }) => {
139
+ return (
140
+ <div>
141
+ <p>Weather for {args?.location}</p>
142
+ {result && <p>{result.temperature}F, {result.condition}</p>}
143
+ </div>
144
+ );
145
+ },
141
146
  },
142
147
  });
143
148
  ```
144
149
 
145
- Register the tool UI in your assistant component:
150
+ Register the toolkit in your assistant component:
146
151
 
147
152
  ```tsx
148
- <AssistantRuntimeProvider runtime={runtime}>
149
- <WeatherToolUI />
153
+ import { AssistantRuntimeProvider, Tools, useAui } from "@assistant-ui/react";
154
+ import toolkit from "@/app/toolkit";
155
+
156
+ const aui = useAui({
157
+ tools: Tools({ toolkit }),
158
+ });
159
+
160
+ <AssistantRuntimeProvider aui={aui} runtime={runtime}>
150
161
  <Thread />
151
162
  </AssistantRuntimeProvider>
152
163
  ```
153
164
 
165
+ Do not use `makeAssistantToolUI`, `useAssistantToolUI`, `makeAssistantTool`, or `useAssistantTool`; they are deprecated in favor of toolkits.
166
+
154
167
  ## Key Packages
155
168
 
156
169
  | Package | Purpose |