import { ResponseMetadata } from '../../model/model-protocol'; /** * Abstract Data Type (ADT) encapsulating metadata on the usage of an AI provider's API * per AI request. */ export interface Usage { /** * The number of tokens used in the prompt of the AI request. */ readonly promptTokens?: number; /** * The number of tokens returned in the generation (aka completion) * of the AI's response. */ readonly generationTokens?: number; /** * The total number of tokens from both the prompt of an AI request * and generation of the AI's response. */ readonly totalTokens?: number; } export declare namespace Usage { function createEmpty(): Usage; function from(promptTokens?: number, generationTokens?: number, totalTokens?: number): Usage; } /** * Abstract Data Type (ADT) encapsulating metadata from an AI provider's API rate limits * granted to the API key in use and the API key's current balance. */ export interface RateLimit { /** * The maximum number of requests that are permitted before exhausting the * rate limit. */ readonly requestsLimit?: number; /** * The remaining number of requests that are permitted before exhausting the * requestsLimit rate limit. */ readonly requestsRemaining?: number; /** * The duration time until the rate limit (based on requests) resets * to its requestsLimit initial state. */ readonly requestsReset?: number; /** * The maximum number of tokens that are permitted before exhausting the rate * limit. */ readonly tokensLimit?: number; /** * The remaining number of tokens that are permitted before exhausting the * tokensLimit rate limit. */ readonly tokensRemaining?: number; /** * The duration time until the rate limit (based on tokens) resets to * its tokensLimit initial state. */ readonly tokensReset?: number; } /** * Abstract Data Type (ADT) modeling filter metadata for all prompts sent during an AI * request. */ export interface PromptFilterMetadata { /** * Index of the prompt filter metadata contained in the AI response. */ readonly promptIndex: number; /** * Returns the underlying AI provider metadata for filtering applied to prompt * content. * @param {@link Class Type} used to cast the filtered content metadata into * the AI provider-specific type. * @return the underlying AI provider metadata for filtering applied to prompt * content. */ readonly contentFilterMetadata: T; } /** * Abstract Data Type (ADT) modeling metadata gathered by the AI during request * processing. */ export type PromptMetadata = PromptFilterMetadata[]; export declare namespace PromptMetadata { /** * Returns an Optional {@link PromptFilterMetadata} at the given index. * @param promptIndex index of the {@link PromptFilterMetadata} contained in this * {@link PromptMetadata}. * @return Optional {@link PromptFilterMetadata} at the given index. * @throws IllegalArgumentError if the prompt index is less than 0. */ function findByPromptIndex(promptMetadata: PromptMetadata, promptIndex: number): PromptFilterMetadata | undefined; } export declare namespace RateLimit { function createEmpty(): RateLimit; } export interface ChatResponseMetadata extends ResponseMetadata { id?: string; model?: string; /** * AI provider specific metadata on rate limits. * @see RateLimit */ rateLimit: RateLimit; /** * AI provider specific metadata on API usage. * @see Usage */ usage: Usage; promptMetadata: PromptMetadata; } export declare class ChatResponseMetadataBuilder { private readonly chatResponseMetadata; id(id: string): ChatResponseMetadataBuilder; model(model: string): ChatResponseMetadataBuilder; rateLimit(rateLimit: RateLimit): ChatResponseMetadataBuilder; usage(usage: Usage): ChatResponseMetadataBuilder; promptMetadata(promptMetadata: PromptMetadata): ChatResponseMetadataBuilder; keyValue(key: string, value: any): ChatResponseMetadataBuilder; build(): ChatResponseMetadata; } export declare namespace ChatResponseMetadata { function createEmpty(): ChatResponseMetadata; function builder(): ChatResponseMetadataBuilder; } //# sourceMappingURL=metadata-protocol.d.ts.map