UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

30 lines (29 loc) • 1.53 kB
import type { AssistantMessage, Model, PerModelAuth } from "../../internal/llm.js"; import type { AgentMessage, ThinkingLevel } from "../../internal/harness-types.js"; import type { Brain } from "../types.js"; import type { ModelPricing } from "../pricing.js"; /** The LLM handle for the suggestion pass (mirrors `ConsolidationLLM`). */ export interface SuggestionLLM { brain: Brain; model: Model; pricing: ModelPricing; thinking?: ThinkingLevel; getApiKeyAndHeaders?: (model: Model) => Promise<PerModelAuth | undefined> | PerModelAuth | undefined; signal?: AbortSignal; fastMode?: import("../../brain/fast-mode.js").FastModeCall; } export interface SuggestionResult { suggestions: string[]; tokens: number; costMicroUsd: number; /** The pass's reply, present when a call was made (the caller's trace row reads its usage). */ reply?: AssistantMessage; } /** Parse the model's reply into ≤count clean suggestion strings. Returns [] on anything non-conforming. */ export declare function parseSuggestions(text: string, count: number): string[]; /** * Run ONE suggestion inference pass. May throw on a hard LLM/transport error — the caller * (`Runner.suggestNextPrompts`) is fire-and-forget and swallows, so a failure just yields no suggestions. * Returns `{ suggestions: [], tokens: 0, costMicroUsd: 0 }` when the transcript is empty. */ export declare function generatePromptSuggestions(llm: SuggestionLLM, transcript: AgentMessage[], count: number): Promise<SuggestionResult>;