services-as-software
Version:
Primitives for building AI-powered services that operate as software
85 lines • 1.83 kB
TypeScript
/**
* Service provider for managing multiple services
*/
import type { Provider, ClientConfig } from './types.js';
/**
* Provider configuration
*/
export interface ProviderConfig {
/** Provider name */
name: string;
/** Base URL for all services */
baseUrl: string;
/** Authentication configuration */
auth?: ClientConfig['auth'];
/** Available services */
services?: string[];
}
/**
* Create a service provider
*
* @example
* ```ts
* const provider = Provider({
* name: 'AWS',
* baseUrl: 'https://api.aws.amazon.com',
* auth: {
* type: 'api-key',
* credentials: { apiKey: process.env.AWS_API_KEY },
* },
* services: ['translate', 'comprehend', 'polly'],
* })
*
* // Get a service client
* const translate = provider.service('translate')
* const result = await translate.do('translate', {
* text: 'Hello',
* to: 'es',
* })
* ```
*/
export declare function Provider(config: ProviderConfig): Provider;
/**
* Common cloud providers
*/
export declare const providers: {
/**
* AWS provider
*/
aws(credentials: {
accessKeyId: string;
secretAccessKey: string;
region?: string;
}): Provider;
/**
* Google Cloud provider
*/
gcp(credentials: {
apiKey: string;
projectId?: string;
}): Provider;
/**
* Azure provider
*/
azure(credentials: {
subscriptionKey: string;
region?: string;
}): Provider;
/**
* OpenAI provider
*/
openai(credentials: {
apiKey: string;
}): Provider;
/**
* Anthropic provider
*/
anthropic(credentials: {
apiKey: string;
}): Provider;
/**
* Custom provider
*/
custom(config: ProviderConfig): Provider;
};
//# sourceMappingURL=provider.d.ts.map