diff --git a/package.json b/package.json index 2c1ab120..fa31d338 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@janhq/openai-node", + "name": "@janhq/cortex-node", "version": "4.47.1", "description": "Forked version of the OpenAI Node.js client library", "author": "Jan ", diff --git a/scripts/build b/scripts/build index aa7c61f0..0646d14e 100755 --- a/scripts/build +++ b/scripts/build @@ -47,8 +47,8 @@ node scripts/utils/postprocess-files.cjs # make sure that nothing crashes when we require the output CJS or # import the output ESM -(cd dist && node -e 'require("openai")') -(cd dist && node -e 'import("openai")' --input-type=module) +# (cd dist && node -e 'require("@janhq/cortex-node")') +# (cd dist && node -e 'import("@janhq/cortex-node")' --input-type=module) if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] then diff --git a/src/index.ts b/src/index.ts index 85453616..f65eefe3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -500,3 +500,4 @@ const API_KEY_SENTINEL = ''; // ---------------------- End Azure ---------------------- export default OpenAI; +export { OpenAI as Cortex }; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 63dd815e..27009437 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -10,6 +10,12 @@ import * as AssistantsAPI from '../assistants'; import * as MessagesAPI from './messages'; import * as RunsAPI from './runs/runs'; import { Stream } from '../../../streaming'; +import { Page } from 'openai/pagination'; + +/** + * Note: no pagination actually occurs yet, this is for forwards-compatibility. + */ +export class ThreadsPage extends Page {} export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); @@ -34,6 +40,13 @@ export class Threads extends APIResource { }); } + /** + * Lists threads + */ + list(options?: Core.RequestOptions): Core.PagePromise { + return this._client.getAPIList('/threads', ThreadsPage, options); + } + /** * Retrieves a thread. */ diff --git a/src/resources/models.ts b/src/resources/models.ts index 99dd56b9..f15422e3 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -30,12 +30,19 @@ export class Models extends APIResource { return this._client.delete(`/models/${model}`, options); } - /** - * Start a model instance, providing basic information about the model such as the + /** + * Start a model instance, providing basic information about the model */ - start(model: string, options?: Core.RequestOptions): Core.APIPromise { + start(model: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/models/${model}/start`, options); } + + /** + * Stop a model instance, providing basic information about the model + */ + stop(model: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/models/${model}/stop`, options); + } } /**