Skip to content

Commit

Permalink
feat: request-timeout header supported
Browse files Browse the repository at this point in the history
  • Loading branch information
csgulati09 committed Jun 18, 2024
1 parent 59517cc commit d52f086
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/_types/generalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ApiClientInterface {
azureApiVersion?: string | null | undefined;
forwardHeaders?: Array<string> | null | undefined;
cacheNamespace?: string | null | undefined;
requestTimeout?: number | null | undefined;
}

export interface APIResponseType {
Expand Down
4 changes: 2 additions & 2 deletions src/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export abstract class ApiClient {
portkeyHeaders: Record<string, string>

private fetch: Fetch;
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 }: 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, cacheNamespace, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, forwardHeaders })
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()
this.fetch = fetch;
this.responseHeaders = {}
Expand Down
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Portkey extends ApiClient {
azureDeploymentId?: string | null | undefined;
azureApiVersion?: string | null | undefined;
forwardHeaders?: Array<string> | null | undefined;
requestTimeout? : number | null | undefined;

cacheNamespace?: string | null | undefined;
constructor({
Expand Down Expand Up @@ -58,6 +59,7 @@ export class Portkey extends ApiClient {
azureApiVersion,
forwardHeaders,
cacheNamespace,
requestTimeout,
}: ApiClientInterface) {

super({
Expand Down Expand Up @@ -86,6 +88,7 @@ export class Portkey extends ApiClient {
azureDeploymentId,
azureApiVersion,
forwardHeaders,
requestTimeout,
});

this.apiKey = apiKey;
Expand Down Expand Up @@ -115,6 +118,7 @@ export class Portkey extends ApiClient {
this.azureDeploymentId = azureDeploymentId;
this.azureApiVersion = azureApiVersion;
this.forwardHeaders = forwardHeaders;
this.requestTimeout = requestTimeout;
}

completions: API.Completions = new API.Completions(this);
Expand Down

0 comments on commit d52f086

Please sign in to comment.