import type { CompletionRequest } from '../types/messages.js'; import type { NexusResponse } from '../types/response.js'; import { type DecisionProvider } from './core.js'; /** Anything that completes a request, such as a `NexusAI` client. */ export interface DecisionCompletionClient { /** Runs one completion. */ complete(request: CompletionRequest): Promise; } /** How a completion model's probabilities are read. */ export type CompletionDecisionMethod = 'auto' | 'logprobs' | 'sampling'; /** Options for `completionDecisions()`. */ export interface CompletionDecisionsOptions { /** The model to ask, as the client names it. */ model: string; /** The provider's name in results. Defaults to `model`. */ name?: string; /** * How probabilities are read: `logprobs`, from one call's token log probabilities; `sampling`, by * counting the answers of several calls; or `auto`, the default: log probabilities, and sampling for * a model that reports none or refuses to, which it then asks by sampling from the start. */ method?: CompletionDecisionMethod; /** Calls per question, when sampling, and per box. Defaults to 8. */ samples?: number; /** * Whether the model reads pictures, so a decision about the pictures a state holds, or a box, may * be asked of it. Defaults to `true`; set `false` for a text-only model, which such a decision then * passes over to a fallback. */ images?: boolean; /** The temperature samples are drawn at. Defaults to 1. */ temperature?: number; /** Questions asked at once. Defaults to 8. */ concurrency?: number; /** Instructions added to every question, such as what the application's terms mean. */ instructions?: string; } /** * Any completion model as a decision provider, through a client's own `complete()`, so every call is * routed, authorized, budgeted, traced, and priced as every completion is. Each question is asked on * its own, at temperature 0, to answer with one code: a letter per option, Y or N, or a level's digit. * Its probabilities are read from the log probabilities of that token's alternatives where the model * reports them, the way TypeSafe AI's Jev reads its own; elsewhere the question is asked `samples` * times, and each answer counted. Sampled probabilities come in steps of one sample, and cost as many * calls. The pictures a state holds are shown to the model after the state, each labelled by its * path; a box is asked `samples` times, and is the median of each edge, its confidence how far the * samples overlap it. */ export declare function completionDecisions(client: DecisionCompletionClient, options: CompletionDecisionsOptions): DecisionProvider & { readonly sampledModels: ReadonlySet; };