From d8de588abe627c76cd0aedaca04d4877b87e1c37 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:00:29 +0800 Subject: [PATCH 01/15] Add small notes to Models spec --- docs/docs/specs/models.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index f5fd26e3f..31a79aede 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -33,6 +33,15 @@ Models in Jan are stored in the `/models` folder. - The `folder` and `file` do not have to share the same name - The model `id` is made up of `folder_name/filename` and is thus always unique. +Folders are human readable names + +### Auto-detection + +You can import a model by just dragging it into the `/models` folder +- Jan will detect and generate a corresponding `.json` file based on filename +- Jan will move it into its own folder once you choose a human readable name for it +- Jan will fill out the model.json file as you add metadata through the UI + ```sh /janroot /models From 89dbae2651acdd023c9dea7dee80b7d5487eaa47 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:01:48 +0800 Subject: [PATCH 02/15] Reduce line heights for list items --- docs/src/styles/tweaks.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/styles/tweaks.scss b/docs/src/styles/tweaks.scss index e4d44f6b9..8c5c7a8e9 100644 --- a/docs/src/styles/tweaks.scss +++ b/docs/src/styles/tweaks.scss @@ -95,6 +95,7 @@ padding-left: 32px; li { @apply leading-loose; + line-height: 1.5; } } } From a900ad7bcc6df092144e68bef3e715c1b7448021 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:56:05 +0800 Subject: [PATCH 03/15] Migrate Model definitions to Swagger --- docs/docs/specs/models.md | 6 +- docs/openapi/jan.yaml | 123 ++++++++++++++++++++++++++++++++++---- 2 files changed, 115 insertions(+), 14 deletions(-) diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index 31a79aede..3d2c39b89 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -2,6 +2,8 @@ title: Models --- +import ApiSchema from '@theme/ApiSchema'; + :::warning Draft Specification: functionality has not been implemented yet. @@ -14,7 +16,7 @@ Feedback: [HackMD: Models Spec](https://hackmd.io/ulO3uB1AQCqLa5SAAMFOQw) Jan's Model API aims to be as similar as possible to [OpenAI's Models API](https://platform.openai.com/docs/api-reference/models), with additional methods for managing and running models locally. -### User Objectives +### Objectives - Users can start/stop models and use them in a thread (or via Chat Completions API) - Users can download, import and delete models @@ -63,6 +65,8 @@ Jan's `model.json` aims for rough equivalence with [OpenAI's Model Object](https Jan's `model.json` object properties are optional, i.e. users should be able to run a model declared by an empty `json` file. +; + ```json // ./models/zephr/zephyr-7b-beta-Q4_K_M.json { diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 4a56e4df9..34660b5a6 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -7314,29 +7314,126 @@ components: - model - input - voice - Model: title: Model - description: Describes an OpenAI model offering that can be used with the API. + description: Describes an Jan model properties: - id: + type: + type: string + enum: [model, assistant, thread, message] # This should be specified + default: model + version: + type: integer + description: The version of the Model Object file + default: 1 + source_url: + type: string + format: uri + default: https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf + description: The model download source. It can be an external url or a local filepath. + id: # OpenAI-equivalent type: string description: The model identifier, which can be referenced in the API endpoints. + default: zephyr-7b + description: + type: string + default: A cool model from Huggingface + owned_by: # OpenAI-equivalent + type: string + description: The organization that owns the model (you!) + default: you # TODO created: type: integer - description: The Unix timestamp (in seconds) when the model was created. - object: + description: The Unix timestamp (in seconds) for when the model was created + state: type: string - description: The object type, which is always "model". - enum: [model] - owned_by: - type: string - description: The organization that owns the model. + enum: [to_download, downloading, ready, running] + default: to_download + parameters: + type: object + description: + properties: + init: + type: object + properties: + ctx_len: + type: string + description: TODO + default: 2048 + ngl: + type: string + description: TODO + default: 100 + embedding: + type: bool + description: TODO + default: true + n_parallel: + type: string + description: TODO + default: 4 + pre_prompt: + type: string + description: TODO + default: A chat between a curious user and an artificial intelligence + user_prompt: + type: string + description: TODO + default: "USER:" + ai_prompt: + type: string + description: TODO + default: "ASSISTANT:" + runtime: + type: object + properties: + temperature: + type: string + description: TODO + default: 0.7 + token_limit: + type: string + description: TODO + default: 2048 + top_k: + type: string + description: TODO + default: 0 + top_p: + type: string + description: TODO + default: 1 + stream: + type: string + description: TODO + default: true + default: {} + metadata: + type: object + properties: + engine: + type: string + enum: [llamacpp, api,tensorrt] + default: llamacpp + quantization: + type: string + description: TODO + binaries: + type: array + description: TODO + default: {} required: - - id - object - - created - - owned_by + - source_url + - parameters + - description + - metadata + - state + - name + - id # From OpenAI + - object # From OpenAI + - created # From OpenAI + - owned_by # From OpenAI x-oaiMeta: name: The model object example: *retrieve_model_response From 666a6143cb2ede6dea79577bf78d8f375c60f7a3 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 13:06:12 +0800 Subject: [PATCH 04/15] Add fields to Model swagger --- docs/docs/specs/models.md | 45 +-------------------------------------- docs/openapi/jan.yaml | 29 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 46 deletions(-) diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index 3d2c39b89..b7dcd758f 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -65,50 +65,7 @@ Jan's `model.json` aims for rough equivalence with [OpenAI's Model Object](https Jan's `model.json` object properties are optional, i.e. users should be able to run a model declared by an empty `json` file. -; - -```json -// ./models/zephr/zephyr-7b-beta-Q4_K_M.json -{ - "source_url": "https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf", - "parameters": { - "init": { - "ctx_len": "2048", - "ngl": "100", - "embedding": "true", - "n_parallel": "4", - "pre_prompt": "A chat between a curious user and an artificial intelligence", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: " - }, - "runtime": { - "temperature": "0.7", - "token_limit": "2048", - "top_k": "0", - "top_p": "1", - "stream": "true" - } - }, - "metadata": { - "engine": "llamacpp", - "quantization": "Q4_K_M", - "size": "7B", - } -} -``` - -| Property | Type | Description | Validation | -| ----------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------ | -| `object` | enum: `model`, `assistant`, `thread`, `message` | Type of the Jan Object. Always `model` | Defaults to "model" | -| `source_url` | string | The model download source. It can be an external url or a local filepath. | Defaults to `pwd`. See [Source_url](#Source_url) | -| `parameters` | map | Defines default model run parameters used by any assistant. | Defaults to `{}` | -| `description` | string | A vanity description of the model | Defaults to "" | -| `metadata` | map | Stores additional structured information about the model. | Defaults to `{}` | -| `metadata.engine` | enum: `llamacpp`, `api`, `tensorrt` | The model backend used to run model. | Defaults to "llamacpp" | -| `metadata.quantization` | string | Supported formats only | See [Custom importers](#Custom-importers) | -| `metadata.binaries` | array | Supported formats only. | See [Custom importers](#Custom-importers) | -| `state` | enum[`to_download` , `downloading`, `ready` , `running`] | Needs more thought | Defaults to `to_download` | -| `name` | string | A vanity name | Defaults to filename | + ### Model Source diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 34660b5a6..8cdbbc48a 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -7384,6 +7384,15 @@ components: type: string description: TODO default: "ASSISTANT:" + default: { + ctx_len: 2048, + ngl: 100, + embedding: true, + n_parallel: 4, + pre_prompt: "A chat between a curious user and an artificial intelligence", + user_prompt: "USER:", + ai_prompt: "ASSISTANT:" + } runtime: type: object properties: @@ -7407,7 +7416,13 @@ components: type: string description: TODO default: true - default: {} + default: { + temperature: 0.7, + token_limit: 2048, + top_k: 0, + top_p: 1, + stream: true + } metadata: type: object properties: @@ -7418,10 +7433,20 @@ components: quantization: type: string description: TODO + default: Q4_K_M + size: + type: string + default: 7b binaries: type: array description: TODO - default: {} + default: TODO + default: { + engine: llamacpp, + quantization: Q4_K_M, + size: 7b, + binaries: TODO + } required: - object - source_url From ef273a7e04d89c6f345fc69c4008dabe85db6064 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 19:11:41 +0800 Subject: [PATCH 05/15] Rename Model fields --- docs/openapi/jan.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 8cdbbc48a..6b972d64f 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -2314,7 +2314,8 @@ paths: operationId: listModels tags: - Models - summary: Lists the currently available models, and provides basic information about each one such as the owner and availability. + summary: List Models + description: Lists the currently available models, and provides basic information about each one such as the owner and availability. responses: "200": description: OK @@ -2378,7 +2379,8 @@ paths: operationId: retrieveModel tags: - Models - summary: Retrieves a model instance, providing basic information about the model such as the owner and permissioning. + summary: Retrieve Model + description: Retrieves a model instance, providing basic information about the model such as the owner and permissioning. parameters: - in: path name: model @@ -2431,7 +2433,8 @@ paths: operationId: deleteModel tags: - Models - summary: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. + summary: Delete Model + description: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. parameters: - in: path name: model From 126c2e0132acf7dba8f6edbb5c98cee550cff854 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:11:20 +0800 Subject: [PATCH 06/15] Changes to Jan Model Spec and fix issues in Swagger --- docs/docs/specs/models.md | 75 +++++++++++++++++++++++---------------- docs/openapi/jan.yaml | 29 +++++++-------- 2 files changed, 58 insertions(+), 46 deletions(-) diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index b7dcd758f..eb1ea2d27 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -18,52 +18,67 @@ Jan's Model API aims to be as similar as possible to [OpenAI's Models API](https ### Objectives -- Users can start/stop models and use them in a thread (or via Chat Completions API) - Users can download, import and delete models -- User can configure model settings at the model level or override it at thread-level - Users can use remote models (e.g. OpenAI, OpenRouter) +- Users can start/stop models and use them in a thread (or via Chat Completions API) +- User can configure default model parameters at the model level (to be overridden later at message or thread level) ## Models Folder -Models in Jan are stored in the `/models` folder. +Models in Jan are stored in the `/models` folder. - `.json` files. +Models are stored and organized by folders, which are atomic representations of a model for easy packaging and version control. -- Everything needed to represent a `model` is packaged into an `Model folder`. -- The `folder` is standalone and can be easily zipped, imported, and exported, e.g. to Github. -- The `folder` always contains at least one `Model Object`, declared in a `json` format. -- The `folder` and `file` do not have to share the same name -- The model `id` is made up of `folder_name/filename` and is thus always unique. +A model's folder name is its `model.id` and contains: -Folders are human readable names +- `.json`, i.e. the [Model Object](#model-object) +- Binaries (may be downloaded later) -### Auto-detection - -You can import a model by just dragging it into the `/models` folder -- Jan will detect and generate a corresponding `.json` file based on filename -- Jan will move it into its own folder once you choose a human readable name for it -- Jan will fill out the model.json file as you add metadata through the UI - -```sh -/janroot +```shell +/jan # Jan root folder /models - azure-openai/ # Folder name - azure-openai-gpt3-5.json # File name + # GGUF model + /llama2-70b + llama2-70b.json + llama2-70b-q4_k_m.gguf - llama2-70b/ - model.json - .gguf + # Recommended Model (yet to be downloaded) + /mistral-7b + mistral-7b.json # Contains download instructions + # Note: mistral-7b-*.gguf binaries not downloaded yet + + # Remote model + /azure-openai-gpt3-5 + azure-openai-gpt3-5.json + # Note: No binaries + + # Multiple Binaries + # COMING SOON + + # Multiple Quantizations + # COMING SOON + + # Imported model (autogenerated .json) + random-model-q4_k_m.bin + # Note: will be moved into a autogenerated folder + # /random-model-q4_k_m + # random-model-q4_k_m.bin + # random-model-q4_k_m.json (autogenerated) ``` +### Importing Models + +You can import a model by just dragging it into the `/models` folder, similar to Oobabooga. + +- Jan will detect and generate a corresponding `model-filename.json` file based on filename +- Jan will move it into its own `/model-id` folder once you define a `model-id` via the UI +- Jan will populate the model's `model-id.json` as you add metadata through the UI + ## Model Object -Models in Jan are represented as `json` objects, and are colloquially known as `model.jsons`. +Jan represents models as `json`-based Model Object files, known colloquially as `model.jsons`. Jan aims for rough equivalence with [OpenAI's Model Object](https://platform.openai.com/docs/api-reference/models/object) with additional properties to support local models. -Jan's models follow a `.json` naming convention. - -Jan's `model.json` aims for rough equivalence with [OpenAI's Model Object](https://platform.openai.com/docs/api-reference/models/object), and add additional properties to support local models. - -Jan's `model.json` object properties are optional, i.e. users should be able to run a model declared by an empty `json` file. +Jan's models follow a `model_id.json` naming convention, and are built to be extremely lightweight, with the only mandatory field being a `source_url` to download the model binaries. diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 6b972d64f..3dd485e38 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -7321,9 +7321,8 @@ components: title: Model description: Describes an Jan model properties: - type: + object: type: string - enum: [model, assistant, thread, message] # This should be specified default: model version: type: integer @@ -7332,15 +7331,15 @@ components: source_url: type: string format: uri - default: https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf + example: https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf description: The model download source. It can be an external url or a local filepath. id: # OpenAI-equivalent type: string description: The model identifier, which can be referenced in the API endpoints. - default: zephyr-7b - description: + example: zephyr-7b + name: type: string - default: A cool model from Huggingface + description: Human-readable name that is used for UI owned_by: # OpenAI-equivalent type: string description: The organization that owns the model (you!) @@ -7348,6 +7347,9 @@ components: created: type: integer description: The Unix timestamp (in seconds) for when the model was created + description: + type: string + default: A cool model from Huggingface state: type: string enum: [to_download, downloading, ready, running] @@ -7451,17 +7453,12 @@ components: binaries: TODO } required: - - object - - source_url - - parameters - - description - - metadata - - state - - name - id # From OpenAI - - object # From OpenAI - - created # From OpenAI - - owned_by # From OpenAI + - version + - source_url + - created # From OpenAI, autogenerated in Jan + - object # From OpenAI, autogenerated in Jan + - owned_by # From OpenAI, autogenerated in Jan x-oaiMeta: name: The model object example: *retrieve_model_response From ad5b968caca1633e568da41d1b6cf5b5e292d369 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:38:45 +0800 Subject: [PATCH 07/15] Changes to Jan's About and Intro pages --- docs/docs/about/about.md | 6 +++--- docs/docs/intro/introduction.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs/about/about.md b/docs/docs/about/about.md index 3ed5750c4..4a82d93d6 100644 --- a/docs/docs/about/about.md +++ b/docs/docs/about/about.md @@ -2,9 +2,7 @@ title: About Jan --- -Jan is a free, open source alternative to OpenAI's platform that runs on a local folder of open-format files. - -We believe in the need for an open source AI ecosystem, and are building the infra and tooling to allow open source AIs to be as usable and comprehensive as proprietary ones. +Jan believes in the need for an open source AI ecosystem, and are building the infra and tooling to allow open source AIs to compete on a level playing field with proprietary ones. Jan's long-term vision is to build a cognitive framework for future robots, who are practical, useful assistants for humans and businesses in everyday life. @@ -89,3 +87,5 @@ Drop us a message in our [Discord](https://discord.gg/af6SaTdzpx) and we'll get ### Careers Jan has a culture of ownership, independent thought, and lightning fast execution. If you'd like to join us, we have open positions on our [careers page](https://janai.bamboohr.com/careers). + +## Footnotes \ No newline at end of file diff --git a/docs/docs/intro/introduction.md b/docs/docs/intro/introduction.md index 6c320af4d..d06d28a03 100644 --- a/docs/docs/intro/introduction.md +++ b/docs/docs/intro/introduction.md @@ -5,9 +5,9 @@ slug: /intro Jan is a ChatGPT-alternative that runs on your own computer. -Jan uses [open-source AI models](/guide/models), stores data in [open file formats](/specs/data-structures) and is is highly customizable via [extensions](/guide/extensions). +Jan uses [open-source AI models](/guide/models), stores data in [open file formats](/specs/data-structures) is highly customizable via [extensions](/guide/extensions), and provides an [OpenAI-compatible API](/api). -Jan ships with an [OpenAI-compatible API](/api) and a powerful [Assistant framework](/guide/assistants) to create custom AIs. +Jan believes in the need for an open source AI ecosystem. We aim build fully-equivalent infra and tooling to allow open source AIs to compete on a level playing field with proprietary offerings. ## Why Jan? From 9553c70d07a6a94af34b1f03494e4876c3c7fda6 Mon Sep 17 00:00:00 2001 From: 0xSage Date: Sun, 19 Nov 2023 21:39:24 +0800 Subject: [PATCH 08/15] docs: add model methods like start stop --- docs/openapi/jan.yaml | 277 +++++++++++++++++++++++++++++++++++------- 1 file changed, 232 insertions(+), 45 deletions(-) diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 3dd485e38..ce74ab1d2 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -2309,6 +2309,7 @@ paths: ] } + # Models /models: get: operationId: listModels @@ -2374,6 +2375,61 @@ paths: ], "object": "list" } + post: + operationId: importModel + tags: + - Models + summary: Import Model + description: Imports a model instance. The model can be from a local folder, remote source, or an API endpoint. The model importer will examine the source_url for formatting. + parameters: + - in: path + name: source_url + required: true + schema: + type: string + # ideally this will be an actual ID, so this will always work from browser + example: https://huggingface.com/thebloke/example.gguf + description: The ID of the model to use for this request + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Model" + x-oaiMeta: + name: Import model + returns: The [model](/docs/api-reference/models/object) object matching the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.models.retrieve("VAR_model_id") + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("gpt-3.5-turbo"); + + console.log(model); + } + + main(); + response: &retrieve_model_response | + { + "id": "VAR_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai", + "state": "ready" + } /models/{model}: get: operationId: retrieveModel @@ -2481,6 +2537,138 @@ paths: "object": "model", "deleted": true } + post: + operationId: startModel + tags: + - Models + summary: Start Model + description: Starts an imported model. Loads the model into V/RAM. + parameters: + - in: path + name: model + required: true + schema: + type: string + # ideally this will be an actual ID, so this will always work from browser + example: gpt-3.5-turbo + description: The ID of the model to use for this request + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Model" + x-oaiMeta: + name: Import model + returns: The [model](/docs/api-reference/models/object) object matching the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.models.retrieve("VAR_model_id") + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("gpt-3.5-turbo"); + + console.log(model); + } + + main(); + response: &retrieve_model_response | + { + "id": "VAR_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + /models/{model}/cancel: + post: + operationId: cancelModel + tags: + - Models + summary: Cancel Model + description: Stops a running model. Unloads the model from V/RAM. + parameters: + - in: path + name: model + required: true + schema: + type: string + description: The ID of the model that is running. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Cancel a running model + beta: true + returns: The modified [run](/docs/api-reference/runs/object) object matching the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_1cjnJPXj8MFiqTx58jU9TivC/runs/run_BeRGmpGt2wb1VI22ZRniOkrR/cancel \ + -H 'Authorization: Bearer $OPENAI_API_KEY' \ + -H 'OpenAI-Beta: assistants=v1' \ + -X POST + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.cancel( + thread_id="thread_1cjnJPXj8MFiqTx58jU9TivC", + run_id="run_BeRGmpGt2wb1VI22ZRniOkrR" + ) + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "thread_1cjnJPXj8MFiqTx58jU9TivC", + "run_BeRGmpGt2wb1VI22ZRniOkrR" + ); + + console.log(run); + } + + main(); + response: | + { + "id": "run_BeRGmpGt2wb1VI22ZRniOkrR", + "object": "model", + "created_at": 1699076126, + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You summarize books.", + "tools": [ + { + "type": "retrieval" + } + ], + "file_ids": [], + "metadata": {} + } /moderations: post: @@ -3062,6 +3250,7 @@ paths: "deleted": true } + # Threads /threads: post: operationId: createThread @@ -7324,7 +7513,7 @@ components: object: type: string default: model - version: + version: type: integer description: The version of the Model Object file default: 1 @@ -7333,14 +7522,14 @@ components: format: uri example: https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf description: The model download source. It can be an external url or a local filepath. - id: # OpenAI-equivalent + id: # OpenAI-equivalent type: string description: The model identifier, which can be referenced in the API endpoints. example: zephyr-7b name: type: string description: Human-readable name that is used for UI - owned_by: # OpenAI-equivalent + owned_by: # OpenAI-equivalent type: string description: The organization that owns the model (you!) default: you # TODO @@ -7356,16 +7545,16 @@ components: default: to_download parameters: type: object - description: + description: properties: init: type: object properties: - ctx_len: + ctx_len: type: string description: TODO default: 2048 - ngl: + ngl: type: string description: TODO default: 100 @@ -7373,92 +7562,90 @@ components: type: bool description: TODO default: true - n_parallel: + n_parallel: type: string description: TODO default: 4 - pre_prompt: + pre_prompt: type: string description: TODO default: A chat between a curious user and an artificial intelligence - user_prompt: + user_prompt: type: string description: TODO default: "USER:" - ai_prompt: + ai_prompt: type: string description: TODO default: "ASSISTANT:" - default: { - ctx_len: 2048, - ngl: 100, - embedding: true, - n_parallel: 4, - pre_prompt: "A chat between a curious user and an artificial intelligence", - user_prompt: "USER:", - ai_prompt: "ASSISTANT:" - } + default: + { + ctx_len: 2048, + ngl: 100, + embedding: true, + n_parallel: 4, + pre_prompt: "A chat between a curious user and an artificial intelligence", + user_prompt: "USER:", + ai_prompt: "ASSISTANT:", + } runtime: type: object properties: - temperature: - type: string + temperature: + type: string description: TODO default: 0.7 - token_limit: + token_limit: type: string description: TODO default: 2048 - top_k: + top_k: type: string description: TODO default: 0 - top_p: + top_p: type: string description: TODO default: 1 - stream: + stream: type: string description: TODO default: true - default: { - temperature: 0.7, - token_limit: 2048, - top_k: 0, - top_p: 1, - stream: true - } + default: + { + temperature: 0.7, + token_limit: 2048, + top_k: 0, + top_p: 1, + stream: true, + } metadata: type: object properties: engine: type: string - enum: [llamacpp, api,tensorrt] + enum: [llamacpp, api, tensorrt] default: llamacpp quantization: type: string description: TODO default: Q4_K_M - size: + size: type: string default: 7b binaries: type: array description: TODO default: TODO - default: { - engine: llamacpp, - quantization: Q4_K_M, - size: 7b, - binaries: TODO - } + default: + { engine: llamacpp, quantization: Q4_K_M, size: 7b, binaries: TODO } required: - - id # From OpenAI + - id # From OpenAI - version - source_url - - created # From OpenAI, autogenerated in Jan - - object # From OpenAI, autogenerated in Jan - - owned_by # From OpenAI, autogenerated in Jan + - created # From OpenAI, autogenerated in Jan + - object # From OpenAI, autogenerated in Jan + - owned_by # From OpenAI, autogenerated in Jan x-oaiMeta: name: The model object example: *retrieve_model_response @@ -9616,4 +9803,4 @@ x-oaiMeta: path: object - type: endpoint key: createEdit - path: create \ No newline at end of file + path: create From 3132e85585f9ab447701f4ec117609a19084fd43 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:04:13 +0800 Subject: [PATCH 09/15] Remove API section --- docs/docs/intro/introduction.md | 6 +- docs/docs/specs/models.md | 369 ++++++++++++-------------------- 2 files changed, 141 insertions(+), 234 deletions(-) diff --git a/docs/docs/intro/introduction.md b/docs/docs/intro/introduction.md index d06d28a03..6511a3a1b 100644 --- a/docs/docs/intro/introduction.md +++ b/docs/docs/intro/introduction.md @@ -3,11 +3,11 @@ title: Introduction slug: /intro --- -Jan is a ChatGPT-alternative that runs on your own computer. +Jan is a ChatGPT-alternative that runs on your own computer, with a [local API server](/api). -Jan uses [open-source AI models](/guide/models), stores data in [open file formats](/specs/data-structures) is highly customizable via [extensions](/guide/extensions), and provides an [OpenAI-compatible API](/api). +Jan uses [open-source AI models](/guide/models), stores data in [open file formats](/specs/data-structures), is highly customizable via [extensions](/guide/extensions). -Jan believes in the need for an open source AI ecosystem. We aim build fully-equivalent infra and tooling to allow open source AIs to compete on a level playing field with proprietary offerings. +Jan believes in the need for an open source AI ecosystem. We aim to build infra and tooling to allow open source AIs to compete on a level playing field with proprietary offerings. ## Why Jan? diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index eb1ea2d27..9dd096701 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -68,6 +68,14 @@ A model's folder name is its `model.id` and contains: ### Importing Models +:::warning + +- This has not been confirmed +- Dan's view: Jan should auto-detect and create folders automatically +- Jan's UI will allow users to rename folders and add metadata + +::: + You can import a model by just dragging it into the `/models` folder, similar to Oobabooga. - Jan will detect and generate a corresponding `model-filename.json` file based on filename @@ -76,41 +84,77 @@ You can import a model by just dragging it into the `/models` folder, similar to ## Model Object +:::warning + +- This is currently not finalized +- Dan's view: I think the current JSON is extremely clunky + - We should move `init` to top-level (e.g. "settings"?) + - We should move `runtime` to top-level (e.g. "parameters"?) + - `metadata` is extremely overloaded and should be refactored +- Dan's view: we should make a model object very extensible + - A `GGUF` model would "extend" a common model object with extra fields (at top level) +- Dan's view: State is extremely badly named + - Recommended: `downloaded`, `started`, `stopped`, null (for yet-to-download) + - We should also note that this is only for local models (not remote) + +::: + Jan represents models as `json`-based Model Object files, known colloquially as `model.jsons`. Jan aims for rough equivalence with [OpenAI's Model Object](https://platform.openai.com/docs/api-reference/models/object) with additional properties to support local models. Jan's models follow a `model_id.json` naming convention, and are built to be extremely lightweight, with the only mandatory field being a `source_url` to download the model binaries. -### Model Source +### Types of Models -There are 3 types of model sources +:::warning + +- This is currently not in the Model Object, and requires further discussion. +- Dan's view: we should have a field to differentiate between `local` and `remote` models + +::: + +There are 3 types of models. - Local model -- Remote source -- Cloud API +- Local model, yet-to-be downloaded (we have the URL) +- Remote model (i.e. OpenAI API) -- Users can download models from a `remote` source or reference an existing `local` model. -- If this property is not specified in the Model Object file, then the default behavior is to look in the current directory. -- Users can import a local model by providing the filepath to the model +#### Local Models + +:::warning + +- This is currently not finalized +- Dan's view: we should have `download_url` and `local_url` for local models (and possibly more) + +::: + +A `model.json` for a local model should always reference the following fields: + +- `download_url`: the original download source of the model +- `local_url`: the current location of the model binaries (may be array of multiple binaries) ```json // ./models/llama2/llama2-7bn-gguf.json -"source_url": "~/Downloads/llama-2-7bn-q5-k-l.gguf", - -// Default, if property is omitted -"source_url": "./", +"local_url": "~/Downloads/llama-2-7bn-q5-k-l.gguf", ``` -- Users can download a model by remote URL. -- Supported url formats: - - `https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/blob/main/llama-2-7b-chat.Q3_K_L.gguf` - - `https://any-source.com/.../model-binary.bin` +#### Remote Models -- Using a remote API to access model `model-azure-openai-gpt4-turbo.json` -- See [source](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api) +:::warning + +- This is currently not finalized +- Dan's view: each cloud model should be provided via a syste module, or define its own params field on the `model` or `model.init` object + +::: + +A `model.json` for a remote model should always reference the following fields: + +- `api_url`: the API endpoint of the model +- Any authentication parameters ```json +// Dan's view: This needs to be refactored pretty significantly "source_url": "https://docs-test-001.openai.azure.com/openai.azure.com/docs-test-001/gpt4-turbo", "parameters": { "init" { @@ -127,24 +171,74 @@ There are 3 types of model sources } } "metadata": { - "engine": "api", + "engine": "api", // Dan's view: this should be a `type` field } ``` -### Model Formats +### Importers -Additionally, Jan supports importing popular formats. For example, if you provide a HuggingFace URL for a `TheBloke` model, Jan automatically downloads and catalogs all quantizations. Custom importers autofills properties like `metadata.quantization` and `metadata.size`. +:::caution -Supported URL formats with custom importers: +- This is only an idea, has not been confirmed as part of spec -- `huggingface/thebloke`: [Link](https://huggingface.co/TheBloke/Llama-2-7B-GGUF) -- `huggingface/thebloke`: [Link](https://huggingface.co/TheBloke/Llama-2-7B-GGUF) -- `janhq`: `TODO: put URL here` -- `azure_openai`: `https://docs-test-001.openai.azure.com/openai.azure.com/docs-test-001/gpt4-turbo` -- `openai`: `api.openai.com` +::: -
- Example: Zephyr 7B +Jan builds "importers" for users to seamlessly import models from a single URL. + +We currently only provide this for [TheBloke models on Huggingface](https://huggingface.co/TheBloke) (i.e. one of the patron saints of llama.cpp), but we plan to add more in the future. + +Currently, pasting a TheBloke Huggingface link in the Explore Models page will fire an importer, resulting in an: + +- Nicely-formatted model card +- Fully-annotated `model.json` file + +### Multiple Binaries + +:::warning + +- This is currently not finalized +- Dan's view: having these fields under `model.metadata` is not maintainable +- We should explore some sort of `local_url` structure + +::: + +- Model has multiple binaries `model-llava-1.5-ggml.json` +- See [source](https://huggingface.co/mys/ggml_llava-v1.5-13b) + +```json +"source_url": "https://huggingface.co/mys/ggml_llava-v1.5-13b", +"parameters": {"init": {}, "runtime": {}} +"metadata": { + "mmproj_binary": "https://huggingface.co/mys/ggml_llava-v1.5-13b/blob/main/mmproj-model-f16.gguf", + "ggml_binary": "https://huggingface.co/mys/ggml_llava-v1.5-13b/blob/main/ggml-model-q5_k.gguf", + "engine": "llamacpp", + "quantization": "Q5_K" +} +``` + +## Models API + +:::warning + +- We should use the OpenAPI spec to discuss APIs +- Dan's view: This needs @louis and App Pod to review as they are more familiar with this + +::: + +See http://localhost:3001/api-reference#tag/Models. + +| Method | API Call | OpenAI-equivalent | +| -------------- | ------------------------------- | ----------------- | +| List Models | GET /v1/models | true | +| Get Model | GET /v1/models/{model_id} | true | +| Delete Model | DELETE /v1/models/{model_id} | true | +| Start Model | PUT /v1/models/{model_id}/start | | +| Stop Model | PUT /v1/models/{model_id}/start | | +| Download Model | POST /v1/models/ | | + +## Examples + +### Local Model - Model has 1 binary `model-zephyr-7B.json` - See [source](https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/) @@ -177,208 +271,8 @@ Supported URL formats with custom importers: "size": "7B", } ``` -
-### Multiple binaries - -- Model has multiple binaries `model-llava-1.5-ggml.json` -- See [source](https://huggingface.co/mys/ggml_llava-v1.5-13b) - -```json -"source_url": "https://huggingface.co/mys/ggml_llava-v1.5-13b", -"parameters": {"init": {}, "runtime": {}} -"metadata": { - "mmproj_binary": "https://huggingface.co/mys/ggml_llava-v1.5-13b/blob/main/mmproj-model-f16.gguf", - "ggml_binary": "https://huggingface.co/mys/ggml_llava-v1.5-13b/blob/main/ggml-model-q5_k.gguf", - "engine": "llamacpp", - "quantization": "Q5_K" -} -``` - -## Models API - -### Get Model - -- OpenAI Equivalent: https://platform.openai.com/docs/api-reference/models/retrieve -- OpenAI Equivalent: https://platform.openai.com/docs/api-reference/models/object -- The `Jan Model Object` maps into the `OpenAI Model Object`. -- Properties marked with `*` are compatible with the [OpenAI `model` object](https://platform.openai.com/docs/api-reference/models) -- Note: The `Jan Model Object` has additional properties when retrieved via its API endpoint. - -#### Request - -```shell -curl {JAN_URL}/v1/models/{model_id} -``` - -#### Response - -```json -{ - "id": "model-zephyr-7B", - "object": "model", - "created_at": 1686935002, - "owned_by": "thebloke", - "state": "running", - "source_url": "https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/blob/main/zephyr-7b-beta.Q4_K_M.gguf", - "parameters": { - "ctx_len": 2048, - "ngl": 100, - "embedding": true, - "n_parallel": 4, - "pre_prompt": "A chat between a curious user and an artificial intelligence", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: ", - "temperature": "0.7", - "token_limit": "2048", - "top_k": "0", - "top_p": "1", - }, - "metadata": { - "engine": "llamacpp", - "quantization": "Q3_K_L", - "size": "7B", - } -} -``` - -### List models -Lists the currently available models, and provides basic information about each one such as the owner and availability. -> OpenAI Equivalent: https://platform.openai.com/docs/api-reference/models/list - -#### Request - -```shell= -curl {JAN_URL}/v1/models -``` - -#### Response - -```json -{ - "object": "list", - "data": [ - { - "id": "model-zephyr-7B", - "object": "model", - "created_at": 1686935002, - "owned_by": "thebloke", - "state": "running" - }, - { - "id": "ft-llama-70b-gguf", - "object": "model", - "created_at": 1686935002, - "owned_by": "you", - "state": "stopped" - }, - { - "id": "model-azure-openai-gpt4-turbo", - "object": "model", - "created_at": 1686935002, - "owned_by": "azure_openai", - "state": "running" - }, - ], - "object": "list" -} -``` - -### Delete Model -> OpenAI Equivalent: https://platform.openai.com/docs/api-reference/models/delete - -#### Request - -```shell -curl -X DELETE {JAN_URL}/v1/models/{model_id} -``` - -#### Response - -```json -{ - "id": "model-zephyr-7B", - "object": "model", - "deleted": true, - "state": "to_download" -} -``` - -### Start Model -> Jan-only endpoint -The request to start `model` by changing model state from `ready` to `running` - -#### Request - -```shell -curl -X PUT {JAN_URL}/v1/models{model_id}/start -``` - -#### Response - -```json -{ - "id": "model-zephyr-7B", - "object": "model", - "state": "running" -} -``` - -### Stop Model -> Jan-only endpoint -The request to start `model` by changing model state from `running` to `ready` - -#### Request - -```shell -curl -X PUT {JAN_URL}/v1/models/{model_id}/stop -``` - -#### Response - -```json -{ - "id": "model-zephyr-7B", - "object": "model", - "state": "ready" -} -``` - -### Download Model -> Jan-only endpoint -The request to download `model` by changing model state from `to_download` to `downloading` then `ready`once it's done. - -#### Request -```shell -curl -X POST {JAN_URL}/v1/models/ -``` - -#### Response -```json -{ - "id": "model-zephyr-7B", - "object": "model", - "state": "downloading" -} -``` - -## Examples - -### Pre-loaded Models - -- Jan ships with a default model folders containing recommended models -- Only the Model Object `json` files are included -- Users must later explicitly download the model binaries -- -```sh -models/ - mistral-7b/ - mistral-7b.json - hermes-7b/ - hermes-7b.json -``` - -### Azure OpenAI +### Remote Model - Using a remote API to access model `model-azure-openai-gpt4-turbo.json` - See [source](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api) @@ -404,9 +298,24 @@ models/ } ``` +### Deferred Download + +- Jan ships with a default model folders containing recommended models +- Only the Model Object `json` files are included +- Users must later explicitly download the model binaries +- +```sh +models/ + mistral-7b/ + mistral-7b.json + hermes-7b/ + hermes-7b.json +``` + ### Multiple quantizations - Each quantization has its own `Jan Model Object` file +- TODO: `model.json`? ```sh llama2-7b-gguf/ @@ -428,8 +337,6 @@ llava-ggml/ ### Your locally fine-tuned model -- ?? - ```sh llama-70b-finetune/ llama-70b-finetune-q5.json From 18059c22dade97d1b4828d983b7e2a7e5a273f1c Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:09:06 +0800 Subject: [PATCH 10/15] Typo --- docs/docs/specs/models.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index 9dd096701..19f610cf3 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -335,7 +335,7 @@ llava-ggml/ ggml ``` -### Your locally fine-tuned model +### Locally fine-tuned model ```sh llama-70b-finetune/ From 3d466dc6cb5f40b79599a082b7b09676a4dc54a0 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 23:12:17 +0800 Subject: [PATCH 11/15] Hide incomplete pages --- docs/docs/specs/architecture.md | 6 ++++++ docs/docs/specs/chats.md | 2 +- docs/docs/specs/data-structures.md | 8 ++++++-- docs/docs/specs/models.md | 3 ++- docs/docs/specs/user-interface.md | 6 ++++++ docs/sidebars.js | 16 ++++++++-------- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/docs/specs/architecture.md b/docs/docs/specs/architecture.md index 962b928aa..15a1b196d 100644 --- a/docs/docs/specs/architecture.md +++ b/docs/docs/specs/architecture.md @@ -2,6 +2,12 @@ title: Architecture --- +:::warning + +This page is still under construction, and should be read as a scratchpad + +::: + - Jan is built using modules - Plugin architecture (on Pluggable-Electron) diff --git a/docs/docs/specs/chats.md b/docs/docs/specs/chats.md index c52e87a90..c6e9c1681 100644 --- a/docs/docs/specs/chats.md +++ b/docs/docs/specs/chats.md @@ -4,7 +4,7 @@ title: Chats :::warning -Draft Specification: functionality has not been implemented yet. +This page is still under construction, and should be read as a scratchpad ::: diff --git a/docs/docs/specs/data-structures.md b/docs/docs/specs/data-structures.md index d3f8507f4..3852a3823 100644 --- a/docs/docs/specs/data-structures.md +++ b/docs/docs/specs/data-structures.md @@ -2,6 +2,12 @@ title: Data Structures --- +:::warning + +This page is still under construction, and should be read as a scratchpad + +::: + ```sh janroot/ @@ -18,8 +24,6 @@ janroot/ model.json ``` - - Jan use the local filesystem for data persistence, similar to VSCode. This allows for composability and tinkerability. ```sh= diff --git a/docs/docs/specs/models.md b/docs/docs/specs/models.md index 19f610cf3..c214f7557 100644 --- a/docs/docs/specs/models.md +++ b/docs/docs/specs/models.md @@ -222,8 +222,9 @@ Currently, pasting a TheBloke Huggingface link in the Explore Models page will f - We should use the OpenAPI spec to discuss APIs - Dan's view: This needs @louis and App Pod to review as they are more familiar with this +- Dan's view: Start/Stop model should have some UI indicator (show state, block input) -::: +::: See http://localhost:3001/api-reference#tag/Models. diff --git a/docs/docs/specs/user-interface.md b/docs/docs/specs/user-interface.md index 8085b5b0e..c540a6973 100644 --- a/docs/docs/specs/user-interface.md +++ b/docs/docs/specs/user-interface.md @@ -2,6 +2,12 @@ title: User Interface --- +:::warning + +This page is still under construction, and should be read as a scratchpad + +::: + Jan provides a UI Kit for customize the UI for your use case. This means you can personalize the entire application according to your own brand and visual styles. This page gives you an overview of how to customize the UI. diff --git a/docs/sidebars.js b/docs/sidebars.js index fe04d330a..aa05c4117 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -61,14 +61,14 @@ const sidebars = { items: [ "specs/chats", "specs/models", - "specs/threads", - "specs/messages", - "specs/assistants", - "specs/files", - "specs/jan", - "specs/fine-tuning", - "specs/settings", - "specs/prompts", + // "specs/threads", + // "specs/messages", + // "specs/assistants", + // "specs/files", + // "specs/jan", + // "specs/fine-tuning", + // "specs/settings", + // "specs/prompts", ], }, ], From 388786cc95b87761acd0bfddfe25173f065c5d49 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 23:17:04 +0800 Subject: [PATCH 12/15] Add server page --- docs/docs/docs/server.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/docs/docs/server.md b/docs/docs/docs/server.md index 36f697cb2..05a715932 100644 --- a/docs/docs/docs/server.md +++ b/docs/docs/docs/server.md @@ -1,3 +1,20 @@ --- title: API Server ---- \ No newline at end of file +--- + +:::warning + +This page is under construction. + +::: + +Jan ships with a built-in API server, that can be used as a drop-in replacement for OpenAI's API. + +Jan runs on port `1337` by default, but this can be changed in Settings. + +Check out the [API Reference](/api-reference) for more information on the API endpoints. + +``` +curl https://localhost:1337/v1/chat/completions + +``` \ No newline at end of file From 2b7b518b9e73d9cddb450257e8cb33f6583f84f0 Mon Sep 17 00:00:00 2001 From: 0xSage Date: Sun, 19 Nov 2023 23:34:10 +0800 Subject: [PATCH 13/15] docs: fix wordage --- docs/openapi/jan.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index ce74ab1d2..252fb3837 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -2591,12 +2591,12 @@ paths: "created": 1686935002, "owned_by": "openai" } - /models/{model}/cancel: + /models/{model}/stop: post: - operationId: cancelModel + operationId: stopModel tags: - Models - summary: Cancel Model + summary: Stop Model description: Stops a running model. Unloads the model from V/RAM. parameters: - in: path From 38fab53d1d13bbbe907f00bf1bcf33b9f2c7cbff Mon Sep 17 00:00:00 2001 From: 0xSage Date: Sun, 19 Nov 2023 23:38:29 +0800 Subject: [PATCH 14/15] docs: del examples --- docs/openapi/jan.yaml | 72 ++----------------------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index 252fb3837..763e25785 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -2563,27 +2563,6 @@ paths: name: Import model returns: The [model](/docs/api-reference/models/object) object matching the specified ID. examples: - request: - curl: | - curl https://api.openai.com/v1/models/VAR_model_id \ - -H "Authorization: Bearer $OPENAI_API_KEY" - python: | - from openai import OpenAI - client = OpenAI() - - client.models.retrieve("VAR_model_id") - node.js: |- - import OpenAI from "openai"; - - const openai = new OpenAI(); - - async function main() { - const model = await openai.models.retrieve("gpt-3.5-turbo"); - - console.log(model); - } - - main(); response: &retrieve_model_response | { "id": "VAR_model_id", @@ -2613,61 +2592,14 @@ paths: schema: $ref: "#/components/schemas/RunObject" x-oaiMeta: - name: Cancel a running model + name: Stop a running model beta: true returns: The modified [run](/docs/api-reference/runs/object) object matching the specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_1cjnJPXj8MFiqTx58jU9TivC/runs/run_BeRGmpGt2wb1VI22ZRniOkrR/cancel \ - -H 'Authorization: Bearer $OPENAI_API_KEY' \ - -H 'OpenAI-Beta: assistants=v1' \ - -X POST - python: | - from openai import OpenAI - client = OpenAI() - - run = client.beta.threads.runs.cancel( - thread_id="thread_1cjnJPXj8MFiqTx58jU9TivC", - run_id="run_BeRGmpGt2wb1VI22ZRniOkrR" - ) - print(run) - node.js: | - import OpenAI from "openai"; - - const openai = new OpenAI(); - - async function main() { - const run = await openai.beta.threads.runs.cancel( - "thread_1cjnJPXj8MFiqTx58jU9TivC", - "run_BeRGmpGt2wb1VI22ZRniOkrR" - ); - - console.log(run); - } - - main(); response: | { - "id": "run_BeRGmpGt2wb1VI22ZRniOkrR", - "object": "model", - "created_at": 1699076126, - "status": "cancelling", - "started_at": 1699076126, - "expires_at": 1699076726, - "cancelled_at": null, - "failed_at": null, - "completed_at": null, - "last_error": null, - "model": "gpt-4", - "instructions": "You summarize books.", - "tools": [ - { - "type": "retrieval" - } - ], - "file_ids": [], - "metadata": {} + "todo": "run_BeRGmpGt2wb1VI22ZRniOkrR" } /moderations: From c0ad9a7a7bba08e5d12ce8b34f07d125c6c549c1 Mon Sep 17 00:00:00 2001 From: Daniel <101145494+dan-jan@users.noreply.github.com> Date: Sun, 19 Nov 2023 23:41:25 +0800 Subject: [PATCH 15/15] Fix links --- docs/docs/intro/introduction.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/intro/introduction.md b/docs/docs/intro/introduction.md index 6511a3a1b..3bff25015 100644 --- a/docs/docs/intro/introduction.md +++ b/docs/docs/intro/introduction.md @@ -5,7 +5,7 @@ slug: /intro Jan is a ChatGPT-alternative that runs on your own computer, with a [local API server](/api). -Jan uses [open-source AI models](/guide/models), stores data in [open file formats](/specs/data-structures), is highly customizable via [extensions](/guide/extensions). +Jan uses [open-source AI models](/docs/models), stores data in [open file formats](/specs/data-structures), is highly customizable via [extensions](/docs/extensions). Jan believes in the need for an open source AI ecosystem. We aim to build infra and tooling to allow open source AIs to compete on a level playing field with proprietary offerings. @@ -15,7 +15,7 @@ Jan believes in the need for an open source AI ecosystem. We aim to build infra Jan runs 100% on your own machine, [predictably](https://www.reddit.com/r/LocalLLaMA/comments/17mghqr/comment/k7ksti6/?utm_source=share&utm_medium=web2x&context=3), privately and even offline. No one else can see your conversations, not even us. #### 🏗️ Extensions -Jan ships with a powerful [extension framework](/guide/extensions), which allows developers to extend and customize Jan's functionality. In fact, most core modules of Jan are [built as extensions](/specs/architecture) and use the same extensions API. +Jan ships with a powerful [extension framework](/docs/extensions), which allows developers to extend and customize Jan's functionality. In fact, most core modules of Jan are [built as extensions](/specs/architecture) and use the same extensions API. #### 🗂️ Open File Formats Jan stores data in a [local folder of non-proprietary files](/specs/data-structures). You're never locked-in and can do what you want with your data with extensions, or even a different app. @@ -31,4 +31,4 @@ Minimalism: https://docusaurus.io/docs#design-principles. Not having abstraction File-based: User should be able to look at a Jan directory and intuit how it works. Transparency. Editing things via a text editor, vs. needing a database tool for SQLite. -Participatory: https://www.getlago.com/blog/the-5-reasons-why-we-chose-open-source --> +Participatory: https://www.getlago.com/blog/the-5-reasons-why-we-chose-open-source --> \ No newline at end of file