eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
38 lines (37 loc) • 1.66 kB
TypeScript
import type { MockLanguageModelV3 } from "ai/test";
export type BootstrapGenerateOptions = Parameters<MockLanguageModelV3["doGenerate"]>[0];
export type BootstrapPrompt = BootstrapGenerateOptions["prompt"];
export type BootstrapGenerateResult = Awaited<ReturnType<MockLanguageModelV3["doGenerate"]>>;
type BootstrapStreamResult = Awaited<ReturnType<MockLanguageModelV3["doStream"]>>;
/**
* Builds a deterministic `doGenerate` result from a text response and token
* estimates. Shared by the real bootstrap model and the authored-model mock.
*/
export declare function createBootstrapGenerateResult(input: {
readonly inputTokens: number;
readonly modelId: string;
readonly outputTokens: number;
readonly text: string;
}): BootstrapGenerateResult;
/**
* Converts a `doGenerate` result into a synchronous `doStream` result by
* replaying content parts through a `ReadableStream`.
*/
export declare function createBootstrapStreamResult(result: BootstrapGenerateResult): BootstrapStreamResult;
/**
* Rough token estimate based on character length (1 token per 4 chars).
*/
export declare function estimateTokenCount(value: string): number;
/**
* Extracts all text from a prompt message's content, joining text parts.
*/
export declare function getPromptContentText(content: BootstrapPrompt[number]["content"]): string;
/**
* Returns the text from the last user message in the prompt, or `null`.
*/
export declare function getLastUserPromptText(prompt: BootstrapPrompt): string | null;
/**
* Joins all message content in the prompt into a single string.
*/
export declare function getPromptText(prompt: BootstrapPrompt): string;
export {};