import { a as EmbedderFn } from './semantic-cache-nBpQqILc.js';
import { a as AdapterHooks, b as AgentRunner, aX as StreamingCallbackRunner } from './types-CRmwFnVk.js';
import '@directive-run/core';

/**
 * @directive-run/ai/openai
 *
 * OpenAI adapter for Directive AI. Provides runners and embedders
 * for OpenAI-compatible APIs (OpenAI, Azure, Together, etc.)
 *
 * @example
 * ```typescript
 * import { createOpenAIRunner, createOpenAIEmbedder } from '@directive-run/ai/openai';
 *
 * const runner = createOpenAIRunner({ apiKey: process.env.OPENAI_API_KEY! });
 * const embedder = createOpenAIEmbedder({ apiKey: process.env.OPENAI_API_KEY! });
 * ```
 */

/**
 * OpenAI model pricing (USD per million tokens).
 *
 * Use with `estimateCost()` for per-call cost tracking:
 * ```typescript
 * import { estimateCost } from '@directive-run/ai';
 * import { OPENAI_PRICING } from '@directive-run/ai/openai';
 *
 * const cost =
 *   estimateCost(result.tokenUsage!.inputTokens, OPENAI_PRICING["gpt-4o"].input) +
 *   estimateCost(result.tokenUsage!.outputTokens, OPENAI_PRICING["gpt-4o"].output);
 * ```
 *
 * **Note:** Pricing changes over time. These values are provided as a convenience
 * and may not reflect the latest rates. Always verify at https://openai.com/pricing
 */
declare const OPENAI_PRICING: Record<string, {
    input: number;
    output: number;
}>;
/** Options for createOpenAIRunner */
interface OpenAIRunnerOptions {
    apiKey: string;
    model?: string;
    maxTokens?: number;
    baseURL?: string;
    fetch?: typeof globalThis.fetch;
    /** @default undefined */
    timeoutMs?: number;
    /** Lifecycle hooks for tracing, logging, and metrics */
    hooks?: AdapterHooks;
    /** Sampling temperature (0–2). Higher = more random. */
    temperature?: number;
    /** Nucleus sampling: top-P probability mass (0–1). */
    topP?: number;
    /** Up to 4 sequences where the API will stop generating. */
    stop?: string | string[];
    /**
     * Response format for structured output.
     * - `"json"` enables JSON mode (`{ type: "json_object" }`)
     * - Object form enables JSON Schema mode (`{ type: "json_schema", json_schema: ... }`)
     */
    responseFormat?: "json" | {
        type: "json_schema";
        json_schema: unknown;
    };
}
/**
 * Create an AgentRunner for OpenAI-compatible APIs (OpenAI, Azure, Together, etc.)
 *
 * Returns `tokenUsage` with input/output breakdown for cost tracking.
 *
 * @example
 * ```typescript
 * // OpenAI
 * const runner = createOpenAIRunner({ apiKey: process.env.OPENAI_API_KEY! });
 *
 * // Azure OpenAI
 * const azure = createOpenAIRunner({
 *   apiKey: process.env.AZURE_KEY!,
 *   baseURL: "https://your-resource.openai.azure.com/v1",
 * });
 *
 * // Together.ai (OpenAI-compatible)
 * const together = createOpenAIRunner({
 *   apiKey: process.env.TOGETHER_KEY!,
 *   baseURL: "https://api.together.xyz/v1",
 * });
 * ```
 */
declare function createOpenAIRunner(options: OpenAIRunnerOptions): AgentRunner;
/** Options for createOpenAIEmbedder */
interface OpenAIEmbedderOptions {
    apiKey: string;
    model?: string;
    dimensions?: number;
    baseURL?: string;
    fetch?: typeof globalThis.fetch;
    /** @default 30000 */
    timeoutMs?: number;
}
/**
 * Create an EmbedderFn that calls the OpenAI embeddings API.
 *
 * @example
 * ```typescript
 * const embedder = createOpenAIEmbedder({ apiKey: process.env.OPENAI_API_KEY! });
 * const embedding = await embedder('How do constraints work?');
 * ```
 */
declare function createOpenAIEmbedder(options: OpenAIEmbedderOptions): EmbedderFn;
/** Options for createOpenAIStreamingRunner */
interface OpenAIStreamingRunnerOptions {
    apiKey: string;
    model?: string;
    maxTokens?: number;
    baseURL?: string;
    fetch?: typeof globalThis.fetch;
    /** Lifecycle hooks for tracing, logging, and metrics */
    hooks?: AdapterHooks;
    /** Sampling temperature (0–2). Higher = more random. */
    temperature?: number;
    /** Nucleus sampling: top-P probability mass (0–1). */
    topP?: number;
    /** Up to 4 sequences where the API will stop generating. */
    stop?: string | string[];
    /**
     * Response format for structured output.
     * - `"json"` enables JSON mode (`{ type: "json_object" }`)
     * - Object form enables JSON Schema mode (`{ type: "json_schema", json_schema: ... }`)
     */
    responseFormat?: "json" | {
        type: "json_schema";
        json_schema: unknown;
    };
}
/**
 * Create a StreamingCallbackRunner for OpenAI-compatible chat completions
 * with server-sent events. Can be used standalone or paired with `createOpenAIRunner`.
 *
 * Returns `tokenUsage` with input/output breakdown for cost tracking.
 *
 * @example
 * ```typescript
 * const streamingRunner = createOpenAIStreamingRunner({
 *   apiKey: process.env.OPENAI_API_KEY!,
 * });
 * const streamRunner = createStreamingRunner(streamingRunner);
 * const { stream, result } = streamRunner(agent, input);
 * ```
 */
declare function createOpenAIStreamingRunner(options: OpenAIStreamingRunnerOptions): StreamingCallbackRunner;

export { OPENAI_PRICING, type OpenAIEmbedderOptions, type OpenAIRunnerOptions, type OpenAIStreamingRunnerOptions, createOpenAIEmbedder, createOpenAIRunner, createOpenAIStreamingRunner };
