UNPKG

@mastra/core

Version:
43 lines • 2.88 kB
import type { MastraLegacyLanguageModel, MastraLanguageModel } from '../llm/model/shared.types.js'; import type { StorageThreadType } from '../memory/index.js'; import type { StandardSchemaWithJSON, InferStandardSchemaOutput } from '../schema/index.js'; import type { FullOutput } from '../stream/base/output.js'; import type { Agent } from './agent.js'; import type { AgentExecutionOptions, AgentExecutionOptionsBase } from './agent.types.js'; import type { MessageListInput } from './message-list/index.js'; import type { StructuredOutputOptions } from './types.js'; export declare const supportedLanguageModelSpecifications: string[]; export declare const isSupportedLanguageModel: (model: MastraLanguageModel | MastraLegacyLanguageModel) => model is MastraLanguageModel; export declare function tryGenerateWithJsonFallback<SCHEMA extends StandardSchemaWithJSON, OUTPUT extends InferStandardSchemaOutput<SCHEMA>>(agent: Agent, prompt: MessageListInput, options: AgentExecutionOptions<OUTPUT>): Promise<FullOutput<OUTPUT>>; export declare function tryGenerateWithJsonFallback<OUTPUT extends {}>(agent: Agent, prompt: MessageListInput, options: AgentExecutionOptions<OUTPUT>): Promise<FullOutput<OUTPUT>>; export declare function tryStreamWithJsonFallback<OUTPUT extends {}>(agent: Agent, prompt: MessageListInput, options: AgentExecutionOptionsBase<OUTPUT> & { structuredOutput: StructuredOutputOptions<OUTPUT>; /** Override injection placement only for the structured-output retry. */ fallbackJsonPromptInjection?: 'system' | 'inline'; onStream?: (stream: Awaited<ReturnType<Agent['stream']>>) => void | Promise<void>; /** Called immediately before each primary or fallback stream invocation. */ onStreamAttempt?: () => void | Promise<void>; /** Called after each stream invocation is consumed, including a failed structured-output attempt. */ onStreamFinish?: (stream: Awaited<ReturnType<Agent['stream']>>) => void | Promise<void>; }): Promise<import("../stream").MastraModelOutput<OUTPUT>>; /** * Normalizes a model-supplied `suspendedToolRunId` at the LLM trust boundary. * Returns `undefined` for non-strings, empty/whitespace-only strings, and known * serialization sentinels (`"null"`, `"undefined"`, `"none"`, `"nil"`, case-insensitive) * so callers can treat them exactly as if the model had omitted the field. * Any other string is returned unchanged (it may be a framework-persisted or * hook-supplied run id, which are not required to be UUIDs). */ export declare function resolveSuspendedToolRunId(value: unknown): string | undefined; export declare function resolveThreadIdFromArgs(args: { memory?: { thread?: string | { id: string; }; }; threadId?: string; overrideId?: string; }): (Partial<StorageThreadType> & { id: string; }) | undefined; //# sourceMappingURL=utils.d.ts.map