diff --git a/src/_types/generalTypes.ts b/src/_types/generalTypes.ts index d1a785a..30a5160 100644 --- a/src/_types/generalTypes.ts +++ b/src/_types/generalTypes.ts @@ -12,6 +12,7 @@ export interface ApiClientInterface { cacheForceRefresh?: boolean | null | undefined; debug?: boolean | null | undefined; customHost?: string | null | undefined + cacheNamespace?: string | null | undefined; } export interface APIResponseType { diff --git a/src/baseClient.ts b/src/baseClient.ts index dbf6937..51f96ce 100644 --- a/src/baseClient.ts +++ b/src/baseClient.ts @@ -120,10 +120,10 @@ export abstract class ApiClient { portkeyHeaders: Record private fetch: Fetch; - constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost }: ApiClientInterface) { + constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost, cacheNamespace }: ApiClientInterface) { this.apiKey = apiKey ?? ""; this.baseURL = baseURL ?? ""; - this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost }) + this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost, cacheNamespace }) this.portkeyHeaders = this.defaultHeaders() this.fetch = fetch; this.responseHeaders = {} diff --git a/src/client.ts b/src/client.ts index 23559d5..a9dd992 100644 --- a/src/client.ts +++ b/src/client.ts @@ -17,6 +17,7 @@ export class Portkey extends ApiClient { cacheForceRefresh?: boolean | null | undefined; debug?: boolean | null | undefined; customHost?: string | null | undefined; + cacheNamespace?: string | null | undefined; constructor({ apiKey = readEnv("PORTKEY_API_KEY") ?? null, baseURL = readEnv("PORTKEY_BASE_URL") ?? null, @@ -29,6 +30,7 @@ export class Portkey extends ApiClient { cacheForceRefresh, debug, customHost, + cacheNamespace, }: ApiClientInterface) { super({ @@ -42,7 +44,8 @@ export class Portkey extends ApiClient { Authorization, cacheForceRefresh, debug, - customHost + customHost, + cacheNamespace }); this.apiKey = apiKey; @@ -57,7 +60,8 @@ export class Portkey extends ApiClient { this.metadata = metadata this.cacheForceRefresh = cacheForceRefresh; this.debug = debug; - this.customHost = customHost + this.customHost = customHost; + this.cacheNamespace = cacheNamespace; } completions: API.Completions = new API.Completions(this);