@assistant-ui/react-native
TypeScript icon, indicating that this package has built-in type declarations

0.1.26 • Public • Published

@assistant-ui/react-native

npm version npm downloads GitHub stars License

React Native bindings for assistant-ui. Native primitives for Thread, Composer, Message, and ThreadList that share the same runtime and adapters as @assistant-ui/react.

Installation

npm install @assistant-ui/react-native

Usage

import {
  AssistantRuntimeProvider,
  useLocalRuntime,
  type ChatModelAdapter,
} from "@assistant-ui/react-native";

const adapter: ChatModelAdapter = {
  async *run({ messages }) {
    yield { content: [{ type: "text", text: "Hello!" }] };
  },
};

export function App() {
  const runtime = useLocalRuntime(adapter);
  return (
    <AssistantRuntimeProvider runtime={runtime}>
      {/* Thread, Composer, Message primitives */}
    </AssistantRuntimeProvider>
  );
}

Documentation

Full primitives, hooks, and adapter reference at assistant-ui.com/docs/react-native.

For other platforms