Files
agent-chat-ui/agent/types.ts
2025-03-05 12:09:57 -08:00

19 lines
621 B
TypeScript

import { MessagesAnnotation, Annotation } from "@langchain/langgraph";
import {
RemoveUIMessage,
UIMessage,
uiMessageReducer,
} from "@langchain/langgraph-sdk/react-ui/types";
export const GenerativeUIAnnotation = Annotation.Root({
messages: MessagesAnnotation.spec["messages"],
ui: Annotation<
UIMessage[],
UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]
>({ default: () => [], reducer: uiMessageReducer }),
timestamp: Annotation<number>,
next: Annotation<"stockbroker" | "tripPlanner" | "generalInput">(),
});
export type GenerativeUIState = typeof GenerativeUIAnnotation.State;