/** * Internal dependencies */ import GenerativeAiModel from './generative-ai-model'; import ChatSession from './chat-session'; import type { ServiceResource, ServiceMetadata, ModelMetadata, ModelParams, Content, Part, Candidates, AsyncCandidatesGenerator } from '../types'; /** * Service class. * * @since 0.1.0 */ export default class GenerativeAiService { metadata: ServiceMetadata; models: Record; /** * Constructor. * * @since 0.1.0 * * @param service - Service object. */ constructor(service: ServiceResource); /** * Gets the service slug. * * @since 0.1.0 * * @returns Service slug. */ getServiceSlug(): string; /** * Gets the service metadata. * * @since 0.7.0 * * @returns Service metadata. */ getServiceMetadata(): ServiceMetadata; /** * Lists the available generative model slugs and their capabilities. * * @since 0.1.0 * * @returns Metadata for each model, mapped by model slug. */ listModels(): Record; /** * Gets a generative model instance from the service. * * @since 0.3.0 * * @param modelParams - Model parameters. At a minimum this must include the unique "feature" identifier. * @returns Generative AI model instance. */ getModel(modelParams: ModelParams): GenerativeAiModel; /** * Generates text content using the service. * * This is a short-hand method for `service.getModel( modelParams ).generateText( content )`. * * @since 0.1.0 * * @param content - Content data to pass to the model, including the prompt and optional history. * @param modelParams - Model parameters. At a minimum this must include the unique "feature" identifier. * @returns Model response candidates with the generated text content. */ generateText(content: string | Part[] | Content | Content[], modelParams: ModelParams): Promise; /** * Generates text content using the service, streaming the response. * * This is a short-hand method for `service.getModel( modelParams ).streamGenerateText( content )`. * * @since 0.3.0 * * @param content - Content data to pass to the model, including the prompt and optional history. * @param modelParams - Model parameters. At a minimum this must include the unique "feature" identifier. * @returns The generator that yields chunks of response candidates with the generated text content. */ streamGenerateText(content: string | Part[] | Content | Content[], modelParams: ModelParams): Promise; /** * Starts a multi-turn chat session using the service. * * This is a short-hand method for `service.getModel( modelParams ).startChat( history )`. * * @since 0.1.0 * * @param history - Chat history. * @param modelParams - Model parameters. * @returns Chat session. */ startChat(history: Content[], modelParams: ModelParams): ChatSession; /** * Generates an image using the service. * * This is a short-hand method for `service.getModel( modelParams ).generateImage( content )`. * * @since 0.5.0 * * @param content - Content data to pass to the model, including the prompt and optional history. * @param modelParams - Model parameters. At a minimum this must include the unique "feature" identifier. * @returns Model response candidates with the generated image. */ generateImage(content: string | Part[] | Content | Content[], modelParams: ModelParams): Promise; /** * Transforms text to speech using the service. * * This is a short-hand method for `service.getModel( modelParams ).textToSpeech( content )`. * * @since 0.7.0 * * @param content - The content to transform to speech. * @param modelParams - Model parameters. At a minimum this must include the unique "feature" identifier. * @returns Model response candidates with the generated speech. */ textToSpeech(content: string | Part[] | Content | Content[], modelParams: ModelParams): Promise; } //# sourceMappingURL=generative-ai-service.d.ts.map