@mastra/core
Version:
64 lines • 3.29 kB
TypeScript
import type { LanguageModelV2Prompt } from '../../../_types/@ai-sdk_provider@2.0.5/dist/index.js';
import type { IdGenerator, ToolChoice, ToolSet } from '../../../_types/@internal_ai-sdk-v5@0.0.98/dist/index.js';
import type { StructuredOutputOptions } from '../../../agent/types.js';
import type { ModelMethodType } from '../../../llm/model/model.loop.types.js';
import type { MastraLanguageModel, SharedProviderOptions } from '../../../llm/model/shared.types.js';
import type { LoopOptions } from '../../../loop/types.js';
import type { OnResult } from '../../types.js';
type JsonPromptInjection = StructuredOutputOptions<unknown>['jsonPromptInjection'];
type ResolvedJsonPromptInjection = Exclude<JsonPromptInjection, 'auto'>;
export declare function usesOpenAIStrictJsonSchema(model: Pick<MastraLanguageModel, 'provider'> & {
supportsStructuredOutputs?: unknown;
specificationVersion?: unknown;
}, providerOptions?: SharedProviderOptions): boolean;
export declare function resolveJsonPromptInjection(value: JsonPromptInjection, capability: boolean | undefined): ResolvedJsonPromptInjection;
/**
* Whether a step sends a native structured-output schema (`responseFormat`) to the model.
* Tools are dropped under `toolChoice: 'none'` only in this case (#14459); when the schema is
* injected into the prompt instead, tools are kept so providers retain tool history (#25908).
*/
export declare function sendsNativeResponseFormat(structuredOutput: {
schema?: unknown;
model?: unknown;
jsonPromptInjection?: JsonPromptInjection;
} | undefined, model: {
provider: string;
modelId: string;
}): boolean;
type ExecutionProps<OUTPUT = undefined> = {
runId: string;
model: MastraLanguageModel;
providerOptions?: SharedProviderOptions;
inputMessages: LanguageModelV2Prompt;
tools?: ToolSet;
toolChoice?: ToolChoice<ToolSet>;
activeTools?: string[];
options?: {
abortSignal?: AbortSignal;
};
includeRawChunks?: boolean;
modelSettings?: LoopOptions['modelSettings'];
onResult: OnResult;
structuredOutput?: StructuredOutputOptions<OUTPUT>;
/**
Additional HTTP headers to be sent with the request.
Only applicable for HTTP-based providers.
*/
headers?: Record<string, string | undefined>;
shouldThrowError?: boolean;
methodType: ModelMethodType;
generateId?: IdGenerator;
/**
* Called when a provider request fails, before it is retried. A run that lost its thread lease while the
* request was out stops here, so the failed request is its last.
*/
onRequestFailed?: () => void;
/**
* Called when a failed request is about to be sent again, after the retry delay. A run that lost its thread
* lease during that delay has already stopped, so this is only reached by a run that still holds it.
*/
onRequestRetry?: () => void;
};
export declare function execute<OUTPUT = undefined>({ runId, model, providerOptions, inputMessages, tools, toolChoice, activeTools, options, onResult, includeRawChunks, modelSettings, structuredOutput, headers, shouldThrowError, methodType, generateId, onRequestFailed, onRequestRetry, }: ExecutionProps<OUTPUT>): ReadableStream<import("../..").ChunkType>;
export {};
//# sourceMappingURL=execute.d.ts.map