import type { LanguageModelV2ToolChoice } from '@ai-sdk/provider'; import { Model, ModelRetryAdvice, ModelRetryAdviceRequest, ModelRequest, ResponseStreamEvent, Usage, ModelSettingsToolChoice, HostedTool } from '@openai/agents'; import type { LanguageModelCompatible, AiSdkSpecificationVersion } from './modelTypes'; export { parseArguments } from './messageConversion'; /** * Provider tool definition returned by an AI SDK provider tool factory. */ export type AiSdkProviderTool = { type?: string; id?: string; args?: Record; }; /** * Adapts an AI SDK provider's server-executed tool-search definition for use * with an Agents SDK agent. * * @param providerTool - A provider tool returned by an AI SDK tool factory. * @returns A hosted tool-search tool understood by the AI SDK adapter. */ export declare function aiSdkToolSearchTool(providerTool: AiSdkProviderTool): HostedTool; export type AiSdkOutputTextTransformContext = { request: ModelRequest; provider: string; modelId: string; specificationVersion: AiSdkSpecificationVersion; stream: boolean; }; export type AiSdkOutputTextTransform = (text: string, context: AiSdkOutputTextTransformContext) => string | Promise; export type AiSdkModelOptions = { /** * Optional hook to normalize finalized assistant text emitted by the adapter. * Runs on non-stream responses and on the final `response_done` event for * streams. Incremental `output_text_delta` events are not transformed. */ transformOutputText?: AiSdkOutputTextTransform; }; /** * Wraps a model from the AI SDK that adheres to the LanguageModel v2, v3, or v4 * specification to be used as a model in the OpenAI Agents SDK. * * While you can use this with the OpenAI models, it is recommended to use the default OpenAI model * provider instead. * * If tracing is enabled, the model will send generation spans to your traces processor. * * ```ts * import { aisdk } from '@openai/agents-extensions/ai-sdk'; * import { openai } from '@ai-sdk/openai'; * * const model = aisdk(openai('gpt-4o')); * * const agent = new Agent({ * name: 'My Agent', * model * }); * ``` * * @param model - The Vercel AI SDK model to wrap. * @returns The wrapped model. */ export declare class AiSdkModel implements Model { #private; constructor(model: LanguageModelCompatible, options?: AiSdkModelOptions); getRetryAdvice(args: ModelRetryAdviceRequest): ModelRetryAdvice | undefined; getResponse(request: ModelRequest): Promise<{ readonly rawUsage?: Record | undefined; readonly responseId: any; readonly usage: Usage; readonly output: import("@openai/agents").AgentOutputItem[]; readonly providerData: any; }>; getStreamedResponse(request: ModelRequest): AsyncIterable; } /** * Wraps a model from the AI SDK that adheres to the LanguageModel v2, v3, or v4 * specification to be used as a model in the OpenAI Agents SDK. * * While you can use this with the OpenAI models, it is recommended to use the default OpenAI model * provider instead. * * If tracing is enabled, the model will send generation spans to your traces processor. * * ```ts * import { aisdk } from '@openai/agents-extensions/ai-sdk'; * import { openai } from '@ai-sdk/openai'; * * const model = aisdk(openai('gpt-4o')); * * const agent = new Agent({ * name: 'My Agent', * model * }); * ``` * * @param model - The Vercel AI SDK model to wrap. * @param options - Optional AI SDK adapter behavior overrides. * @returns The wrapped model. */ export declare function aisdk(model: LanguageModelCompatible, options?: AiSdkModelOptions): AiSdkModel; export declare function toolChoiceToLanguageV2Format(toolChoice: ModelSettingsToolChoice | undefined): LanguageModelV2ToolChoice | undefined;