diff --git a/package-lock.json b/package-lock.json index 5b083c6..24604d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "agentkeepalive": "^4.6.0", "dotenv": "^16.5.0", - "openai": "6.3.0", + "openai": "6.8.1", "ws": "^8.18.2" }, "devDependencies": { @@ -5287,9 +5287,9 @@ } }, "node_modules/openai": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/openai/-/openai-6.3.0.tgz", - "integrity": "sha512-E6vOGtZvdcb4yXQ5jXvDlUG599OhIkb/GjBLZXS+qk0HF+PJReIldEc9hM8Ft81vn+N6dRdFRb7BZNK8bbvXrw==", + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/openai/-/openai-6.8.1.tgz", + "integrity": "sha512-ACifslrVgf+maMz9vqwMP4+v9qvx5Yzssydizks8n+YUJ6YwUoxj51sKRQ8HYMfR6wgKLSIlaI108ZwCk+8yig==", "license": "Apache-2.0", "bin": { "openai": "bin/cli" diff --git a/package.json b/package.json index 47e0d39..d22a93a 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/apis/chatkit.ts b/src/apis/chatkit.ts index e36a7ae..589ff07 100644 --- a/src/apis/chatkit.ts +++ b/src/apis/chatkit.ts @@ -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, @@ -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 { - 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 { diff --git a/src/apis/responses.ts b/src/apis/responses.ts index d83a2bb..3980fb6 100644 --- a/src/apis/responses.ts +++ b/src/apis/responses.ts @@ -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( @@ -195,6 +198,30 @@ export class InputItems extends ApiResource { } } +export class InputTokens extends ApiResource { + async count( + body: InputTokenCountParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): Promise { + 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; }