From 7a8acf48d07c60e05cf7e2beea593c2f460e1b4f Mon Sep 17 00:00:00 2001 From: Saif Ali Shaik Date: Thu, 2 May 2024 17:15:46 +0530 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20[bugfix]=20portkey=20?= =?UTF-8?q?sdk=20drops=20customhost=20header=20to=20ollama?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_types/generalTypes.ts | 3 ++- src/baseClient.ts | 6 +++--- src/client.ts | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/_types/generalTypes.ts b/src/_types/generalTypes.ts index d3b8e88..23aa547 100644 --- a/src/_types/generalTypes.ts +++ b/src/_types/generalTypes.ts @@ -11,8 +11,9 @@ export interface ApiClientInterface { Authorization?: string | null | undefined; cacheForceRefresh?: boolean | null | undefined; debug?: boolean | null | undefined; + customHost?: string | null | undefined } export interface APIResponseType { getHeaders: () => Record | null | undefined -} \ No newline at end of file +} diff --git a/src/baseClient.ts b/src/baseClient.ts index 99f14e5..8be7265 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 }: ApiClientInterface) { + constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost }: ApiClientInterface) { this.apiKey = apiKey ?? ""; this.baseURL = baseURL ?? ""; - this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug }) + this.customHeaders = createHeaders({ apiKey, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost }) this.portkeyHeaders = this.defaultHeaders() this.fetch = fetch; this.responseHeaders = {} @@ -204,4 +204,4 @@ export abstract class ApiClient { methodRequest(method: HTTPMethod, path: string, opts?: RequestOptions): APIPromise { return new APIPromise(this.request({ method, path, ...opts })) } -} \ No newline at end of file +} diff --git a/src/client.ts b/src/client.ts index da2e25f..e03f13c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -16,6 +16,7 @@ export class Portkey extends ApiClient { Authorization?: string; cacheForceRefresh?: boolean | null | undefined; debug?: boolean | null | undefined; + customHost?: string | null | undefined; constructor({ apiKey = readEnv("PORTKEY_API_KEY") ?? null, baseURL = readEnv("PORTKEY_BASE_URL") ?? null, @@ -27,6 +28,7 @@ export class Portkey extends ApiClient { Authorization, cacheForceRefresh, debug, + customHost, }: ApiClientInterface) { super({ @@ -40,6 +42,7 @@ export class Portkey extends ApiClient { Authorization, cacheForceRefresh, debug, + customHost }); this.apiKey = apiKey; @@ -54,6 +57,7 @@ export class Portkey extends ApiClient { this.metadata = metadata this.cacheForceRefresh = cacheForceRefresh; this.debug = debug; + this.customHost = customHost } completions: API.Completions = new API.Completions(this); @@ -80,4 +84,4 @@ export class Portkey extends ApiClient { return new API.postMethod(this).create(url, _body, params, opts) }; -} \ No newline at end of file +} From f2ae3ac40aba6e448d1741a42a70cdf2006ad35f Mon Sep 17 00:00:00 2001 From: Saif Ali Shaik Date: Thu, 2 May 2024 17:22:59 +0530 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20EOL=20whitespaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_types/generalTypes.ts | 2 +- src/baseClient.ts | 2 +- src/client.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_types/generalTypes.ts b/src/_types/generalTypes.ts index 23aa547..d1a785a 100644 --- a/src/_types/generalTypes.ts +++ b/src/_types/generalTypes.ts @@ -16,4 +16,4 @@ export interface ApiClientInterface { export interface APIResponseType { getHeaders: () => Record | null | undefined -} +} \ No newline at end of file diff --git a/src/baseClient.ts b/src/baseClient.ts index 8be7265..dbf6937 100644 --- a/src/baseClient.ts +++ b/src/baseClient.ts @@ -204,4 +204,4 @@ export abstract class ApiClient { methodRequest(method: HTTPMethod, path: string, opts?: RequestOptions): APIPromise { return new APIPromise(this.request({ method, path, ...opts })) } -} +} \ No newline at end of file diff --git a/src/client.ts b/src/client.ts index e03f13c..23559d5 100644 --- a/src/client.ts +++ b/src/client.ts @@ -84,4 +84,4 @@ export class Portkey extends ApiClient { return new API.postMethod(this).create(url, _body, params, opts) }; -} +} \ No newline at end of file