portkey-ai
Advanced tools
Comparing version 1.1.4 to 1.1.5
{ | ||
"name": "portkey-ai", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Node client library for the Portkey API", | ||
@@ -5,0 +5,0 @@ "types": "./src/index.d.ts", |
@@ -11,2 +11,3 @@ export type Headers = Record<string, string | null | undefined>; | ||
Authorization?: string | null | undefined; | ||
cacheForceRefresh?: boolean | null | undefined; | ||
} | ||
@@ -13,0 +14,0 @@ export interface APIResponseType { |
@@ -12,2 +12,3 @@ export type Headers = Record<string, string | null | undefined> | ||
Authorization?: string | null | undefined; | ||
cacheForceRefresh?: boolean | null | undefined; | ||
} | ||
@@ -14,0 +15,0 @@ |
@@ -9,2 +9,4 @@ "use strict"; | ||
let v = config[k]; | ||
if ((0, utils_1.isEmpty)(v)) | ||
continue; | ||
// convert to snakecase | ||
@@ -11,0 +13,0 @@ if (k.toLocaleLowerCase() === "authorization") { |
@@ -7,3 +7,6 @@ import { getPortkeyHeader, isEmpty } from "../utils" | ||
for (let k in config) { | ||
let v = config[k] | ||
let v = config[k]; | ||
if (isEmpty(v)) continue; | ||
// convert to snakecase | ||
@@ -10,0 +13,0 @@ if (k.toLocaleLowerCase() === "authorization") { |
@@ -42,3 +42,3 @@ /// <reference types="node" /> | ||
private fetch; | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization }: ApiClientInterface); | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }: ApiClientInterface); | ||
protected defaultHeaders(): Record<string, string>; | ||
@@ -45,0 +45,0 @@ _post<Rsp extends APIResponseType>(path: string, opts?: RequestOptions): APIPromise<Rsp>; |
@@ -82,6 +82,6 @@ "use strict"; | ||
class ApiClient { | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization }) { | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }) { | ||
this.apiKey = apiKey !== null && apiKey !== void 0 ? apiKey : ""; | ||
this.baseURL = baseURL !== null && baseURL !== void 0 ? baseURL : ""; | ||
this.customHeaders = (0, apis_1.createHeaders)({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization }); | ||
this.customHeaders = (0, apis_1.createHeaders)({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }); | ||
this.fetch = fetch; | ||
@@ -88,0 +88,0 @@ this.responseHeaders = {}; |
@@ -122,6 +122,6 @@ import KeepAliveAgent from "agentkeepalive"; | ||
private fetch: Fetch; | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization }: ApiClientInterface) { | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }: ApiClientInterface) { | ||
this.apiKey = apiKey ?? ""; | ||
this.baseURL = baseURL ?? ""; | ||
this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization }) | ||
this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }) | ||
this.fetch = fetch; | ||
@@ -128,0 +128,0 @@ this.responseHeaders = {} |
@@ -14,3 +14,4 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
Authorization?: string; | ||
constructor({ apiKey, baseURL, config, virtualKey, provider, traceID, metadata, Authorization }: ApiClientInterface); | ||
cacheForceRefresh?: boolean | null | undefined; | ||
constructor({ apiKey, baseURL, config, virtualKey, provider, traceID, metadata, Authorization, cacheForceRefresh }: ApiClientInterface); | ||
completions: API.Completions; | ||
@@ -17,0 +18,0 @@ chat: API.Chat; |
@@ -34,3 +34,3 @@ "use strict"; | ||
var _b, _c; | ||
var { apiKey = (_b = (0, utils_1.readEnv)("PORTKEY_API_KEY")) !== null && _b !== void 0 ? _b : null, baseURL = (_c = (0, utils_1.readEnv)("PORTKEY_BASE_URL")) !== null && _c !== void 0 ? _c : null, config, virtualKey, provider, traceID, metadata, Authorization } = _a; | ||
var { apiKey = (_b = (0, utils_1.readEnv)("PORTKEY_API_KEY")) !== null && _b !== void 0 ? _b : null, baseURL = (_c = (0, utils_1.readEnv)("PORTKEY_BASE_URL")) !== null && _c !== void 0 ? _c : null, config, virtualKey, provider, traceID, metadata, Authorization, cacheForceRefresh } = _a; | ||
super({ | ||
@@ -44,3 +44,4 @@ apiKey, | ||
metadata, | ||
Authorization | ||
Authorization, | ||
cacheForceRefresh | ||
}); | ||
@@ -66,2 +67,3 @@ this.completions = new API.Completions(this); | ||
this.metadata = metadata; | ||
this.cacheForceRefresh = cacheForceRefresh; | ||
} | ||
@@ -68,0 +70,0 @@ } |
@@ -18,2 +18,3 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
Authorization?: string; | ||
cacheForceRefresh?: boolean | null | undefined; | ||
constructor({ | ||
@@ -27,4 +28,4 @@ apiKey = readEnv("PORTKEY_API_KEY") ?? null, | ||
metadata, | ||
Authorization | ||
Authorization, | ||
cacheForceRefresh | ||
}: ApiClientInterface) { | ||
@@ -40,3 +41,4 @@ | ||
metadata, | ||
Authorization | ||
Authorization, | ||
cacheForceRefresh | ||
}); | ||
@@ -53,2 +55,3 @@ this.apiKey = apiKey; | ||
this.metadata = metadata | ||
this.cacheForceRefresh = cacheForceRefresh; | ||
} | ||
@@ -55,0 +58,0 @@ |
{ | ||
"name": "portkey-ai", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Node client library for the Portkey API", | ||
@@ -5,0 +5,0 @@ "types": "dist/src/index.d.ts", |
@@ -12,2 +12,3 @@ export type Headers = Record<string, string | null | undefined> | ||
Authorization?: string | null | undefined; | ||
cacheForceRefresh?: boolean | null | undefined; | ||
} | ||
@@ -14,0 +15,0 @@ |
@@ -7,3 +7,6 @@ import { getPortkeyHeader, isEmpty } from "../utils" | ||
for (let k in config) { | ||
let v = config[k] | ||
let v = config[k]; | ||
if (isEmpty(v)) continue; | ||
// convert to snakecase | ||
@@ -10,0 +13,0 @@ if (k.toLocaleLowerCase() === "authorization") { |
@@ -122,6 +122,6 @@ import KeepAliveAgent from "agentkeepalive"; | ||
private fetch: Fetch; | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization }: ApiClientInterface) { | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }: ApiClientInterface) { | ||
this.apiKey = apiKey ?? ""; | ||
this.baseURL = baseURL ?? ""; | ||
this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization }) | ||
this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh }) | ||
this.fetch = fetch; | ||
@@ -128,0 +128,0 @@ this.responseHeaders = {} |
@@ -18,2 +18,3 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
Authorization?: string; | ||
cacheForceRefresh?: boolean | null | undefined; | ||
constructor({ | ||
@@ -27,4 +28,4 @@ apiKey = readEnv("PORTKEY_API_KEY") ?? null, | ||
metadata, | ||
Authorization | ||
Authorization, | ||
cacheForceRefresh | ||
}: ApiClientInterface) { | ||
@@ -40,3 +41,4 @@ | ||
metadata, | ||
Authorization | ||
Authorization, | ||
cacheForceRefresh | ||
}); | ||
@@ -53,2 +55,3 @@ this.apiKey = apiKey; | ||
this.metadata = metadata | ||
this.cacheForceRefresh = cacheForceRefresh; | ||
} | ||
@@ -55,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1344944
4876