Skip to content

Commit

Permalink
feat: flexiable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
csgulati09 committed Mar 18, 2024
1 parent ca4b93f commit c3a181f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 37 deletions.
8 changes: 4 additions & 4 deletions src/apis/assistants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface FileCreateParams {

export interface FileListParams extends CursorPageParams {
before?: string;
order?: 'asc' | 'desc';
order?: string;
}

export interface CursorPageParams {
Expand All @@ -32,7 +32,7 @@ export interface CursorPageParams {

export interface AssistantListParams extends CursorPageParams {
before?: string;
order?: 'asc' | 'desc';
order?: string;
}

export interface AssistantUpdateParams {
Expand Down Expand Up @@ -99,7 +99,7 @@ export class Assistants extends ApiResource {
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.assistants.list(query, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -230,7 +230,7 @@ export class Files extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.assistants.files.list(assistantId, query, opts).withResponse();

return finalResponse(result);
Expand Down
17 changes: 9 additions & 8 deletions src/apis/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class MainFiles extends ApiResource {
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});


// @ts-ignore
const result = await OAIclient.files.create(body, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -135,17 +136,17 @@ export class MainFiles extends ApiResource {

export interface FileCreateParams {
file: any;
purpose: 'fine-tune' | 'assistants';
purpose?: string;
}

export interface FileObject {
id: string;
bytes: number;
created_at: number;
filename: string;
object: 'file';
purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';
status: 'uploaded' | 'processed' | 'error';
bytes?: number;
created_at?: number;
filename?: string;
object?: string;
purpose?: string;
status?: string;
status_details?: string;
}

Expand Down
27 changes: 14 additions & 13 deletions src/apis/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ import OpenAI from "openai";

export interface ImagesBody {
prompt: string;
model?: (string & {}) | "dall-e-2" | "dall-e-3";
model?: (string & {});
n?: number | null;
quality?: "standard" | "hd";
response_format?: "url" | "b64_json" | null;
size?: "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792" | null;
style?: "vivid" | "natural" | null;
quality?: string;
response_format?: string | null;
size?: string | null;
style?: string | null;
user?: string;
}

export interface ImageEditParams {
image: any;
prompt: string;
mask?: any;
model?: (string & {}) | 'dall-e-2' | null;
model?: (string & {}) | null;
n?: number | null;
response_format?: 'url' | 'b64_json' | null;
size?: '256x256' | '512x512' | '1024x1024' | null;
response_format?: string | null;
size?: string | null;
user?: string;
}

export interface ImageCreateVariationParams {
image: any;
model?: (string & {}) | 'dall-e-2' | null;
model?: (string & {}) | null;
n?: number | null;
response_format?: 'url' | 'b64_json' | null;
size?: '256x256' | '512x512' | '1024x1024' | null;
response_format?: string | null;
size?: string | null;
user?: string;
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export class Images extends ApiResource {
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.images.generate(body, opts).withResponse();

return finalResponse(result);
Expand All @@ -94,6 +94,7 @@ export class Images extends ApiResource {
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.images.edit(body, opts).withResponse();

return finalResponse(result);
Expand All @@ -118,7 +119,7 @@ export class Images extends ApiResource {
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.images.createVariation(body, opts).withResponse();

return finalResponse(result);
Expand Down
24 changes: 12 additions & 12 deletions src/apis/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Threads extends ApiResource {
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.create(body, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -175,7 +175,7 @@ export class Messages extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.messages.create(threadId, body, opts).withResponse();

return finalResponse(result);
Expand All @@ -201,7 +201,7 @@ export class Messages extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.messages.list(threadId, query, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -286,7 +286,7 @@ export class Files extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.messages.files.list(threadId, messageId, query, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -376,7 +376,7 @@ export class Runs extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.runs.list(threadId, query, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -511,7 +511,7 @@ export class Steps extends ApiResource{
baseURL: this.client.baseURL,
defaultHeaders: {...this.client.customHeaders, ...this.client.portkeyHeaders},
});

// @ts-ignore
const result = await OAIclient.beta.threads.runs.steps.list(threadId, runId, query, opts).withResponse();

return finalResponse(result);
Expand Down Expand Up @@ -555,7 +555,7 @@ export interface ThreadCreateParams {
export namespace ThreadCreateParams {
export interface Message {
content: string;
role: 'user';
role: string;
file_ids?: Array<string>;
metadata?: unknown | null;
}
Expand All @@ -567,13 +567,13 @@ export interface ThreadUpdateParams {

export interface MessageCreateParams {
content: string;
role: 'user';
role: string;
file_ids?: Array<string>;
metadata?: unknown | null;
}

export interface MessageListParams extends CursorPageParams {
order?: 'asc' | 'desc';
order?: string;
}

export interface CursorPageParams {
Expand All @@ -584,7 +584,7 @@ export interface CursorPageParams {

export interface FileListParams extends CursorPageParams {
before?: string;
order?: 'asc' | 'desc';
order?: string;
}

export interface MessageUpdateParams {
Expand Down Expand Up @@ -612,12 +612,12 @@ export interface ThreadCreateAndRunParams {

export interface RunListParams extends CursorPageParams {
before?: string;
order?: 'asc' | 'desc';
order?: string;
}

export interface StepListParams extends CursorPageParams {
before?: string;
order?: 'asc' | 'desc';
order?: string;
}

export interface RunUpdateParams {
Expand Down

0 comments on commit c3a181f

Please sign in to comment.