UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

33 lines (32 loc) • 1.43 kB
import type { Model } 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<{ apiKey?: string; headers?: Record<string, string>; } | undefined> | { apiKey?: string; headers?: Record<string, string>; } | undefined; signal?: AbortSignal; } export interface SuggestionResult { suggestions: string[]; tokens: number; costMicroUsd: number; } /** 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>;