@octoryn/react
v0.2.1
Published
React hooks for governed Octoryn chat and UI streams.
Readme
@octoryn/react
React hooks for governed Octoryn chat.
import { Octoryn } from "@octoryn/sdk";
import { useOctorynChat } from "@octoryn/react";
const client = new Octoryn({ apiKey: token });
function Chat() {
const { messages, status, sendMessage, resume, regenerate, editMessage, stop } = useOctorynChat({
client,
model: "openai/gpt-4.1-mini",
});
// Render message.parts rather than assuming every message is plain text.
// Parts can include governance, tools, sources, files and errors.
}The hook deliberately does not execute an autonomous agent loop or claim an agent API on the Router.
For single-prompt streaming, use useCompletion:
const { completion, status, complete, stop } = useCompletion({
client,
model: "openai/gpt-4.1-mini",
});useObject streams display-safe partial values and strictly parses the final
object at the hook boundary. Pass a Zod schema directly, or a
{ request, parse } adapter for raw JSON Schema. Custom UITransport and
ordered stream transforms are accepted by every hook.
