Skip to content

Commit 866b304

Browse files
authored
Merge pull request #280 from Portkey-AI/feat/oai6.8.1
Vendoring OAI 6.8.1
2 parents 78b4aee + f20485b commit 866b304

4 files changed

Lines changed: 32 additions & 26 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"dependencies": {
4646
"agentkeepalive": "^4.6.0",
4747
"dotenv": "^16.5.0",
48-
"openai": "6.3.0",
48+
"openai": "6.8.1",
4949
"ws": "^8.18.2"
5050
}
5151
}

src/apis/chatkit.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import { createHeaders } from './createHeaders';
33
import { finalResponse, initOpenAIClient, overrideConfig } from '../utils';
44
import { ApiClientInterface } from '../_types/generalTypes';
55
import { APIPromise, RequestOptions } from '../baseClient';
6-
import {
7-
ChatKitUploadFileParams,
8-
ChatKitUploadFileResponse,
9-
} from 'openai/resources/beta/chatkit/chatkit';
106
import { SessionCreateParams } from 'openai/resources/beta/chatkit/sessions';
117
import {
128
ChatKitThread,
@@ -24,23 +20,6 @@ export class ChatKit extends ApiResource {
2420
this.sessions = new ChatKitSessions(client);
2521
this.threads = new ChatKitThreads(client);
2622
}
27-
28-
uploadFile(
29-
body: ChatKitUploadFileParams,
30-
params?: ApiClientInterface,
31-
opts?: RequestOptions
32-
): APIPromise<ChatKitUploadFileResponse> {
33-
if (params) {
34-
const config = overrideConfig(this.client.config, params.config);
35-
this.client.customHeaders = {
36-
...this.client.customHeaders,
37-
...createHeaders({ ...params, config }),
38-
};
39-
}
40-
const OAIclient = initOpenAIClient(this.client);
41-
const result = OAIclient.beta.chatkit.uploadFile(body, opts);
42-
return result as any;
43-
}
4423
}
4524

4625
export class ChatKitSessions extends ApiResource {

src/apis/responses.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ import { CursorPageParams } from '../_types/sharedTypes';
1515
import { ResponseCreateParamsWithTools } from 'openai/lib/ResponsesParser';
1616
import { ResponseStreamParams } from 'openai/lib/responses/ResponseStream';
1717
import { Stream } from '../streaming';
18+
import { InputTokenCountParams } from 'openai/resources/responses/input-tokens';
1819

1920
export class Responses extends ApiResource {
2021
inputItems: InputItems;
22+
inputTokens: InputTokens;
2123

2224
constructor(client: any) {
2325
super(client);
2426
this.inputItems = new InputItems(client);
27+
this.inputTokens = new InputTokens(client);
2528
}
2629

2730
create(
@@ -195,6 +198,30 @@ export class InputItems extends ApiResource {
195198
}
196199
}
197200

201+
export class InputTokens extends ApiResource {
202+
async count(
203+
body: InputTokenCountParams,
204+
params?: ApiClientInterface,
205+
opts?: RequestOptions
206+
): Promise<any> {
207+
if (params) {
208+
const config = overrideConfig(this.client.config, params.config);
209+
this.client.customHeaders = {
210+
...this.client.customHeaders,
211+
...createHeaders({ ...params, config }),
212+
};
213+
}
214+
215+
const OAIclient = initOpenAIClient(this.client);
216+
217+
const result = await OAIclient.responses.inputTokens
218+
.count(body, opts)
219+
.withResponse();
220+
221+
return finalResponse(result);
222+
}
223+
}
224+
198225
export interface ResponseRetrieveParams {
199226
include?: Array<ResponseIncludable>;
200227
}

0 commit comments

Comments
 (0)