Files
agent-chat-ui/agent/types.ts

19 lines
622 B
TypeScript
Raw Normal View History

2025-02-27 15:41:47 -08:00
import { MessagesAnnotation, Annotation } from "@langchain/langgraph";
2025-03-05 12:09:57 -08:00
import {
RemoveUIMessage,
UIMessage,
uiMessageReducer,
2025-03-05 17:58:51 +01:00
} from "@langchain/langgraph-sdk/react-ui/server";
2025-02-27 15:41:47 -08:00
export const GenerativeUIAnnotation = Annotation.Root({
messages: MessagesAnnotation.spec["messages"],
2025-03-05 12:09:57 -08:00
ui: Annotation<
UIMessage[],
UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]
>({ default: () => [], reducer: uiMessageReducer }),
2025-02-27 15:41:47 -08:00
timestamp: Annotation<number>,
2025-03-03 16:51:46 -08:00
next: Annotation<"stockbroker" | "tripPlanner" | "generalInput">(),
2025-02-27 15:41:47 -08:00
});
export type GenerativeUIState = typeof GenerativeUIAnnotation.State;