Skip to content

Commit

Permalink
feat!: experimental features are now marked as stable (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jun 26, 2024
1 parent de20b1c commit 2ab2cab
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 88 deletions.
8 changes: 8 additions & 0 deletions .changeset/soft-horses-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@assistant-ui/react-hook-form": minor
"@assistant-ui/react-ai-sdk": minor
"@assistant-ui/react-ui": minor
"@assistant-ui/react": minor
---

feat!: experimental features are now marked as stable
2 changes: 1 addition & 1 deletion apps/www/components/claude/Claude.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
MessagePrimitive,
ThreadPrimitive,
} from "@assistant-ui/react";
import { useMessageContext } from "@assistant-ui/react/experimental";
import { useMessageContext } from "@assistant-ui/react";
import * as Avatar from "@radix-ui/react-avatar";
import { ArrowUpIcon, ClipboardIcon, ReloadIcon } from "@radix-ui/react-icons";
import type { FC } from "react";
Expand Down
8 changes: 4 additions & 4 deletions apps/www/pages/docs/advanced/ToolUI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You can show a custom UI when a tool is called to let the user know what is happ
### Tool UI Components

```tsx
import { makeAssistantToolUI } from "@assistant-ui/react/experimental";
import { makeAssistantToolUI } from "@assistant-ui/react";

type WebSearchArgs = {
query: string;
Expand Down Expand Up @@ -47,7 +47,7 @@ const MyApp = () => {
### Tool UI Hooks

```tsx
import { makeAssistantToolUI } from "@assistant-ui/react/experimental";
import { makeAssistantToolUI } from "@assistant-ui/react";

type WebSearchArgs = {
query: string;
Expand Down Expand Up @@ -97,7 +97,7 @@ const MyApp = () => {
If you need access to component props, you can use the `useAssistantToolUI` hook.

```tsx {5-11}
import { useAssistantToolUI } from "@assistant-ui/react/experimental";
import { useAssistantToolUI } from "@assistant-ui/react";
import { useCallback } from "react";

const MyComponent = ({ product_id }) => {
Expand Down Expand Up @@ -129,7 +129,7 @@ const MyApp = () => {
The following example shows a `date_picker` tool that the AI can call to collect a date from the user.

```tsx {12}
import { makeAssistantToolUI } from "@assistant-ui/react/experimental";
import { makeAssistantToolUI } from "@assistant-ui/react";
import { DatePicker } from "@/components/datepicker";

const DatePickerToolUI = makeAssistantToolUI<{}, { date: string }>({
Expand Down
12 changes: 0 additions & 12 deletions apps/www/pages/docs/migrations/v0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,3 @@ The `RSCMessage` type was renamed to `VercelRSCMessage`.
- import { unstable_useLocalRuntime, unstable_ChatModelAdapter } from "@assistant-ui/react";
+ import { useLocalRuntime, ChatModelAdapter } from "@assistant-ui/react";
```

## `@assistant-ui/react/experimental` replaces `unstable_` imports

```diff
- import { unstable_VercelModelAdapter } from "@assistant-ui/react";
+ import { VercelModelAdapter } from "@assistant-ui/react/experimental";
```

```diff
- import { unstable_VercelAIThreadState } from "@assistant-ui/react";
+ import { VercelAIThreadState } from "@assistant-ui/react/experimental";
```
11 changes: 11 additions & 0 deletions apps/www/pages/docs/migrations/v0.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,15 @@ const AssistantMessage = () => {
...
);
};
```

## Experimental features are now stable

All features that were previously marked as experimental have been promoted to stable.

Update all imports from `@assistant-ui/react/experimental` to `@assistant-ui/react`.

```diff
- import { makeAssistantToolUI } from "@assistant-ui/react/experimental";
+ import { makeAssistantToolUI } from "@assistant-ui/react";
```
2 changes: 1 addition & 1 deletion examples/with-react-hook-form/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SignupForm } from "@/components/SignupForm";
import { AssistantSidebar } from "@/components/ui/assistant-ui/assistant-sidebar";
import { Form } from "@/components/ui/form";
import { useAssistantForm } from "@assistant-ui/react-hook-form";
import { useAssistantInstructions } from "@assistant-ui/react/experimental";
import { useAssistantInstructions } from "@assistant-ui/react";
import Link from "next/link";

const SetFormFieldTool = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ai-sdk/src/core/VercelModelAdapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ChatModelAdapter,
ChatModelRunOptions,
} from "@assistant-ui/react";
import type { ToolCallContentPart } from "@assistant-ui/react/experimental";
import type { ToolCallContentPart } from "@assistant-ui/react";
import { type CoreTool, type LanguageModel, streamText } from "ai";
import { convertToCoreMessage } from "./convertToCoreMessage";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
useThreadContext,
ComposerState,
} from "@assistant-ui/react/experimental";
import { useThreadContext, ComposerState } from "@assistant-ui/react";
import { useEffect } from "react";
import type { VercelHelpers } from "./VercelHelpers";
import { StoreApi } from "zustand";
Expand Down
7 changes: 5 additions & 2 deletions packages/react-ai-sdk/src/ui/utils/useVercelAIThreadSync.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { TextContentPart, ThreadMessage } from "@assistant-ui/react";
import type { ToolCallContentPart } from "@assistant-ui/react/experimental";
import type {
TextContentPart,
ThreadMessage,
ToolCallContentPart,
} from "@assistant-ui/react";
import type { Message } from "ai";
import { useEffect, useMemo } from "react";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hook-form/src/useAssistantForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type ToolCallContentPartComponent,
useAssistantContext,
useAssistantToolUI,
} from "@assistant-ui/react/experimental";
} from "@assistant-ui/react";
import { useEffect } from "react";
import {
type FieldValues,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/context/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./providers";
export * from "./stores";
export * from "./react";
2 changes: 1 addition & 1 deletion packages/react/src/context/stores/AssistantModelConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { create } from "zustand";
import type { ModelConfigProvider } from "../../utils/ModelConfigTypes";
import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
import { ProxyConfigProvider } from "../../utils/ProxyConfigProvider";

export type AssistantModelConfigState = Readonly<{
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/context/stores/Composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type BaseComposerState, makeBaseComposer } from "./BaseComposer";
import type { ThreadState } from "./Thread";
import { ThreadActionsState } from "./ThreadActions";
import { ReadonlyStore } from "../ReadonlyStore";
import { Unsubscribe } from "../../utils/Unsubscribe";
import { Unsubscribe } from "../../types/Unsubscribe";

export type ComposerState = BaseComposerState &
Readonly<{
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/context/stores/ThreadViewport.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { create } from "zustand";
import type { Unsubscribe } from "../../utils/Unsubscribe";
import type { Unsubscribe } from "../../types/Unsubscribe";

export type ThreadViewportState = Readonly<{
isAtBottom: boolean;
Expand Down
34 changes: 0 additions & 34 deletions packages/react/src/experimental.ts
Original file line number Diff line number Diff line change
@@ -1,34 +0,0 @@
export type {
ImageContentPart,
ToolCallContentPart,
UIContentPart,
} from "./types/AssistantTypes";

export type {
ModelConfigProvider,
ModelConfig,
} from "./utils/ModelConfigTypes";

export type {
TextContentPartProps,
TextContentPartComponent,
ImageContentPartProps,
ImageContentPartComponent,
UIContentPartProps,
UIContentPartComponent,
ToolCallContentPartProps,
ToolCallContentPartComponent,
} from "./types/ContentPartComponentTypes";

export * from "./context";
export { useAssistantInstructions } from "./model-config/useAssistantInstructions";
export {
useAssistantTool,
type AssistantToolProps,
} from "./model-config/useAssistantTool";
export {
useAssistantToolUI,
type AssistantToolUIProps,
} from "./model-config/useAssistantToolUI";
export { makeAssistantTool } from "./model-config/makeAssistantTool";
export { makeAssistantToolUI } from "./model-config/makeAssistantToolUI";
19 changes: 3 additions & 16 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
export * from "./primitive-hooks";
export * from "./primitives";
export * from "./runtime";

export type {
ThreadMessage,
AssistantMessage,
UserMessage,
AppendMessage,
AssistantContentPart,
UserContentPart,
AppendContentPart,
TextContentPart,
} from "./types/AssistantTypes";

export { AssistantRuntimeProvider } from "./context/providers/AssistantRuntimeProvider";

// utils
export type { Unsubscribe } from "./utils/Unsubscribe";
export * from "./context";
export * from "./model-config";
export * from "./types";

export * as INTERNAL from "./internal";
8 changes: 8 additions & 0 deletions packages/react/src/model-config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { makeAssistantTool } from "./makeAssistantTool";
export { makeAssistantToolUI } from "./makeAssistantToolUI";
export { useAssistantInstructions } from "./useAssistantInstructions";
export { useAssistantTool, type AssistantToolProps } from "./useAssistantTool";
export {
useAssistantToolUI,
type AssistantToolUIProps,
} from "./useAssistantToolUI";
2 changes: 1 addition & 1 deletion packages/react/src/model-config/useAssistantTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useEffect } from "react";
import { useAssistantContext } from "../context/react/AssistantContext";
import type { ToolCallContentPartComponent } from "../types/ContentPartComponentTypes";
import type { Tool } from "../utils/ModelConfigTypes";
import type { Tool } from "../types/ModelConfigTypes";

export type AssistantToolProps<TArgs, TResult> = Tool<TArgs, TResult> & {
toolName: string;
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/model-config/useAssistantToolUI.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";

import { useEffect } from "react";
import { useAssistantContext } from "../context/react/AssistantContext";
import type { ToolCallContentPartComponent } from "../types/ContentPartComponentTypes";
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/runtime/core/AssistantRuntime.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ModelConfigProvider } from "../../utils/ModelConfigTypes";
import type { Unsubscribe } from "../../utils/Unsubscribe";
import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
import type { Unsubscribe } from "../../types/Unsubscribe";
import type { ThreadRuntime } from "./ThreadRuntime";

export type AssistantRuntime = ThreadRuntime & {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/runtime/core/ThreadRuntime.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ThreadState } from "../../context";
import { ThreadActionsState } from "../../context/stores/ThreadActions";
import type { Unsubscribe } from "../../utils/Unsubscribe";
import type { Unsubscribe } from "../../types/Unsubscribe";

export type ThreadRuntime = Readonly<
ThreadState &
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/runtime/local/ChatModelAdapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
AssistantContentPart,
ThreadMessage,
} from "../../types/AssistantTypes";
import type { ModelConfig } from "../../utils/ModelConfigTypes";
import type { ModelConfig } from "../../types/ModelConfigTypes";

export type ChatModelRunResult = {
content: AssistantContentPart[];
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/runtime/local/LocalRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
import {
type ModelConfigProvider,
mergeModelConfigs,
} from "../../utils/ModelConfigTypes";
import type { Unsubscribe } from "../../utils/Unsubscribe";
} from "../../types/ModelConfigTypes";
import type { Unsubscribe } from "../../types/Unsubscribe";
import type { AssistantRuntime } from "../core/AssistantRuntime";
import { MessageRepository } from "../utils/MessageRepository";
import { generateId } from "../utils/idUtils";
Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions packages/react/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export type {
ThreadMessage,
AssistantMessage,
UserMessage,
AppendMessage,
AssistantContentPart,
UserContentPart,
AppendContentPart,
TextContentPart,
ImageContentPart,
ToolCallContentPart,
UIContentPart,
} from "./AssistantTypes";

export type {
TextContentPartProps,
TextContentPartComponent,
ImageContentPartProps,
ImageContentPartComponent,
UIContentPartProps,
UIContentPartComponent,
ToolCallContentPartProps,
ToolCallContentPartComponent,
} from "./ContentPartComponentTypes";

export type { ModelConfig } from "./ModelConfigTypes";

export type { Unsubscribe } from "./Unsubscribe";
2 changes: 1 addition & 1 deletion packages/react/src/utils/ProxyConfigProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {
type ModelConfigProvider,
mergeModelConfigs,
} from "./ModelConfigTypes";
} from "../types/ModelConfigTypes";

export class ProxyConfigProvider {
private _providers = new Set<ModelConfigProvider>();
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/utils/combined/createCombinedStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useSyncExternalStore } from "react";
import type { Unsubscribe } from "../Unsubscribe";
import type { Unsubscribe } from "../../types/Unsubscribe";
import { ReadonlyStore } from "../../context/ReadonlyStore";

export type CombinedSelector<T extends Array<unknown>, R> = (...args: T) => R;
Expand Down

0 comments on commit 2ab2cab

Please sign in to comment.