UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

59 lines 2.07 kB
import type { LanguageModelV2 } from '@ai-sdk/provider-v5'; import type { OpenAITransport, ResponsesWebSocketOptions } from '../provider-options.js'; import { MastraModelGateway } from './base.js'; import type { ProviderConfig } from './base.js'; export interface AzureAccessToken { token: string; expiresOnTimestamp?: number; } export interface AzureTokenCredential { getToken(scopes: string | string[], options?: unknown): Promise<AzureAccessToken | null>; } export interface AzureOpenAIGatewayConfig { resourceName: string; apiKey?: string; apiVersion?: string; useResponsesAPI?: boolean; useDeploymentBasedUrls?: boolean; deployments?: string[]; authentication?: { type: 'entraId'; credential: AzureTokenCredential; scope?: string; }; management?: { tenantId: string; clientId: string; clientSecret: string; subscriptionId: string; resourceGroup: string; }; } export declare class AzureOpenAIGateway extends MastraModelGateway { private config; readonly id = "azure-openai"; readonly name = "azure-openai"; private tokenCache; private entraIdTokenRequests; constructor(config: AzureOpenAIGatewayConfig); private validateConfig; fetchProviders(): Promise<Record<string, ProviderConfig>>; private getManagementCredentials; private getAzureADToken; private fetchDeployments; buildUrl(_routerId: string, _envVars?: typeof process.env): undefined; getApiKey(_modelId: string): Promise<string>; private getEntraIdToken; private fetchEntraIdToken; private createEntraIdFetch; private createAzureResponsesWebSocketFetch; resolveLanguageModel({ modelId, apiKey, headers, transport, responsesWebSocket, }: { modelId: string; providerId: string; apiKey: string; headers?: Record<string, string>; transport?: OpenAITransport; responsesWebSocket?: ResponsesWebSocketOptions; }): Promise<LanguageModelV2>; } //# sourceMappingURL=azure.d.ts.map