Skip to content

Commit

Permalink
docs: add some jsdocs to runtimes (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Oct 26, 2024
1 parent 9a9c01d commit ecbb912
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/react/src/api/AssistantRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,37 @@ import {
} from "./ThreadManagerRuntime";

export type AssistantRuntime = {
/**
* The currently selected main thread.
*/
thread: ThreadRuntime;

/**
* The thread manager, to rename, archive and delete threads.
*/
threadManager: ThreadManagerRuntime;

/**
* Switch to a new thread.
*/
switchToNewThread(): void;

/**
* Switch to a thread.
*
* @param threadId The thread ID to switch to.
*/
switchToThread(threadId: string): void;
/**
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
*/
switchToThread(threadId: string | null): void;

/**
* Register a model config provider. Model config providers are configuration such as system message, temperature, etc. that are set in the frontend.
*
* @param provider The model config provider to register.
*/
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;

/**
Expand Down
26 changes: 26 additions & 0 deletions packages/react/src/api/ThreadRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,38 @@ export type ThreadRuntimeCoreBinding = SubscribableWithState<
};

export type ThreadState = Readonly<{
/**
* The thread ID.
*/
threadId: string;
/**
* Whether the thread is disabled. Disabled threads cannot receive new messages.
*/
isDisabled: boolean;

/**
* Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.
*/
isRunning: boolean;

/**
* The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.
*/
capabilities: RuntimeCapabilities;

/**
* The messages in the currently selected branch of the thread.
*/
messages: readonly ThreadMessage[];

/**
* Follow up message suggestions to show the user.
*/
suggestions: readonly ThreadSuggestion[];

/**
* Custom extra information provided by the runtime.
*/
extras: unknown;

/**
Expand Down

0 comments on commit ecbb912

Please sign in to comment.