assistant-ui
assistant-ui copied to clipboard
useLocalRuntime does not have `context` field
official documentation talking about tool registration:
const runtime = useLocalRuntime(MyModelAdapter, {
// Tools are passed via context
context: { tools },
});
actual source code:
import { ThreadHistoryAdapter } from "../adapters/thread-history/ThreadHistoryAdapter";
import { AttachmentAdapter } from "../adapters/attachment/AttachmentAdapter";
import { ThreadMessageLike } from "../external-store";
import { FeedbackAdapter } from "../adapters/feedback/FeedbackAdapter";
import { SpeechSynthesisAdapter } from "../adapters/speech/SpeechAdapterTypes";
import { ChatModelAdapter } from "./ChatModelAdapter";
import { AssistantCloud } from "assistant-cloud";
import { SuggestionAdapter } from "../adapters";
export type LocalRuntimeOptionsBase = {
maxSteps?: number | undefined;
adapters: {
chatModel: ChatModelAdapter;
history?: ThreadHistoryAdapter | undefined;
attachments?: AttachmentAdapter | undefined;
speech?: SpeechSynthesisAdapter | undefined;
feedback?: FeedbackAdapter | undefined;
suggestion?: SuggestionAdapter | undefined;
};
/**
* Names of tools that are allowed to interrupt the run in order to wait for human/external approval.
*/
unstable_humanToolNames?: string[] | undefined;
};
// TODO align LocalRuntimeOptions with LocalRuntimeOptionsBase
export type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, "adapters"> & {
cloud?: AssistantCloud | undefined;
initialMessages?: readonly ThreadMessageLike[] | undefined;
adapters?: Omit<LocalRuntimeOptionsBase["adapters"], "chatModel"> | undefined;
};
export const splitLocalRuntimeOptions = <T extends LocalRuntimeOptions>(
options: T,
) => {
const {
cloud,
initialMessages,
maxSteps,
adapters,
unstable_humanToolNames,
...rest
} = options;
return {
localRuntimeOptions: {
cloud,
initialMessages,
maxSteps,
adapters,
unstable_humanToolNames,
},
otherOptions: rest,
};
};
https://www.assistant-ui.com/docs/runtimes/custom/local
Object literal may only specify known properties, and 'context' does not exist in type 'LocalRuntimeOptions'.ts(2353)