Skip to content

Commit

Permalink
fix: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam-pareek committed Sep 25, 2024
2 parents 7b876b2 + 6546f47 commit 81f1674
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portkey-ai",
"version": "1.4.0-rc.1",
"version": "1.4.0",
"description": "Node client library for the Portkey API",
"types": "dist/src/index.d.ts",
"main": "dist/src/index.js",
Expand Down
Binary file added speech.mp3
Binary file not shown.
1 change: 1 addition & 0 deletions src/_types/generalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface ApiClientInterface {
cacheNamespace?: string | null | undefined;
requestTimeout?: number | null | undefined;
strictOpenAiCompliance?: boolean | null | undefined;
anthropicBeta?: string | null | undefined;
}

export interface APIResponseType {
Expand Down
4 changes: 2 additions & 2 deletions src/apis/betaChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ChatCompletionStreamingToolRunnerParams,
} from "openai/lib/ChatCompletionStreamingRunner";
import { ChatCompletionParseParams } from "openai/resources/beta/chat/completions";
import { ExtractParsedContentFromParams } from "openai/lib/parser";


export class BetaChat extends ApiResource {
completions: Completions;
Expand All @@ -26,7 +26,7 @@ export class BetaChat extends ApiResource {

export class Completions extends ApiResource {

async parse<Params extends ChatCompletionParseParams, ParsedT = ExtractParsedContentFromParams<Params>>
async parse<Params extends ChatCompletionParseParams>
(
_body: Params,
params?: ApiClientInterface,
Expand Down
6 changes: 0 additions & 6 deletions src/apis/chatCompletions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ interface Usage {
[key: string]: any;
}

interface FunctionType {
arguments?: string;
name?: string;
[key: string]: any;
}

interface Message {
role: string;
content: string;
Expand Down
5 changes: 4 additions & 1 deletion src/apis/moderations.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { ModerationCreateParams } from "openai/resources";
import { ApiClientInterface } from "../_types/generalTypes";
import { ApiResource } from "../apiResource";
import { RequestOptions } from "../baseClient";
import { finalResponse, initOpenAIClient, overrideConfig } from "../utils";
import { createHeaders } from "./createHeaders";

export interface ModerationCreateParams {
input: string | Array<string>;
model?: any ;
}

export class Moderations extends ApiResource{
async create(_body: ModerationCreateParams,
Expand Down
5 changes: 4 additions & 1 deletion src/apis/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { ApiResource } from "../apiResource";
import { RequestOptions } from "../baseClient";
import { finalResponse, initOpenAIClient, overrideConfig } from "../utils";
import { createHeaders } from "./createHeaders";
import { UploadCompleteParams } from "openai/resources";
import { Uploadable } from "openai/uploads";

export interface UploadCompleteParams {
part_ids: Array<string>;
md5?: string;
}
export class Uploads extends ApiResource {
parts: Parts

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, huggingfaceBaseUrl, forwardHeaders, cacheNamespace, requestTimeout, strictOpenAiCompliance }: 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, huggingfaceBaseUrl, forwardHeaders, cacheNamespace, requestTimeout, strictOpenAiCompliance, anthropicBeta }: 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, huggingfaceBaseUrl, forwardHeaders, requestTimeout, strictOpenAiCompliance })
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, huggingfaceBaseUrl, forwardHeaders, requestTimeout, strictOpenAiCompliance, anthropicBeta })
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 @@ -35,6 +35,7 @@ export class Portkey extends ApiClient {
requestTimeout?: number | null | undefined;
cacheNamespace?: string | null | undefined;
strictOpenAiCompliance?: boolean | null | undefined;
anthropicBeta?: string | null | undefined;
constructor({
apiKey = readEnv("PORTKEY_API_KEY") ?? null,
baseURL = readEnv("PORTKEY_BASE_URL") ?? null,
Expand Down Expand Up @@ -64,6 +65,7 @@ export class Portkey extends ApiClient {
cacheNamespace,
requestTimeout,
strictOpenAiCompliance,
anthropicBeta,
}: ApiClientInterface) {

super({
Expand Down Expand Up @@ -95,6 +97,7 @@ export class Portkey extends ApiClient {
forwardHeaders,
requestTimeout,
strictOpenAiCompliance,
anthropicBeta,
});

this.apiKey = apiKey;
Expand Down Expand Up @@ -127,6 +130,7 @@ export class Portkey extends ApiClient {
this.forwardHeaders = forwardHeaders;
this.requestTimeout = requestTimeout;
this.strictOpenAiCompliance = strictOpenAiCompliance;
this.anthropicBeta = anthropicBeta;
}

completions: API.Completions = new API.Completions(this);
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "1.4.0-rc.1";
export const VERSION = "1.4.0";

0 comments on commit 81f1674

Please sign in to comment.