portkey-ai
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "portkey-ai", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Node client library for the Portkey API", | ||
@@ -5,0 +5,0 @@ "types": "./src/index.d.ts", |
@@ -14,2 +14,17 @@ export type Headers = Record<string, string | null | undefined>; | ||
customHost?: string | null | undefined; | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
} | ||
@@ -16,0 +31,0 @@ export interface APIResponseType { |
@@ -14,3 +14,18 @@ export type Headers = Record<string, string | null | undefined> | ||
debug?: boolean | null | undefined; | ||
customHost?: string | null | undefined | ||
customHost?: string | null | undefined; | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
} | ||
@@ -17,0 +32,0 @@ |
@@ -20,2 +20,6 @@ "use strict"; | ||
} | ||
// logic to handle forwardHeaders into a comma separated string | ||
if (k === "forwardHeaders") { | ||
v = v.join(','); | ||
} | ||
k = k.replace('ID', 'Id') | ||
@@ -22,0 +26,0 @@ .replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`); |
@@ -21,2 +21,8 @@ import { getPortkeyHeader, isEmpty } from "../utils" | ||
// logic to handle forwardHeaders into a comma separated string | ||
if (k === "forwardHeaders") { | ||
v = v.join(',') | ||
} | ||
k = k.replace('ID', 'Id') | ||
@@ -23,0 +29,0 @@ .replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`) |
@@ -43,3 +43,3 @@ /// <reference types="node" /> | ||
private 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, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout }: ApiClientInterface); | ||
protected defaultHeaders(): Record<string, string>; | ||
@@ -46,0 +46,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, cacheForceRefresh, debug, customHost }) { | ||
constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout }) { | ||
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, cacheForceRefresh, debug, customHost }); | ||
this.customHeaders = (0, apis_1.createHeaders)({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost, cacheNamespace, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, requestTimeout }); | ||
this.portkeyHeaders = this.defaultHeaders(); | ||
@@ -88,0 +88,0 @@ this.fetch = fetch; |
@@ -123,6 +123,6 @@ import KeepAliveAgent from "agentkeepalive"; | ||
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, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout }: 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, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, requestTimeout }) | ||
this.portkeyHeaders = this.defaultHeaders() | ||
@@ -129,0 +129,0 @@ this.fetch = fetch; |
@@ -17,3 +17,18 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
customHost?: string | null | undefined; | ||
constructor({ apiKey, baseURL, config, virtualKey, provider, traceID, metadata, Authorization, cacheForceRefresh, debug, customHost, }: ApiClientInterface); | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
constructor({ apiKey, baseURL, config, virtualKey, provider, traceID, metadata, Authorization, cacheForceRefresh, debug, customHost, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout, }: ApiClientInterface); | ||
completions: API.Completions; | ||
@@ -20,0 +35,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, cacheForceRefresh, debug, customHost, } = _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, debug, customHost, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout, } = _a; | ||
super({ | ||
@@ -47,3 +47,18 @@ apiKey, | ||
debug, | ||
customHost | ||
customHost, | ||
cacheNamespace, | ||
openaiProject, | ||
openaiOrganization, | ||
awsSecretAccessKey, | ||
awsAccessKeyId, | ||
awsSessionToken, | ||
awsRegion, | ||
vertexProjectId, | ||
vertexRegion, | ||
workersAiAccountId, | ||
azureResourceName, | ||
azureDeploymentId, | ||
azureApiVersion, | ||
forwardHeaders, | ||
requestTimeout, | ||
}); | ||
@@ -79,2 +94,18 @@ this.completions = new API.Completions(this); | ||
this.customHost = customHost; | ||
this.cacheNamespace = cacheNamespace; | ||
; | ||
this.openaiProject = openaiProject; | ||
this.openaiOrganization = openaiOrganization; | ||
this.awsSecretAccessKey = awsSecretAccessKey; | ||
this.awsAccessKeyId = awsAccessKeyId; | ||
this.awsSessionToken = awsSessionToken; | ||
this.awsRegion = awsRegion; | ||
this.vertexProjectId = vertexProjectId; | ||
this.vertexRegion = vertexRegion; | ||
this.workersAiAccountId = workersAiAccountId; | ||
this.azureResourceName = azureResourceName; | ||
this.azureDeploymentId = azureDeploymentId; | ||
this.azureApiVersion = azureApiVersion; | ||
this.forwardHeaders = forwardHeaders; | ||
this.requestTimeout = requestTimeout; | ||
} | ||
@@ -81,0 +112,0 @@ } |
@@ -20,2 +20,17 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
customHost?: string | null | undefined; | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
constructor({ | ||
@@ -33,2 +48,17 @@ apiKey = readEnv("PORTKEY_API_KEY") ?? null, | ||
customHost, | ||
openaiProject, | ||
openaiOrganization, | ||
awsSecretAccessKey, | ||
awsAccessKeyId, | ||
awsSessionToken, | ||
awsRegion, | ||
vertexProjectId, | ||
vertexRegion, | ||
workersAiAccountId, | ||
azureResourceName, | ||
azureDeploymentId, | ||
azureApiVersion, | ||
forwardHeaders, | ||
cacheNamespace, | ||
requestTimeout, | ||
}: ApiClientInterface) { | ||
@@ -47,3 +77,18 @@ | ||
debug, | ||
customHost | ||
customHost, | ||
cacheNamespace, | ||
openaiProject, | ||
openaiOrganization, | ||
awsSecretAccessKey, | ||
awsAccessKeyId, | ||
awsSessionToken, | ||
awsRegion, | ||
vertexProjectId, | ||
vertexRegion, | ||
workersAiAccountId, | ||
azureResourceName, | ||
azureDeploymentId, | ||
azureApiVersion, | ||
forwardHeaders, | ||
requestTimeout, | ||
}); | ||
@@ -63,3 +108,18 @@ | ||
this.debug = debug; | ||
this.customHost = customHost | ||
this.customHost = customHost; | ||
this.cacheNamespace = cacheNamespace;; | ||
this.openaiProject = openaiProject; | ||
this.openaiOrganization = openaiOrganization; | ||
this.awsSecretAccessKey = awsSecretAccessKey; | ||
this.awsAccessKeyId = awsAccessKeyId; | ||
this.awsSessionToken = awsSessionToken; | ||
this.awsRegion = awsRegion; | ||
this.vertexProjectId = vertexProjectId; | ||
this.vertexRegion = vertexRegion; | ||
this.workersAiAccountId = workersAiAccountId; | ||
this.azureResourceName = azureResourceName; | ||
this.azureDeploymentId = azureDeploymentId; | ||
this.azureApiVersion = azureApiVersion; | ||
this.forwardHeaders = forwardHeaders; | ||
this.requestTimeout = requestTimeout; | ||
} | ||
@@ -66,0 +126,0 @@ |
{ | ||
"name": "portkey-ai", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Node client library for the Portkey API", | ||
@@ -5,0 +5,0 @@ "types": "dist/src/index.d.ts", |
@@ -14,3 +14,18 @@ export type Headers = Record<string, string | null | undefined> | ||
debug?: boolean | null | undefined; | ||
customHost?: string | null | undefined | ||
customHost?: string | null | undefined; | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
} | ||
@@ -17,0 +32,0 @@ |
@@ -21,2 +21,8 @@ import { getPortkeyHeader, isEmpty } from "../utils" | ||
// logic to handle forwardHeaders into a comma separated string | ||
if (k === "forwardHeaders") { | ||
v = v.join(',') | ||
} | ||
k = k.replace('ID', 'Id') | ||
@@ -23,0 +29,0 @@ .replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`) |
@@ -123,6 +123,6 @@ import KeepAliveAgent from "agentkeepalive"; | ||
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, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, cacheNamespace, requestTimeout }: 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, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders, requestTimeout }) | ||
this.portkeyHeaders = this.defaultHeaders() | ||
@@ -129,0 +129,0 @@ this.fetch = fetch; |
@@ -20,2 +20,17 @@ import { ApiClientInterface } from "./_types/generalTypes"; | ||
customHost?: string | null | undefined; | ||
openaiProject?: string | null | undefined; | ||
openaiOrganization?: string | null | undefined; | ||
awsSecretAccessKey?: string | null | undefined; | ||
awsAccessKeyId?: string | null | undefined; | ||
awsSessionToken?: string | null | undefined; | ||
awsRegion?: string | null | undefined; | ||
vertexProjectId?: string | null | undefined; | ||
vertexRegion?: string | null | undefined; | ||
workersAiAccountId?: string | null | undefined; | ||
azureResourceName?: string | null | undefined; | ||
azureDeploymentId?: string | null | undefined; | ||
azureApiVersion?: string | null | undefined; | ||
forwardHeaders?: Array<string> | null | undefined; | ||
requestTimeout?: number | null | undefined; | ||
cacheNamespace?: string | null | undefined; | ||
constructor({ | ||
@@ -33,2 +48,17 @@ apiKey = readEnv("PORTKEY_API_KEY") ?? null, | ||
customHost, | ||
openaiProject, | ||
openaiOrganization, | ||
awsSecretAccessKey, | ||
awsAccessKeyId, | ||
awsSessionToken, | ||
awsRegion, | ||
vertexProjectId, | ||
vertexRegion, | ||
workersAiAccountId, | ||
azureResourceName, | ||
azureDeploymentId, | ||
azureApiVersion, | ||
forwardHeaders, | ||
cacheNamespace, | ||
requestTimeout, | ||
}: ApiClientInterface) { | ||
@@ -47,3 +77,18 @@ | ||
debug, | ||
customHost | ||
customHost, | ||
cacheNamespace, | ||
openaiProject, | ||
openaiOrganization, | ||
awsSecretAccessKey, | ||
awsAccessKeyId, | ||
awsSessionToken, | ||
awsRegion, | ||
vertexProjectId, | ||
vertexRegion, | ||
workersAiAccountId, | ||
azureResourceName, | ||
azureDeploymentId, | ||
azureApiVersion, | ||
forwardHeaders, | ||
requestTimeout, | ||
}); | ||
@@ -63,3 +108,18 @@ | ||
this.debug = debug; | ||
this.customHost = customHost | ||
this.customHost = customHost; | ||
this.cacheNamespace = cacheNamespace;; | ||
this.openaiProject = openaiProject; | ||
this.openaiOrganization = openaiOrganization; | ||
this.awsSecretAccessKey = awsSecretAccessKey; | ||
this.awsAccessKeyId = awsAccessKeyId; | ||
this.awsSessionToken = awsSessionToken; | ||
this.awsRegion = awsRegion; | ||
this.vertexProjectId = vertexProjectId; | ||
this.vertexRegion = vertexRegion; | ||
this.workersAiAccountId = workersAiAccountId; | ||
this.azureResourceName = azureResourceName; | ||
this.azureDeploymentId = azureDeploymentId; | ||
this.azureApiVersion = azureApiVersion; | ||
this.forwardHeaders = forwardHeaders; | ||
this.requestTimeout = requestTimeout; | ||
} | ||
@@ -66,0 +126,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
7102203
8517