@0xplaygrounds/rig-wasm
Version:
A TS and WebAssembly-based port of the Rust agentic AI framework Rig.
30 lines (29 loc) • 765 B
TypeScript
import { JSONObject } from "./types";
export declare function decodeReadableStream(stream: ReadableStream<unknown>): AsyncGenerator<RawStreamingChoice>;
/**
* A delta from a streamed completion response.
* Typically, you may see it used like this:
*
* @example
* const result = await decodeReadableStream<StreamingCompletionResponse>();
*
*/
export type RawStreamingChoice = Text | ToolCallChoice | {
usage: number;
};
export interface Text {
text: string;
}
/**
* A tool call choice.
* This may be returned as a result of a streamed completion response.
*/
export interface ToolCallChoice {
id: string;
call_id?: string;
function: ToolCallFunction;
}
export interface ToolCallFunction {
name: string;
arguments: JSONObject;
}