UNPKG

ads4gpts-langchain

Version:

Ads for AI applications. Enabling the Freemium model for the AI era.

25 lines 1.49 kB
/** * Helper functions for the Ads4GPTs Langchain JS Toolkit. */ import { BannerAdData, BannerAdsPayload, BannerAdsResponse } from '../types/bannerAds'; import { ChatAdData, ChatAdsPayload, ChatAdsResponse } from '../types/chatAds'; /** * Fetch with retry logic. Throws on persistent failure. * @param url URL to POST to * @param options RequestInit options (body, headers, etc.) * @param maxRetries number of attempts before giving up * @param backoffFactor multiplier for exponential backoff */ export declare function fetchWithRetry(url: string, options: RequestInit, maxRetries?: number, backoffFactor?: number): Promise<BannerAdsResponse | ChatAdsResponse>; export declare function initGetAdsFunction(apiKey: string): (endpoint: string, payload: BannerAdsPayload | ChatAdsPayload) => Promise<BannerAdData | BannerAdData[] | ChatAdData | ChatAdData[]>; /** * Retrieves a configuration value from the provided arguments or environment variables. * * @param args - A record of key-value pairs, typically the input arguments. * @param key - The key to look for in the `args` object. * @param envKey - The environment variable key to check if the value is not in `args`. * @returns The value of the key from `args` or the corresponding environment variable. * @throws Error if the key is not found in `args` or the environment. */ export declare function getConfigValue(args: Record<string, any>, key: string, envKey: string): string; //# sourceMappingURL=utils.d.ts.map