Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 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
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"agentkeepalive": "^4.6.0",
"dotenv": "^16.5.0",
"openai": "6.3.0",
"openai": "6.8.1",
"ws": "^8.18.2"
}
}
21 changes: 0 additions & 21 deletions src/apis/chatkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { createHeaders } from './createHeaders';
import { finalResponse, initOpenAIClient, overrideConfig } from '../utils';
import { ApiClientInterface } from '../_types/generalTypes';
import { APIPromise, RequestOptions } from '../baseClient';
import {
ChatKitUploadFileParams,
ChatKitUploadFileResponse,
} from 'openai/resources/beta/chatkit/chatkit';
import { SessionCreateParams } from 'openai/resources/beta/chatkit/sessions';
import {
ChatKitThread,
Expand All @@ -24,23 +20,6 @@ export class ChatKit extends ApiResource {
this.sessions = new ChatKitSessions(client);
this.threads = new ChatKitThreads(client);
}

uploadFile(
body: ChatKitUploadFileParams,
params?: ApiClientInterface,
opts?: RequestOptions
): APIPromise<ChatKitUploadFileResponse> {
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 = OAIclient.beta.chatkit.uploadFile(body, opts);
return result as any;
}
}

export class ChatKitSessions extends ApiResource {
Expand Down
27 changes: 27 additions & 0 deletions src/apis/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ import { CursorPageParams } from '../_types/sharedTypes';
import { ResponseCreateParamsWithTools } from 'openai/lib/ResponsesParser';
import { ResponseStreamParams } from 'openai/lib/responses/ResponseStream';
import { Stream } from '../streaming';
import { InputTokenCountParams } from 'openai/resources/responses/input-tokens';

export class Responses extends ApiResource {
inputItems: InputItems;
inputTokens: InputTokens;

constructor(client: any) {
super(client);
this.inputItems = new InputItems(client);
this.inputTokens = new InputTokens(client);
}

create(
Expand Down Expand Up @@ -195,6 +198,30 @@ export class InputItems extends ApiResource {
}
}

export class InputTokens extends ApiResource {
async count(
body: InputTokenCountParams,
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.responses.inputTokens
.count(body, opts)
.withResponse();

return finalResponse(result);
}
}

export interface ResponseRetrieveParams {
include?: Array<ResponseIncludable>;
}
Expand Down