import { EmbeddingModelV3, EmbeddingModelV3CallOptions, EmbeddingModelV3Result, LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, ProviderV3 } from '@ai-sdk/provider';
import { DeploymentIdConfig, ResourceGroupConfig } from '@sap-ai-sdk/ai-api/internal.js';
import { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
import { AzureOpenAiChatCompletionParameters } from '@sap-ai-sdk/foundation-models';
import { FilteringModule, GroundingModule, MaskingModule, OrchestrationConfigRef, ChatCompletionTool, TranslationModule, ChatModel } from '@sap-ai-sdk/orchestration';
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, DeveloperChatMessage, DocumentTranslationApplyToSelector, FilteringModule, FunctionObject, GroundingModule, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationEmbeddingClient, OrchestrationEmbeddingResponse, OrchestrationErrorResponse, OrchestrationModuleConfig, OrchestrationResponse, OrchestrationStream, OrchestrationStreamChunkResponse, OrchestrationStreamResponse, PromptTemplatingModule, SystemChatMessage, ToolChatMessage, TranslationApplyToCategory, TranslationInputParameters, TranslationModule, TranslationOutputParameters, TranslationTargetLanguage, UserChatMessage, buildAzureContentSafetyFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildLlamaGuard38BFilter, buildTranslationConfig } from '@sap-ai-sdk/orchestration';
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
import { InferSchema } from '@ai-sdk/provider-utils';

/**
 * Escapes Jinja2 template delimiters by inserting zero-width spaces.
 *
 * Converts `{{`, `{%`, `{#` to `{\u200B{`, `{\u200B%`, `{\u200B#` respectively.
 * This prevents SAP orchestration from interpreting user content as template syntax.
 * @param text - The text to escape.
 * @returns The escaped text with zero-width spaces inserted.
 * @see {@link unescapeOrchestrationPlaceholders} for the reverse operation.
 */
declare function escapeOrchestrationPlaceholders(text: string): string;
/**
 * Reverses escaping by removing zero-width spaces from template delimiters.
 *
 * Useful for processing model responses that may contain escaped delimiters.
 * @param text - The text to unescape.
 * @returns The unescaped text with zero-width spaces removed.
 * @see {@link escapeOrchestrationPlaceholders} for the escaping operation.
 */
declare function unescapeOrchestrationPlaceholders(text: string): string;

/** Azure OpenAI chat extension configuration for "On Your Data" RAG scenarios. */
type AzureOpenAiChatExtensionConfiguration = NonNullable<AzureOpenAiChatCompletionParameters["data_sources"]>[number];
/**
 * Common model parameters shared between both APIs.
 *
 * These parameters control text generation behavior and are validated by Zod schemas
 * when passed via `providerOptions`.
 */
interface CommonModelParams {
    /**
     * Frequency penalty to reduce repetition of token sequences.
     * Range: -2.0 to 2.0
     */
    readonly frequencyPenalty?: number;
    /**
     * Maximum number of tokens to generate.
     * Range: Positive integer
     */
    readonly maxTokens?: number;
    /**
     * Number of completions to generate.
     * Not supported by Amazon/Anthropic models.
     * Range: Positive integer
     */
    readonly n?: number;
    /** Whether to enable parallel tool calls when multiple tools are available. */
    readonly parallel_tool_calls?: boolean;
    /**
     * Presence penalty to encourage talking about new topics.
     * Range: -2.0 to 2.0
     */
    readonly presencePenalty?: number;
    /** Index signature for additional model-specific parameters. */
    readonly [key: string]: unknown;
    /**
     * Sampling temperature controlling randomness.
     * Higher values (e.g., 1.0) make output more random, lower values (e.g., 0.2) more deterministic.
     * Range: 0 to 2
     */
    readonly temperature?: number;
    /**
     * Nucleus sampling parameter. Only tokens with cumulative probability up to `topP` are considered.
     * Range: 0 to 1
     */
    readonly topP?: number;
}
/** Default settings configuration when using Foundation Models API. */
interface FoundationModelsDefaultSettings {
    readonly api: "foundation-models";
    readonly settings?: FoundationModelsModelSettings;
}
/** Model parameters for Foundation Models Embedding API. */
interface FoundationModelsEmbeddingParams {
    readonly dimensions?: number;
    readonly encoding_format?: "base64" | "float";
    readonly user?: string;
}
/** Model parameters for Foundation Models API with Azure OpenAI-specific extensions. */
interface FoundationModelsModelParams extends CommonModelParams {
    readonly logit_bias?: AzureOpenAiChatCompletionParameters["logit_bias"];
    readonly logprobs?: AzureOpenAiChatCompletionParameters["logprobs"];
    readonly seed?: AzureOpenAiChatCompletionParameters["seed"];
    readonly stop?: AzureOpenAiChatCompletionParameters["stop"];
    /** Requires logprobs=true. */
    readonly top_logprobs?: AzureOpenAiChatCompletionParameters["top_logprobs"];
    readonly user?: AzureOpenAiChatCompletionParameters["user"];
}
/** Model settings when using Foundation Models API. */
interface FoundationModelsModelSettings {
    readonly api: "foundation-models";
    /** Azure OpenAI "On Your Data" configuration for RAG scenarios. */
    readonly dataSources?: AzureOpenAiChatExtensionConfiguration[];
    /** @default false */
    readonly includeReasoning?: boolean;
    readonly modelParams?: FoundationModelsModelParams;
    readonly modelVersion?: string;
    readonly responseFormat?: ResponseFormat;
}
/** Default settings configuration when using Orchestration API. */
interface OrchestrationDefaultSettings {
    readonly api?: "orchestration";
    readonly settings?: OrchestrationModelSettings;
}
/** Model parameters for Orchestration API. */
type OrchestrationModelParams = CommonModelParams;
/** Model settings when using Orchestration API with filtering, grounding, masking, and translation. */
interface OrchestrationModelSettings {
    readonly api?: "orchestration";
    /** @default true */
    readonly escapeTemplatePlaceholders?: boolean;
    readonly filtering?: FilteringModule;
    readonly grounding?: GroundingModule;
    /** @default false */
    readonly includeReasoning?: boolean;
    readonly masking?: MaskingModule;
    readonly modelParams?: OrchestrationModelParams;
    readonly modelVersion?: string;
    /**
     * Reference to a complete orchestration configuration stored in SAP AI Core Prompt Registry.
     * When provided, local module settings (filtering, masking, grounding, translation, tools,
     * promptTemplateRef, responseFormat) are ignored as the full configuration is managed
     * by the referenced config. Only `placeholderValues` and messages are passed through.
     * @example { id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
     * @example { scenario: "customer-support", name: "prod-config", version: "1.0.0" }
     */
    readonly orchestrationConfigRef?: OrchestrationConfigRef;
    readonly placeholderValues?: Record<string, string>;
    readonly promptTemplateRef?: PromptTemplateRef;
    readonly responseFormat?: ResponseFormat;
    readonly tools?: ChatCompletionTool[];
    readonly translation?: TranslationModule;
}
/** Reference to a template in SAP AI Core's Prompt Registry. */
type PromptTemplateRef = PromptTemplateRefByID | PromptTemplateRefByScenarioNameVersion;
/** Reference to a Prompt Registry template by ID. */
interface PromptTemplateRefByID {
    readonly id: string;
    readonly scope?: PromptTemplateScope;
}
/** Reference to a Prompt Registry template by scenario, name, and version. */
interface PromptTemplateRefByScenarioNameVersion {
    readonly name: string;
    readonly scenario: string;
    readonly scope?: PromptTemplateScope;
    readonly version: string;
}
/** Scope for Prompt Registry templates: 'tenant' (default) or 'resource_group'. */
type PromptTemplateScope = "resource_group" | "tenant";
/** Response format for structured output (OpenAI-compatible). */
type ResponseFormat = AzureOpenAiChatCompletionParameters["response_format"];
/**
 * Supported API types for SAP AI Core.
 *
 * - `'orchestration'` - Full-featured API with data masking, content filtering, document grounding, and translation.
 * - `'foundation-models'` - Direct model access with Azure OpenAI-specific parameters like `logprobs`, `seed`, and `dataSources`.
 */
type SAPAIApiType = "foundation-models" | "orchestration";
/** Union type for API-specific default settings configuration. */
type SAPAIDefaultSettingsConfig = FoundationModelsDefaultSettings | OrchestrationDefaultSettings;
/** Settings for the SAP AI Embedding Model. */
interface SAPAIEmbeddingSettings {
    readonly api?: SAPAIApiType;
    /** Orchestration API only. */
    readonly masking?: MaskingModule;
    /** @default 2048 */
    readonly maxEmbeddingsPerCall?: number;
    readonly modelParams?: FoundationModelsEmbeddingParams | Record<string, unknown>;
    readonly modelVersion?: string;
    readonly [key: string]: unknown;
    /** @default 'text' */
    readonly type?: "document" | "query" | "text";
}
/**
 * Supported model IDs in SAP AI Core.
 *
 * Model availability depends on tenant configuration and region.
 * Common values include: `'gpt-4.1'`, `'gpt-4.1-mini'`, `'anthropic--claude-4.5-sonnet'`, `'gemini-2.5-pro'`.
 * @see {@link https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub|SAP AI Core Models}
 */
type SAPAIModelId = ChatModel;
/**
 * Union type for model settings - supports both APIs.
 *
 * Use `FoundationModelsModelSettings` for Foundation Models API features (dataSources, logprobs, seed).
 * Use `OrchestrationModelSettings` for Orchestration API features (filtering, grounding, masking, translation).
 */
type SAPAIModelSettings = FoundationModelsModelSettings | OrchestrationModelSettings;

/**
 * Settings for configuring SAP AI Core model behavior.
 * Legacy interface maintained for backward compatibility - prefer OrchestrationModelSettings
 * or FoundationModelsModelSettings for API-specific type safety.
 */
interface SAPAISettings {
    readonly api?: SAPAIApiType;
    /** @default true */
    readonly escapeTemplatePlaceholders?: boolean;
    readonly filtering?: FilteringModule;
    readonly grounding?: GroundingModule;
    /** @default false */
    readonly includeReasoning?: boolean;
    readonly masking?: MaskingModule;
    readonly modelParams?: CommonModelParams;
    readonly modelVersion?: string;
    /** Orchestration API only. */
    readonly orchestrationConfigRef?: OrchestrationConfigRef;
    /** Orchestration API only. */
    readonly placeholderValues?: Record<string, string>;
    /** Orchestration API only. */
    readonly promptTemplateRef?: PromptTemplateRef;
    readonly responseFormat?: ResponseFormat;
    readonly tools?: ChatCompletionTool[];
    readonly translation?: TranslationModule;
}

/**
 * SAP AI Embedding Model - Vercel AI SDK EmbeddingModelV3 implementation for SAP AI Core.
 *
 * This module provides the embedding model implementation that connects to SAP AI Core
 * services (Orchestration API or Foundation Models API) to generate vector embeddings.
 * @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/embed | Vercel AI SDK embed()}
 * @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/embed-many | Vercel AI SDK embedMany()}
 */

/**
 * Model identifier for SAP AI embedding models.
 *
 * Common embedding model IDs include:
 * - `"text-embedding-3-small"` - OpenAI small embedding model (recommended)
 * - `"text-embedding-3-large"` - OpenAI large embedding model
 *
 * The actual available models depend on your SAP AI Core deployment configuration.
 * @see {@link https://help.sap.com/docs/sap-ai-core | SAP AI Core Documentation}
 */
type SAPAIEmbeddingModelId = string;
/** @internal */
interface SAPAIEmbeddingModelConfig {
    readonly deploymentConfig: DeploymentIdConfig | ResourceGroupConfig;
    readonly destination?: HttpDestinationOrFetchOptions;
    readonly provider: string;
    readonly providerApi?: SAPAIApiType;
}
/**
 * SAP AI Core Embedding Model implementing Vercel AI SDK EmbeddingModelV3.
 *
 * This class provides embedding generation capabilities through SAP AI Core,
 * supporting both the Orchestration API and Foundation Models API.
 *
 * Users typically don't instantiate this class directly. Instead, use the
 * {@link createSAPAIProvider} factory function:
 * @example
 * ```typescript
 * import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider";
 * import { embed, embedMany } from "ai";
 *
 * const provider = createSAPAIProvider();
 * const embeddingModel = provider.embedding("text-embedding-3-small");
 *
 * // Single embedding
 * const { embedding } = await embed({
 *   model: embeddingModel,
 *   value: "Hello, world!",
 * });
 *
 * // Multiple embeddings
 * const { embeddings } = await embedMany({
 *   model: embeddingModel,
 *   values: ["Hello", "World"],
 * });
 * ```
 * @see {@link https://sdk.vercel.ai/docs/ai-sdk-core/embeddings | Vercel AI SDK Embeddings}
 * @see {@link createSAPAIProvider} - Factory function to create provider instances
 */
declare class SAPAIEmbeddingModel implements EmbeddingModelV3 {
    readonly maxEmbeddingsPerCall: number;
    readonly modelId: string;
    readonly provider: string;
    readonly specificationVersion: "v3";
    readonly supportsParallelCalls: boolean;
    private readonly config;
    private readonly settings;
    /**
     * @param modelId - Model identifier.
     * @param settings - Model settings.
     * @param config - Model configuration.
     * @internal
     */
    constructor(modelId: SAPAIEmbeddingModelId, settings: SAPAIEmbeddingSettings | undefined, config: SAPAIEmbeddingModelConfig);
    doEmbed(options: EmbeddingModelV3CallOptions): Promise<EmbeddingModelV3Result>;
}

/** Error conversion utilities for SAP AI Core to Vercel AI SDK error types. */

/**
 * Error thrown when attempting to switch APIs at invocation time with conflicting model settings.
 * @example
 * ```typescript
 * const model = provider("gpt-4.1", { filtering: { ... } });
 *
 * await generateText({
 *   model,
 *   providerOptions: { [SAP_AI_PROVIDER_NAME]: { api: "foundation-models" } },
 *   prompt: "Hello",
 * });
 * // Throws: ApiSwitchError("orchestration", "foundation-models", "filtering")
 * ```
 * @see {@link validateSettings} - Main validation function that throws this error
 * @see {@link UnsupportedFeatureError} - Related error for features unsupported by an API
 */
declare class ApiSwitchError extends Error {
    readonly fromApi: SAPAIApiType;
    readonly toApi: SAPAIApiType;
    readonly conflictingFeature: string;
    /**
     * Creates a new ApiSwitchError.
     * @param fromApi - The API the model was configured with.
     * @param toApi - The API being switched to at invocation time.
     * @param conflictingFeature - The feature that prevents the API switch.
     */
    constructor(fromApi: SAPAIApiType, toApi: SAPAIApiType, conflictingFeature: string);
}
/**
 * Error thrown when a feature is used with an incompatible API.
 * @example
 * ```typescript
 * throw new UnsupportedFeatureError("Content filtering", "foundation-models", "orchestration");
 * // "Content filtering is only available with Orchestration API and will be ignored by Foundation Models API."
 * ```
 * @see {@link validateSettings} - Main validation function that throws this error
 * @see {@link ApiSwitchError} - Related error for API switching conflicts
 */
declare class UnsupportedFeatureError extends Error {
    readonly feature: string;
    readonly api: SAPAIApiType;
    readonly suggestedApi: SAPAIApiType;
    /**
     * Creates a new UnsupportedFeatureError.
     * @param feature - The name of the unsupported feature (e.g., "Content filtering").
     * @param api - The API being used where the feature will be ignored.
     * @param suggestedApi - The API that supports this feature.
     */
    constructor(feature: string, api: SAPAIApiType, suggestedApi: SAPAIApiType);
}

/**
 * SAP AI Language Model - Vercel AI SDK LanguageModelV3 implementation for SAP AI Core.
 *
 * This module provides the language model implementation that connects to SAP AI Core
 * services (Orchestration API or Foundation Models API) for chat completions and streaming.
 * @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/generate-text | Vercel AI SDK generateText()}
 * @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/stream-text | Vercel AI SDK streamText()}
 */

/** @internal */
interface SAPAILanguageModelConfig {
    readonly deploymentConfig: DeploymentIdConfig | ResourceGroupConfig;
    readonly destination?: HttpDestinationOrFetchOptions;
    readonly provider: string;
    readonly providerApi?: SAPAIApiType;
}
/**
 * SAP AI Language Model implementing Vercel AI SDK LanguageModelV3.
 *
 * This class provides chat completion and streaming capabilities through SAP AI Core,
 * supporting both the Orchestration API (with content filtering, grounding, masking,
 * and translation) and Foundation Models API (direct Azure OpenAI access).
 *
 * Users typically don't instantiate this class directly. Instead, use the
 * {@link createSAPAIProvider} factory function:
 * @example
 * ```typescript
 * import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider";
 * import { generateText, streamText } from "ai";
 *
 * const provider = createSAPAIProvider();
 * const model = provider("gpt-4.1");
 *
 * // Non-streaming
 * const { text } = await generateText({
 *   model,
 *   prompt: "Hello!",
 * });
 *
 * // Streaming
 * const result = streamText({
 *   model,
 *   prompt: "Tell me a story",
 * });
 *
 * for await (const chunk of result.textStream) {
 *   process.stdout.write(chunk);
 * }
 * ```
 * @see {@link https://sdk.vercel.ai/docs/ai-sdk-core/generating-text | Vercel AI SDK Text Generation}
 * @see {@link createSAPAIProvider} - Factory function to create provider instances
 */
declare class SAPAILanguageModel implements LanguageModelV3 {
    readonly modelId: SAPAIModelId;
    readonly specificationVersion = "v3";
    readonly supportsImageUrls: boolean;
    readonly supportsMultipleCompletions: boolean;
    readonly supportsParallelToolCalls: boolean;
    readonly supportsStreaming: boolean;
    readonly supportsStructuredOutputs: boolean;
    readonly supportsToolCalls: boolean;
    get provider(): string;
    get supportedUrls(): Record<string, RegExp[]>;
    /** @internal */
    private readonly config;
    /** @internal */
    private readonly settings;
    /**
     * @param modelId - Model identifier.
     * @param settings - Model settings.
     * @param config - Model configuration.
     * @internal
     */
    constructor(modelId: SAPAIModelId, settings: SAPAISettings, config: SAPAILanguageModelConfig);
    doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
    doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
    supportsUrl(url: URL): boolean;
    /**
     * Prepares common invocation context for doGenerate and doStream.
     * @param options - AI SDK call options.
     * @returns Strategy and configuration for the invocation.
     * @internal
     */
    private prepareInvocation;
}

/** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
declare const SAP_AI_PROVIDER_NAME: "sap-ai";
/**
 * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
 * @param providerIdentifier - The full provider identifier string.
 * @returns The provider name without any suffix.
 */
declare function getProviderName(providerIdentifier: string): string;
/** @internal */
declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
    api?: "foundation-models" | "orchestration" | undefined;
    escapeTemplatePlaceholders?: boolean | undefined;
    includeReasoning?: boolean | undefined;
    modelParams?: {
        [x: string]: unknown;
        frequencyPenalty?: number | undefined;
        maxTokens?: number | undefined;
        n?: number | undefined;
        parallel_tool_calls?: boolean | undefined;
        presencePenalty?: number | undefined;
        temperature?: number | undefined;
        topP?: number | undefined;
    } | undefined;
    orchestrationConfigRef?: {
        id: string;
    } | {
        name: string;
        scenario: string;
        version: string;
    } | undefined;
    placeholderValues?: Record<string, string> | undefined;
    promptTemplateRef?: {
        id: string;
        scope?: "resource_group" | "tenant" | undefined;
    } | {
        name: string;
        scenario: string;
        version: string;
        scope?: "resource_group" | "tenant" | undefined;
    } | undefined;
}>;
/** @internal */
type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
/** @internal */
declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
    api?: "foundation-models" | "orchestration" | undefined;
    modelParams?: {
        [x: string]: unknown;
        dimensions?: number | undefined;
        encoding_format?: "base64" | "binary" | "float" | undefined;
        normalize?: boolean | undefined;
    } | undefined;
    type?: "text" | "document" | "query" | undefined;
}>;
/** @internal */
type SAPAIEmbeddingProviderOptions = InferSchema<typeof sapAIEmbeddingProviderOptions>;

/** @internal */
type DeploymentConfig = DeploymentIdConfig | ResourceGroupConfig;
/** SAP AI Provider interface extending Vercel AI SDK ProviderV3. */
interface SAPAIProvider extends ProviderV3 {
    (modelId: SAPAIModelId, settings?: SAPAISettings): SAPAILanguageModel;
    chat(modelId: SAPAIModelId, settings?: SAPAISettings): SAPAILanguageModel;
    embedding(modelId: SAPAIEmbeddingModelId, settings?: SAPAIEmbeddingSettings): SAPAIEmbeddingModel;
    embeddingModel(modelId: SAPAIEmbeddingModelId, settings?: SAPAIEmbeddingSettings): SAPAIEmbeddingModel;
    /** Always throws - SAP AI Core does not support image generation. */
    imageModel(modelId: string): never;
    languageModel(modelId: SAPAIModelId, settings?: SAPAISettings): SAPAILanguageModel;
    /** @deprecated Use `embeddingModel()` instead. */
    textEmbeddingModel(modelId: SAPAIEmbeddingModelId, settings?: SAPAIEmbeddingSettings): SAPAIEmbeddingModel;
}
/**
 * Configuration settings for the SAP AI Provider.
 * See {@link createSAPAIProvider} for authentication details.
 */
interface SAPAIProviderSettings {
    /**
     * SAP AI Core API to use for all models created by this provider.
     * Can be overridden at model creation time or per-call via providerOptions.
     * - `'orchestration'` (default): SAP AI Core Orchestration API - supports filtering, grounding, masking, translation
     * - `'foundation-models'`: SAP AI Core Foundation Models API - supports dataSources, logprobs, seed, etc.
     * @default 'orchestration'
     */
    readonly api?: SAPAIApiType;
    /** Default model settings applied to every model instance. Per-call settings override these. */
    readonly defaultSettings?: SAPAISettings;
    /** SAP AI Core deployment ID. If not provided, the SDK resolves deployment automatically. */
    readonly deploymentId?: string;
    /** Custom destination configuration for SAP AI Core. */
    readonly destination?: HttpDestinationOrFetchOptions;
    /**
     * Log level for SAP Cloud SDK loggers.
     * Controls verbosity of internal SAP SDK logging (e.g., authentication, service binding).
     * Note: SAP_CLOUD_SDK_LOG_LEVEL environment variable takes precedence if set.
     * @default 'warn'
     */
    readonly logLevel?: "debug" | "error" | "info" | "warn";
    /**
     * Provider name used as key for `providerOptions` and `providerMetadata`.
     * @default 'sap-ai'
     */
    readonly name?: string;
    /**
     * SAP AI Core resource group for resource isolation and access control.
     * @default 'default'
     */
    readonly resourceGroup?: string;
    /** Whether to emit warnings for ambiguous configurations (e.g. both deploymentId and resourceGroup). */
    readonly warnOnAmbiguousConfig?: boolean;
}
/**
 * Creates an SAP AI Provider instance for use with the Vercel AI SDK.
 *
 * Uses the official SAP AI SDK (`@sap-ai-sdk/orchestration` and
 * `@sap-ai-sdk/foundation-models`) for API communication. Authentication is automatic via service binding
 * (VCAP_SERVICES on SAP BTP) or AICORE_SERVICE_KEY environment variable.
 * @param options - Provider configuration options.
 * @param options.api - Default API type: `'orchestration'` (default) or `'foundation-models'`.
 * @param options.defaultSettings - Default model settings applied to every model instance.
 * @param options.deploymentId - SAP AI Core deployment ID for automatic deployment resolution.
 * @param options.destination - Custom SAP Cloud SDK destination configuration.
 * @param options.logLevel - Log level for SAP Cloud SDK loggers (`'debug'`, `'info'`, `'warn'`, `'error'`).
 * @param options.name - Provider name used as key in `providerOptions` (default: `'sap-ai'`).
 * @param options.resourceGroup - SAP AI Core resource group (default: `'default'`).
 * @param options.warnOnAmbiguousConfig - Whether to warn when both deploymentId and resourceGroup are set.
 * @returns A configured SAP AI provider instance that can be used as a callable or via methods.
 * @example
 * // Basic usage with defaults
 * const provider = createSAPAIProvider();
 * const model = provider('gpt-4.1');
 * @example
 * // With custom configuration
 * const provider = createSAPAIProvider({
 *   api: 'foundation-models',
 *   resourceGroup: 'production',
 *   defaultSettings: { modelParams: { temperature: 0.7 } },
 * });
 * @example
 * // Using provider methods
 * const chatModel = provider.chat('gpt-4.1');
 * const embeddingModel = provider.embedding('text-embedding-3-small');
 * @see {@link SAPAIProviderSettings} for all configuration options.
 * @see {@link SAPAIProvider} for the provider interface.
 */
declare function createSAPAIProvider(options?: SAPAIProviderSettings): SAPAIProvider;
/** Default SAP AI provider instance with automatic authentication via SAP AI SDK. */
declare const sapai: SAPAIProvider;

/** Validation and resolution functions for SAP AI API-specific features. */

/** Options for the main validation function. */
interface ValidateSettingsOptions {
    readonly api: SAPAIApiType;
    readonly embeddingSettings?: SAPAIEmbeddingSettings;
    readonly invocationSettings?: {
        readonly api?: SAPAIApiType;
        readonly escapeTemplatePlaceholders?: boolean;
        readonly orchestrationConfigRef?: unknown;
        readonly placeholderValues?: unknown;
        readonly promptTemplateRef?: unknown;
    };
    readonly modelApi?: SAPAIApiType;
    readonly modelSettings?: SAPAIModelSettings | SAPAISettings;
}
/**
 * Resolves the effective API type using the full precedence chain.
 * @param providerApi - Provider-level API type.
 * @param modelApi - Model-level API type.
 * @param invocationApi - Invocation-level API type.
 * @returns Resolved API type.
 */
declare function resolveApi(providerApi: SAPAIApiType | undefined, modelApi: SAPAIApiType | undefined, invocationApi: SAPAIApiType | undefined): SAPAIApiType;
/**
 * Main validation function that performs all API-specific validations.
 *
 * This function orchestrates all validation checks:
 * 1. Validates API type inputs
 * 2. Checks for API switching conflicts
 * 3. Validates API-specific feature usage
 * 4. Validates template placeholder escaping
 * @param options - Validation options.
 * @throws {Error} When an invalid API type is provided.
 * @throws {ApiSwitchError} When attempting to switch APIs with incompatible settings.
 * @throws {UnsupportedFeatureError} When using features not supported by the current API.
 * @see {@link ApiSwitchError}
 * @see {@link UnsupportedFeatureError}
 */
declare function validateSettings(options: ValidateSettingsOptions): void;

/**
 * Package version injected at build time via tsup define.
 * @module
 */
/** Current package version from package.json, injected at build time. */
declare const VERSION: string;

export { ApiSwitchError, type AzureOpenAiChatExtensionConfiguration, type CommonModelParams, type DeploymentConfig, type FoundationModelsDefaultSettings, type FoundationModelsEmbeddingParams, type FoundationModelsModelParams, type FoundationModelsModelSettings, type OrchestrationDefaultSettings, type OrchestrationModelParams, type OrchestrationModelSettings, type PromptTemplateRef, type PromptTemplateRefByID, type PromptTemplateRefByScenarioNameVersion, type PromptTemplateScope, type ResponseFormat, type SAPAIApiType, type SAPAIDefaultSettingsConfig, SAPAIEmbeddingModel, type SAPAIEmbeddingModelId, type SAPAIEmbeddingProviderOptions, type SAPAIEmbeddingSettings, SAPAILanguageModel, type SAPAILanguageModelProviderOptions, type SAPAIModelId, type SAPAIModelSettings, type SAPAIProvider, type SAPAIProviderSettings, type SAPAISettings, SAP_AI_PROVIDER_NAME, UnsupportedFeatureError, VERSION, createSAPAIProvider, escapeOrchestrationPlaceholders, getProviderName, resolveApi, sapAIEmbeddingProviderOptions, sapAILanguageModelProviderOptions, sapai, unescapeOrchestrationPlaceholders, validateSettings };
