portkey-ai
Advanced tools
Comparing version 1.5.7 to 1.6.0
{ | ||
"name": "portkey-ai", | ||
"version": "1.5.7", | ||
"version": "1.6.0", | ||
"description": "Node client library for the Portkey API", | ||
@@ -27,4 +27,4 @@ "types": "./src/index.d.ts", | ||
"dotenv": "^16.3.1", | ||
"openai": "4.55.3" | ||
"openai": "4.77.0" | ||
} | ||
} |
import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { ApiResource } from '../apiResource'; | ||
import { RequestOptions } from '../baseClient'; | ||
import { AssistantUpdateParams as oaiAssistantUpdateParams } from 'openai/resources/beta/assistants'; | ||
export interface AssistantCreateParams { | ||
@@ -41,2 +42,6 @@ model: string; | ||
tools?: Array<any>; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_resources?: oaiAssistantUpdateParams.ToolResources | null; | ||
top_p?: number | null; | ||
[key: string]: any; | ||
@@ -43,0 +48,0 @@ } |
@@ -6,2 +6,3 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { createHeaders } from './createHeaders'; | ||
import { AssistantUpdateParams as oaiAssistantUpdateParams } from 'openai/resources/beta/assistants'; | ||
@@ -50,2 +51,6 @@ export interface AssistantCreateParams { | ||
tools?: Array<any>; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_resources?: oaiAssistantUpdateParams.ToolResources | null; | ||
top_p?: number | null; | ||
[key: string]: any; | ||
@@ -52,0 +57,0 @@ } |
@@ -18,2 +18,9 @@ import { ChatCompletionMessageToolCall, ChatCompletionStreamOptions, ChatCompletionTokenLogprob } from 'openai/resources/chat/completions'; | ||
response_format?: object; | ||
audio?: any | null; | ||
modalities?: Array<any> | null; | ||
prediction?: any | null; | ||
reasoning_effort?: any; | ||
store?: boolean | null; | ||
metadata?: Record<string, string> | null; | ||
max_completion_tokens?: number | null; | ||
} | ||
@@ -41,2 +48,3 @@ export interface ChatCompletionsBodyStreaming extends ChatCompletionsBodyBase { | ||
tool_call_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -43,0 +51,0 @@ export interface Logprobs { |
@@ -62,2 +62,9 @@ import { | ||
response_format?: object; | ||
audio?: any | null; | ||
modalities?: Array<any> | null; | ||
prediction?: any | null; | ||
reasoning_effort?: any; | ||
store?: boolean | null; | ||
metadata?: Record<string, string> | null; | ||
max_completion_tokens?: number | null; | ||
} | ||
@@ -93,2 +100,3 @@ | ||
tool_call_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -95,0 +103,0 @@ |
@@ -14,4 +14,8 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
} | ||
export interface ChatCompletionStreamOptions { | ||
include_usage?: boolean; | ||
} | ||
export interface CompletionsBodyStreaming extends CompletionsBodyBase { | ||
stream?: true; | ||
stream_options?: ChatCompletionStreamOptions | null; | ||
} | ||
@@ -26,2 +30,3 @@ export interface CompletionsBodyNonStreaming extends CompletionsBodyBase { | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
@@ -33,2 +38,3 @@ interface Logprobs { | ||
top_logprobs?: Array<Record<string, number>>; | ||
[key: string]: any; | ||
} | ||
@@ -40,2 +46,3 @@ interface Choices { | ||
finish_reason?: string; | ||
[key: string]: any; | ||
} | ||
@@ -50,3 +57,4 @@ interface TextCompletion extends APIResponseType { | ||
system_fingerprint?: string; | ||
[key: string]: any; | ||
} | ||
export {}; |
@@ -53,4 +53,9 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
export interface ChatCompletionStreamOptions { | ||
include_usage?: boolean; | ||
} | ||
export interface CompletionsBodyStreaming extends CompletionsBodyBase { | ||
stream?: true; | ||
stream_options?: ChatCompletionStreamOptions | null; | ||
} | ||
@@ -70,2 +75,3 @@ | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
@@ -75,8 +81,6 @@ | ||
text_offset?: Array<number>; | ||
token_logprobs?: Array<number>; | ||
tokens?: Array<string>; | ||
top_logprobs?: Array<Record<string, number>>; | ||
[key: string]: any; | ||
} | ||
@@ -89,2 +93,3 @@ | ||
finish_reason?: string; | ||
[key: string]: any; | ||
} | ||
@@ -100,2 +105,3 @@ | ||
system_fingerprint?: string; | ||
[key: string]: any; | ||
} |
@@ -11,5 +11,23 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
} | ||
export type EmbeddingsResponse = Record<string, any> & APIResponseType; | ||
export interface EmbeddingArr { | ||
embedding?: Array<number>; | ||
index?: number; | ||
object?: string; | ||
[key: string]: any; | ||
} | ||
export interface Usage { | ||
prompt_tokens?: number; | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
interface EmbeddingsResponse extends APIResponseType { | ||
data?: Array<EmbeddingArr>; | ||
model?: string; | ||
object?: string; | ||
usage?: Usage; | ||
[key: string]: any; | ||
} | ||
export declare class Embeddings extends ApiResource { | ||
create(_body: EmbeddingsBody, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<EmbeddingsResponse>; | ||
} | ||
export {}; |
@@ -16,4 +16,23 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
export type EmbeddingsResponse = Record<string, any> & APIResponseType; | ||
export interface EmbeddingArr { | ||
embedding?: Array<number>; | ||
index?: number; | ||
object?: string; | ||
[key: string]: any; | ||
} | ||
export interface Usage { | ||
prompt_tokens?: number; | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
interface EmbeddingsResponse extends APIResponseType { | ||
data?: Array<EmbeddingArr>; | ||
model?: string; | ||
object?: string; | ||
usage?: Usage; | ||
[key: string]: any; | ||
} | ||
export class Embeddings extends ApiResource { | ||
@@ -20,0 +39,0 @@ create( |
@@ -11,3 +11,8 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
retrieveContent(fileId: string, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
waitForProcessing(id: string, _body: PollOptions, params?: ApiClientInterface): Promise<FileObject>; | ||
} | ||
interface PollOptions { | ||
pollInterval?: number | undefined; | ||
maxWait?: number | undefined; | ||
} | ||
export interface FileCreateParams { | ||
@@ -27,6 +32,9 @@ file: any; | ||
status_details?: string; | ||
[key: string]: any; | ||
} | ||
export interface FileListParams { | ||
purpose?: string; | ||
order?: 'asc' | 'desc'; | ||
[key: string]: any; | ||
} | ||
export {}; |
@@ -87,4 +87,18 @@ "use strict"; | ||
} | ||
waitForProcessing(id, _body, params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = _body; | ||
if (params) { | ||
const config = (0, utils_1.overrideConfig)(this.client.config, params.config); | ||
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); | ||
} | ||
const OAIclient = (0, utils_1.initOpenAIClient)(this.client); | ||
const result = yield OAIclient.files.waitForProcessing(id, Object.assign(Object.assign({}, (body.pollInterval !== undefined && { | ||
pollInterval: body.pollInterval, | ||
})), (body.maxWait !== undefined && { maxWait: body.maxWait }))); | ||
return result; | ||
}); | ||
} | ||
} | ||
exports.MainFiles = MainFiles; | ||
//# sourceMappingURL=files.js.map |
@@ -131,4 +131,35 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
} | ||
async waitForProcessing( | ||
id: string, | ||
_body: PollOptions, | ||
params?: ApiClientInterface | ||
): Promise<FileObject> { | ||
const body: PollOptions = _body; | ||
if (params) { | ||
const config = overrideConfig(this.client.config, params.config); | ||
this.client.customHeaders = { | ||
...this.client.customHeaders, | ||
...createHeaders({ ...params, config }), | ||
}; | ||
} | ||
const OAIclient = initOpenAIClient(this.client); | ||
const result = await OAIclient.files.waitForProcessing(id, { | ||
...(body.pollInterval !== undefined && { | ||
pollInterval: body.pollInterval, | ||
}), | ||
...(body.maxWait !== undefined && { maxWait: body.maxWait }), | ||
}); | ||
return result; | ||
} | ||
} | ||
interface PollOptions { | ||
pollInterval?: number | undefined; | ||
maxWait?: number | undefined; | ||
} | ||
export interface FileCreateParams { | ||
@@ -149,2 +180,3 @@ file: any; | ||
status_details?: string; | ||
[key: string]: any; | ||
} | ||
@@ -154,3 +186,4 @@ | ||
purpose?: string; | ||
order?: 'asc' | 'desc'; | ||
[key: string]: any; | ||
} |
@@ -38,2 +38,3 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
data: Array<Image>; | ||
[key: string]: any; | ||
} | ||
@@ -44,2 +45,3 @@ export interface Image { | ||
url?: string; | ||
[key: string]: any; | ||
} | ||
@@ -46,0 +48,0 @@ export declare class Images extends ApiResource { |
@@ -43,4 +43,4 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
created: number; | ||
data: Array<Image>; | ||
[key: string]: any; | ||
} | ||
@@ -52,2 +52,3 @@ | ||
url?: string; | ||
[key: string]: any; | ||
} | ||
@@ -54,0 +55,0 @@ |
import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { ApiResource } from '../apiResource'; | ||
import { RequestOptions } from '../baseClient'; | ||
import { ThreadCreateParams as oaiThreadCreateParams, ThreadUpdateParams as oaiThreadUpdateParams, ThreadCreateAndRunParams as oaiThreadCreateAndRunParams, AssistantToolChoiceOption } from 'openai/resources/beta/threads/threads'; | ||
export declare class Threads extends ApiResource { | ||
@@ -23,2 +24,3 @@ messages: Messages; | ||
update(threadId: string, messageId: string, _body: MessageUpdateParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
del(threadId: string, messageId: string, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
} | ||
@@ -54,2 +56,3 @@ export declare class Runs extends ApiResource { | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadCreateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -65,2 +68,3 @@ } | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadUpdateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -72,2 +76,3 @@ } | ||
file_ids?: Array<string>; | ||
attachments?: Array<any> | null; | ||
metadata?: unknown | null; | ||
@@ -78,2 +83,5 @@ [key: string]: any; | ||
order?: string; | ||
before?: string; | ||
run_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -100,2 +108,13 @@ export interface CursorPageParams { | ||
stream?: boolean | null; | ||
include?: Array<any>; | ||
additional_messages?: Array<any> | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: any | null; | ||
top_p?: number | null; | ||
truncation_strategy?: any | null; | ||
[key: string]: any; | ||
} | ||
@@ -113,2 +132,12 @@ export interface RunCreateParamsNonStreaming extends RunCreateParams { | ||
stream?: boolean | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: AssistantToolChoiceOption | null; | ||
tool_resources?: oaiThreadCreateAndRunParams.ToolResources | null; | ||
top_p?: number | null; | ||
truncation_strategy?: oaiThreadCreateAndRunParams.TruncationStrategy | null; | ||
[key: string]: any; | ||
} | ||
@@ -120,2 +149,3 @@ export interface ThreadCreateAndRunParamsNonStreaming extends ThreadCreateAndRunParams { | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -129,2 +159,4 @@ export interface RunListParams extends CursorPageParams { | ||
order?: string; | ||
include?: Array<any>; | ||
[key: string]: any; | ||
} | ||
@@ -145,2 +177,3 @@ export interface RunUpdateParams { | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -147,0 +180,0 @@ export interface RunSubmitToolOutputsParamsNonStreaming extends RunSubmitToolOutputsParams { |
@@ -185,2 +185,15 @@ "use strict"; | ||
} | ||
del(threadId, messageId, params, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (params) { | ||
const config = (0, utils_1.overrideConfig)(this.client.config, params.config); | ||
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); | ||
} | ||
const OAIclient = (0, utils_1.initOpenAIClient)(this.client); | ||
const result = yield OAIclient.beta.threads.messages | ||
.del(threadId, messageId, opts) | ||
.withResponse(); | ||
return (0, utils_1.finalResponse)(result); | ||
}); | ||
} | ||
} | ||
@@ -187,0 +200,0 @@ exports.Messages = Messages; |
@@ -6,2 +6,8 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { createHeaders } from './createHeaders'; | ||
import { | ||
ThreadCreateParams as oaiThreadCreateParams, | ||
ThreadUpdateParams as oaiThreadUpdateParams, | ||
ThreadCreateAndRunParams as oaiThreadCreateAndRunParams, | ||
AssistantToolChoiceOption, | ||
} from 'openai/resources/beta/threads/threads'; | ||
@@ -282,2 +288,25 @@ export class Threads extends ApiResource { | ||
} | ||
async del( | ||
threadId: string, | ||
messageId: string, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
if (params) { | ||
const config = overrideConfig(this.client.config, params.config); | ||
this.client.customHeaders = { | ||
...this.client.customHeaders, | ||
...createHeaders({ ...params, config }), | ||
}; | ||
} | ||
const OAIclient = initOpenAIClient(this.client); | ||
const result = await OAIclient.beta.threads.messages | ||
.del(threadId, messageId, opts) | ||
.withResponse(); | ||
return finalResponse(result); | ||
} | ||
} | ||
@@ -659,2 +688,3 @@ | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadCreateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -672,2 +702,3 @@ } | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadUpdateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -680,2 +711,3 @@ } | ||
file_ids?: Array<string>; | ||
attachments?: Array<any> | null; | ||
metadata?: unknown | null; | ||
@@ -687,2 +719,5 @@ [key: string]: any; | ||
order?: string; | ||
before?: string; | ||
run_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -714,2 +749,13 @@ | ||
stream?: boolean | null; | ||
include?: Array<any>; | ||
additional_messages?: Array<any> | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: any | null; | ||
top_p?: number | null; | ||
truncation_strategy?: any | null; | ||
[key: string]: any; | ||
} | ||
@@ -729,2 +775,12 @@ | ||
stream?: boolean | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: AssistantToolChoiceOption | null; | ||
tool_resources?: oaiThreadCreateAndRunParams.ToolResources | null; | ||
top_p?: number | null; | ||
truncation_strategy?: oaiThreadCreateAndRunParams.TruncationStrategy | null; | ||
[key: string]: any; | ||
} | ||
@@ -742,2 +798,3 @@ | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -753,2 +810,4 @@ | ||
order?: string; | ||
include?: Array<any>; | ||
[key: string]: any; | ||
} | ||
@@ -773,2 +832,3 @@ | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -775,0 +835,0 @@ |
@@ -15,3 +15,3 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
cancel(uploadId: string, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
complete(uploadId: string, _body: any, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
complete(uploadId: string, _body: UploadCompleteParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
} | ||
@@ -18,0 +18,0 @@ export declare class Parts extends ApiResource { |
@@ -63,7 +63,7 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
uploadId: string, | ||
_body: any, | ||
_body: UploadCompleteParams, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const body: any = _body; | ||
const body: UploadCompleteParams = _body; | ||
if (params) { | ||
@@ -70,0 +70,0 @@ const config = overrideConfig(this.client.config, params.config); |
@@ -5,2 +5,3 @@ import { Uploadable } from 'openai/uploads'; | ||
import { RequestOptions } from '../baseClient'; | ||
import { FileChunkingStrategyParam } from 'openai/resources/beta/vector-stores/vector-stores'; | ||
export declare class VectorStores extends ApiResource { | ||
@@ -13,3 +14,3 @@ files: Files; | ||
update(vectorStoreId: string, _body: VectorStoreUpdateParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
list(_query?: VectorStoreListParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
list(_query?: VectorStoreListParams | RequestOptions, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
del(vectorStoreId: string, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
@@ -34,3 +35,3 @@ } | ||
createAndPoll(vectorStoreId: string, _body: FileBatchCreateParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
listFiles(vectorStoreId: string, batchId: string, _query?: FileBatchListFilesParams, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
listFiles(vectorStoreId: string, batchId: string, _query?: FileBatchListFilesParams | RequestOptions, params?: ApiClientInterface, opts?: RequestOptions): Promise<any>; | ||
poll(vectorStoreId: string, batchId: string, params?: ApiClientInterface, opts?: RequestOptions & { | ||
@@ -52,2 +53,3 @@ pollIntervalMs?: number; | ||
export interface VectorStoreCreateParams { | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
expires_after?: ExpiresAfter; | ||
@@ -75,2 +77,3 @@ file_ids?: Array<string>; | ||
file_id: string; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -86,2 +89,3 @@ } | ||
file_ids: Array<string>; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -88,0 +92,0 @@ } |
@@ -7,2 +7,3 @@ import { Uploadable } from 'openai/uploads'; | ||
import { createHeaders } from './createHeaders'; | ||
import { FileChunkingStrategyParam } from 'openai/resources/beta/vector-stores/vector-stores'; | ||
@@ -90,7 +91,7 @@ export class VectorStores extends ApiResource { | ||
async list( | ||
_query?: VectorStoreListParams, | ||
_query?: VectorStoreListParams | RequestOptions, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const query: VectorStoreListParams | undefined = _query; | ||
const query: VectorStoreListParams | RequestOptions | undefined = _query; | ||
if (params) { | ||
@@ -107,3 +108,3 @@ const config = overrideConfig(this.client.config, params.config); | ||
const result = await OAIclient.beta.vectorStores | ||
.list(query, opts) | ||
.list(query as any, opts) | ||
.withResponse(); | ||
@@ -434,7 +435,7 @@ return finalResponse(result); | ||
batchId: string, | ||
_query?: FileBatchListFilesParams, | ||
_query?: FileBatchListFilesParams | RequestOptions, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const query: FileBatchListFilesParams | undefined = _query; | ||
const query: FileBatchListFilesParams | RequestOptions | undefined = _query; | ||
@@ -453,3 +454,3 @@ if (params) { | ||
const result = await OAIclient.beta.vectorStores.fileBatches | ||
.listFiles(vectorStoreId, batchId, query, opts) | ||
.listFiles(vectorStoreId, batchId, query as any, opts) | ||
.withResponse(); | ||
@@ -516,2 +517,3 @@ | ||
export interface VectorStoreCreateParams { | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
expires_after?: ExpiresAfter; | ||
@@ -544,2 +546,3 @@ file_ids?: Array<string>; | ||
file_id: string; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -557,2 +560,3 @@ } | ||
file_ids: Array<string>; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -559,0 +563,0 @@ } |
@@ -290,3 +290,3 @@ import KeepAliveAgent from 'agentkeepalive'; | ||
buildRequest(opts: FinalRequestOptions): { req: RequestInit; url: string } { | ||
const url = new URL(this.baseURL + opts.path!); | ||
const url = new URL(this.baseURL + opts.path); | ||
const { method, body } = opts; | ||
@@ -293,0 +293,0 @@ const reqHeaders: Record<string, string> = { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "1.5.7"; | ||
export declare const VERSION = "1.6.0"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '1.5.7'; | ||
exports.VERSION = '1.6.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '1.5.7'; | ||
export const VERSION = '1.6.0'; |
{ | ||
"name": "portkey-ai", | ||
"version": "1.5.7", | ||
"version": "1.6.0", | ||
"description": "Node client library for the Portkey API", | ||
@@ -47,4 +47,4 @@ "types": "dist/src/index.d.ts", | ||
"dotenv": "^16.3.1", | ||
"openai": "4.55.3" | ||
"openai": "4.77.0" | ||
} | ||
} |
@@ -6,2 +6,3 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { createHeaders } from './createHeaders'; | ||
import { AssistantUpdateParams as oaiAssistantUpdateParams } from 'openai/resources/beta/assistants'; | ||
@@ -50,2 +51,6 @@ export interface AssistantCreateParams { | ||
tools?: Array<any>; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_resources?: oaiAssistantUpdateParams.ToolResources | null; | ||
top_p?: number | null; | ||
[key: string]: any; | ||
@@ -52,0 +57,0 @@ } |
@@ -62,2 +62,9 @@ import { | ||
response_format?: object; | ||
audio?: any | null; | ||
modalities?: Array<any> | null; | ||
prediction?: any | null; | ||
reasoning_effort?: any; | ||
store?: boolean | null; | ||
metadata?: Record<string, string> | null; | ||
max_completion_tokens?: number | null; | ||
} | ||
@@ -93,2 +100,3 @@ | ||
tool_call_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -95,0 +103,0 @@ |
@@ -53,4 +53,9 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
export interface ChatCompletionStreamOptions { | ||
include_usage?: boolean; | ||
} | ||
export interface CompletionsBodyStreaming extends CompletionsBodyBase { | ||
stream?: true; | ||
stream_options?: ChatCompletionStreamOptions | null; | ||
} | ||
@@ -70,2 +75,3 @@ | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
@@ -75,8 +81,6 @@ | ||
text_offset?: Array<number>; | ||
token_logprobs?: Array<number>; | ||
tokens?: Array<string>; | ||
top_logprobs?: Array<Record<string, number>>; | ||
[key: string]: any; | ||
} | ||
@@ -89,2 +93,3 @@ | ||
finish_reason?: string; | ||
[key: string]: any; | ||
} | ||
@@ -100,2 +105,3 @@ | ||
system_fingerprint?: string; | ||
[key: string]: any; | ||
} |
@@ -16,4 +16,23 @@ import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; | ||
export type EmbeddingsResponse = Record<string, any> & APIResponseType; | ||
export interface EmbeddingArr { | ||
embedding?: Array<number>; | ||
index?: number; | ||
object?: string; | ||
[key: string]: any; | ||
} | ||
export interface Usage { | ||
prompt_tokens?: number; | ||
total_tokens?: number; | ||
[key: string]: any; | ||
} | ||
interface EmbeddingsResponse extends APIResponseType { | ||
data?: Array<EmbeddingArr>; | ||
model?: string; | ||
object?: string; | ||
usage?: Usage; | ||
[key: string]: any; | ||
} | ||
export class Embeddings extends ApiResource { | ||
@@ -20,0 +39,0 @@ create( |
@@ -131,4 +131,35 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
} | ||
async waitForProcessing( | ||
id: string, | ||
_body: PollOptions, | ||
params?: ApiClientInterface | ||
): Promise<FileObject> { | ||
const body: PollOptions = _body; | ||
if (params) { | ||
const config = overrideConfig(this.client.config, params.config); | ||
this.client.customHeaders = { | ||
...this.client.customHeaders, | ||
...createHeaders({ ...params, config }), | ||
}; | ||
} | ||
const OAIclient = initOpenAIClient(this.client); | ||
const result = await OAIclient.files.waitForProcessing(id, { | ||
...(body.pollInterval !== undefined && { | ||
pollInterval: body.pollInterval, | ||
}), | ||
...(body.maxWait !== undefined && { maxWait: body.maxWait }), | ||
}); | ||
return result; | ||
} | ||
} | ||
interface PollOptions { | ||
pollInterval?: number | undefined; | ||
maxWait?: number | undefined; | ||
} | ||
export interface FileCreateParams { | ||
@@ -149,2 +180,3 @@ file: any; | ||
status_details?: string; | ||
[key: string]: any; | ||
} | ||
@@ -154,3 +186,4 @@ | ||
purpose?: string; | ||
order?: 'asc' | 'desc'; | ||
[key: string]: any; | ||
} |
@@ -43,4 +43,4 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
created: number; | ||
data: Array<Image>; | ||
[key: string]: any; | ||
} | ||
@@ -52,2 +52,3 @@ | ||
url?: string; | ||
[key: string]: any; | ||
} | ||
@@ -54,0 +55,0 @@ |
@@ -6,2 +6,8 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
import { createHeaders } from './createHeaders'; | ||
import { | ||
ThreadCreateParams as oaiThreadCreateParams, | ||
ThreadUpdateParams as oaiThreadUpdateParams, | ||
ThreadCreateAndRunParams as oaiThreadCreateAndRunParams, | ||
AssistantToolChoiceOption, | ||
} from 'openai/resources/beta/threads/threads'; | ||
@@ -282,2 +288,25 @@ export class Threads extends ApiResource { | ||
} | ||
async del( | ||
threadId: string, | ||
messageId: string, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
if (params) { | ||
const config = overrideConfig(this.client.config, params.config); | ||
this.client.customHeaders = { | ||
...this.client.customHeaders, | ||
...createHeaders({ ...params, config }), | ||
}; | ||
} | ||
const OAIclient = initOpenAIClient(this.client); | ||
const result = await OAIclient.beta.threads.messages | ||
.del(threadId, messageId, opts) | ||
.withResponse(); | ||
return finalResponse(result); | ||
} | ||
} | ||
@@ -659,2 +688,3 @@ | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadCreateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -672,2 +702,3 @@ } | ||
metadata?: unknown | null; | ||
tool_resources?: oaiThreadUpdateParams.ToolResources | null; | ||
[key: string]: any; | ||
@@ -680,2 +711,3 @@ } | ||
file_ids?: Array<string>; | ||
attachments?: Array<any> | null; | ||
metadata?: unknown | null; | ||
@@ -687,2 +719,5 @@ [key: string]: any; | ||
order?: string; | ||
before?: string; | ||
run_id?: string; | ||
[key: string]: any; | ||
} | ||
@@ -714,2 +749,13 @@ | ||
stream?: boolean | null; | ||
include?: Array<any>; | ||
additional_messages?: Array<any> | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: any | null; | ||
top_p?: number | null; | ||
truncation_strategy?: any | null; | ||
[key: string]: any; | ||
} | ||
@@ -729,2 +775,12 @@ | ||
stream?: boolean | null; | ||
max_completion_tokens?: number | null; | ||
max_prompt_tokens?: number | null; | ||
parallel_tool_calls?: boolean; | ||
response_format?: any | null; | ||
temperature?: number | null; | ||
tool_choice?: AssistantToolChoiceOption | null; | ||
tool_resources?: oaiThreadCreateAndRunParams.ToolResources | null; | ||
top_p?: number | null; | ||
truncation_strategy?: oaiThreadCreateAndRunParams.TruncationStrategy | null; | ||
[key: string]: any; | ||
} | ||
@@ -742,2 +798,3 @@ | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -753,2 +810,4 @@ | ||
order?: string; | ||
include?: Array<any>; | ||
[key: string]: any; | ||
} | ||
@@ -773,2 +832,3 @@ | ||
stream?: true; | ||
assistant_id: string; | ||
}; | ||
@@ -775,0 +835,0 @@ |
@@ -63,7 +63,7 @@ import { ApiClientInterface } from '../_types/generalTypes'; | ||
uploadId: string, | ||
_body: any, | ||
_body: UploadCompleteParams, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const body: any = _body; | ||
const body: UploadCompleteParams = _body; | ||
if (params) { | ||
@@ -70,0 +70,0 @@ const config = overrideConfig(this.client.config, params.config); |
@@ -7,2 +7,3 @@ import { Uploadable } from 'openai/uploads'; | ||
import { createHeaders } from './createHeaders'; | ||
import { FileChunkingStrategyParam } from 'openai/resources/beta/vector-stores/vector-stores'; | ||
@@ -90,7 +91,7 @@ export class VectorStores extends ApiResource { | ||
async list( | ||
_query?: VectorStoreListParams, | ||
_query?: VectorStoreListParams | RequestOptions, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const query: VectorStoreListParams | undefined = _query; | ||
const query: VectorStoreListParams | RequestOptions | undefined = _query; | ||
if (params) { | ||
@@ -107,3 +108,3 @@ const config = overrideConfig(this.client.config, params.config); | ||
const result = await OAIclient.beta.vectorStores | ||
.list(query, opts) | ||
.list(query as any, opts) | ||
.withResponse(); | ||
@@ -434,7 +435,7 @@ return finalResponse(result); | ||
batchId: string, | ||
_query?: FileBatchListFilesParams, | ||
_query?: FileBatchListFilesParams | RequestOptions, | ||
params?: ApiClientInterface, | ||
opts?: RequestOptions | ||
): Promise<any> { | ||
const query: FileBatchListFilesParams | undefined = _query; | ||
const query: FileBatchListFilesParams | RequestOptions | undefined = _query; | ||
@@ -453,3 +454,3 @@ if (params) { | ||
const result = await OAIclient.beta.vectorStores.fileBatches | ||
.listFiles(vectorStoreId, batchId, query, opts) | ||
.listFiles(vectorStoreId, batchId, query as any, opts) | ||
.withResponse(); | ||
@@ -516,2 +517,3 @@ | ||
export interface VectorStoreCreateParams { | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
expires_after?: ExpiresAfter; | ||
@@ -544,2 +546,3 @@ file_ids?: Array<string>; | ||
file_id: string; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -557,2 +560,3 @@ } | ||
file_ids: Array<string>; | ||
chunking_strategy?: FileChunkingStrategyParam; | ||
[key: string]: any; | ||
@@ -559,0 +563,0 @@ } |
@@ -290,3 +290,3 @@ import KeepAliveAgent from 'agentkeepalive'; | ||
buildRequest(opts: FinalRequestOptions): { req: RequestInit; url: string } { | ||
const url = new URL(this.baseURL + opts.path!); | ||
const url = new URL(this.baseURL + opts.path); | ||
const { method, body } = opts; | ||
@@ -293,0 +293,0 @@ const reqHeaders: Record<string, string> = { |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '1.5.7'; | ||
export const VERSION = '1.6.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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7473114
16681
+ Addedopenai@4.77.0(transitive)
- Removedopenai@4.55.3(transitive)
Updatedopenai@4.77.0