@assistant-ui/react
Version:
TypeScript/React library for AI Chat
34 lines • 1.75 kB
TypeScript
import { ThreadAssistantContentPart, ThreadUserContentPart, ContentPartStatus, ToolCallContentPartStatus } from "../types/AssistantTypes";
import { ThreadRuntimeCoreBinding } from "./ThreadRuntime";
import { MessageStateBinding } from "./MessageRuntime";
import { SubscribableWithState } from "./subscribable/Subscribable";
import { Unsubscribe } from "../types";
import { ContentPartRuntimePath } from "./RuntimePathTypes";
import { ToolResponse } from "assistant-stream";
export type ContentPartState = (ThreadUserContentPart | ThreadAssistantContentPart) & {
readonly status: ContentPartStatus | ToolCallContentPartStatus;
};
type ContentPartSnapshotBinding = SubscribableWithState<ContentPartState, ContentPartRuntimePath>;
export type ContentPartRuntime = {
/**
* Add tool result to a tool call content part that has no tool result yet.
* This is useful when you are collecting a tool result via user input ("human tool calls").
*/
addToolResult(result: any | ToolResponse<any>): void;
readonly path: ContentPartRuntimePath;
getState(): ContentPartState;
subscribe(callback: () => void): Unsubscribe;
};
export declare class ContentPartRuntimeImpl implements ContentPartRuntime {
private contentBinding;
private messageApi?;
private threadApi?;
get path(): ContentPartRuntimePath;
constructor(contentBinding: ContentPartSnapshotBinding, messageApi?: MessageStateBinding | undefined, threadApi?: ThreadRuntimeCoreBinding | undefined);
protected __internal_bindMethods(): void;
getState(): ContentPartState;
addToolResult(result: any | ToolResponse<any>): void;
subscribe(callback: () => void): Unsubscribe;
}
export {};
//# sourceMappingURL=ContentPartRuntime.d.ts.map