/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { AiProviderRunFn, ToolCallingTaskInput, ToolCallingTaskOutput } from "@workglow/ai"; import { RetryableJobError } from "@workglow/job-queue"; import type { DeepSeekModelConfig } from "./DeepSeek_ModelSchema"; /** * Thrown when the caller demanded a tool call that the model did not make. * * Retryable: the model was *asked* for the call and simply didn't produce one, * which is nondeterministic rather than structurally impossible — a re-roll is * a legitimate remedy, so the job-queue retry policy applies. Extending * {@link RetryableJobError} is what lets {@link classifyProviderError} pass the * error through unchanged instead of wrapping it as a `PermanentJobError`. */ export declare class DeepSeekToolChoiceNotHonoredError extends RetryableJobError { readonly modelId: string; readonly requestedToolChoice: string; static type: string; constructor(modelId: string, requestedToolChoice: string, detail: string); } /** * Whether `toolChoice` demands a call — i.e. `"required"` (any tool) or a * specific function name. `undefined` / `"auto"` / `"none"` demand nothing. */ export declare function isForcingToolChoice(toolChoice: string | undefined): toolChoice is string; /** * Enforce a forcing `toolChoice` after the fact, since DeepSeek cannot enforce * it server-side. * * This mirrors how json-mode is handled here: the vendor gives no guarantee, so * the guarantee is re-established by checking the response rather than by * silently dropping the caller's constraint. `"required"` needs at least one * call; a named function needs that specific function to have been called. * * Only calls that survived {@link filterValidToolCalls} count — a hallucinated * function name does not satisfy the request. */ export declare function assertToolChoiceHonored(toolChoice: string, calledNames: readonly string[], modelId: string): void; /** * Streaming run-fn for `["text.generation", "tool-use"]`. Calls the DeepSeek * chat-completions endpoint (OpenAI-compatible) with `stream: true` and * forwards delta events via {@link accumulateOpenAIChatStream}, which emits * `text-delta` and tool-call `object-delta` events plus a final empty * `finish`. * * Defence-in-depth: each tool-call `object-delta` is filtered against * `input.tools` so a hallucinated function name never reaches the consumer. */ export declare const DeepSeek_ToolCalling_Stream: AiProviderRunFn;