From acac8696522e5af33555d7908e166b930b4b26d8 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 05:25:35 +0900
Subject: [PATCH 01/11] docs: change configure for API docs
---
docs/docusaurus.config.js | 6 +++---
docs/openapi/jan.yaml | 30 +++++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
index 822c2189b..7b07016d2 100644
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -113,11 +113,11 @@ const config = {
primaryColor: "#1a73e8",
primaryColorDark: "#1a73e8",
options: {
- disableSearch: true,
requiredPropsFirst: true,
- noAutoAuth: true
+ noAutoAuth: true,
+ hideDownloadButton: true,
+ disableSearch: true,
},
- // redocOptions: { hideDownloadButton: false },
},
},
],
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index c1bd48143..36132f1f0 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -51,6 +51,7 @@ paths:
operationId: listModels
tags:
- Models
+
summary: List Models
description: Lists the currently available models, and provides basic information about each one such as the owner and availability.
responses:
@@ -548,8 +549,28 @@ paths:
operationId: listMessageFiles
tags:
- Messages
- summary: List message files
- description: Returns a list of message files.
+ summary: List message files
+ securitySchemes:
+ petstore_auth:
+ description: |
+ Get access to data while protecting your account credentials.
+ OAuth2 is also a safer and more secure way to give you access.
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ description: |
+
+
+
+ Returns a list of message files.
+
+
+
+
parameters:
- in: path
name: thread_id
@@ -564,7 +585,10 @@ paths:
schema:
type: string
example: msg_abc123
- description: The ID of the message whose files are to be listed.
+ description: |
+ The ID of the message whose files are to be listed.
+
+ Open.AI Compatible
responses:
"200":
description: List of files retrieved successfully
From 553fcae6819e9eb19456c4f75c5d48c92ac3afdd Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 05:28:19 +0900
Subject: [PATCH 02/11] docs: standardize title
---
docs/openapi/jan.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 36132f1f0..84274cfb8 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -1,6 +1,6 @@
openapi: 3.0.0
info:
- title: Jan API Reference
+ title: API Reference
description: Please see https://jan.ai for documentation.
version: "0.1.8"
contact:
From a2a0c38144a91a731d073705c83f268a30dbd849 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 05:57:13 +0900
Subject: [PATCH 03/11] docs: finalize labeling models
---
docs/openapi/jan.yaml | 75 ++++++++++++++++++++++++----------
docs/openapi/specs/models.yaml | 34 +++++++--------
2 files changed, 70 insertions(+), 39 deletions(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 84274cfb8..2a04467de 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -52,8 +52,12 @@ paths:
tags:
- Models
- summary: List Models
- description: 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
@@ -69,8 +73,11 @@ paths:
operationId: downloadModel
tags:
- Models
- summary: Download Model
- description: Download a model.
+ summary: Download model
+ description: |
+ Jan
+
+ Download a model.
responses:
"200":
description: OK
@@ -84,20 +91,26 @@ paths:
curl -X POST https://localhost:1337/v1/models
/models/{model_id}:
get:
- operationId: getModel
+ operationId: retrieveModel
tags:
- Models
- summary: Get Model
- description: Get a model instance, providing basic information about the model such as the owner and permissioning.
+ summary: Retrieve model
+ description: |
+
+
+ Get a model instance, providing basic information about the model such as the owner and permissioning.
parameters:
- in: path
- name: source_url
+ name: model_id
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
+ example: zephyr-7b
+ description: |
+ The ID of the model to use for this request
+
+ OpenAI compatible
responses:
"200":
description: OK
@@ -113,8 +126,11 @@ paths:
operationId: deleteModel
tags:
- Models
- summary: Delete Model
- description: Delete a model.
+ summary: Delete model
+ description: |
+
+
+ Delete a model.
parameters:
- in: path
name: model
@@ -122,7 +138,10 @@ paths:
schema:
type: string
example: zephyr-7b
- description: The model to delete
+ description: |
+ The model to delete
+
+ OpenAI compatible
responses:
"200":
description: OK
@@ -139,8 +158,11 @@ paths:
operationId: startModel
tags:
- Models
- summary: Start Model
- description: Starts an imported model. Loads the model into V/RAM.
+ summary: Start model
+ description: |
+ Jan
+
+ Starts an imported model. Loads the model into V/RAM.
parameters:
- in: path
name: model
@@ -149,7 +171,8 @@ paths:
type: string
# ideally this will be an actual ID, so this will always work from browser
example: zephyr-7b
- description: The ID of the model to use for this request
+ description: |
+ The ID of the model to use for this request
responses:
"200":
description: OK
@@ -166,8 +189,11 @@ paths:
operationId: stopModel
tags:
- Models
- summary: Stop Model
- description: Stop an imported model.
+ summary: Stop model
+ description: |
+ Jan
+
+ Stop an imported model.
parameters:
- in: path
name: model
@@ -437,7 +463,7 @@ paths:
operationId: listMessages
tags:
- Messages
- summary: List messaages
+ summary: List messages
description: Retrieves all messages from the given thread.
parameters:
- in: path
@@ -564,7 +590,7 @@ paths:
'read:pets': read your pets
description: |
-
+
Returns a list of message files.
@@ -588,7 +614,7 @@ paths:
description: |
The ID of the message whose files are to be listed.
- Open.AI Compatible
+ OpenAI compatible
responses:
"200":
description: List of files retrieved successfully
@@ -648,7 +674,12 @@ x-webhooks:
ModelObject:
post:
summary: The model object
- description: Information about a model in the systems
+ description: |
+
+
+ Describe a model offering that can be used with the API.
+
+
operationId: ModelObject
tags:
- Models
diff --git a/docs/openapi/specs/models.yaml b/docs/openapi/specs/models.yaml
index 6f136d30e..b4a5937b9 100644
--- a/docs/openapi/specs/models.yaml
+++ b/docs/openapi/specs/models.yaml
@@ -117,26 +117,33 @@ components:
properties:
id:
type: string
- description: "The identifier of the model."
+ description: |
+ "The identifier of the model."
+
+ OpenAI compatible
example: "zephyr-7b"
object:
type: string
- description: "The type of the object, indicating it's a model."
+ description: |
+ "The type of the object, indicating it's a model."
+
+ OpenAI compatible
default: "model"
created:
type: integer
format: int64
- description: "Unix timestamp representing the creation time of the model."
+ description: |
+ "Unix timestamp representing the creation time of the model."
+
+ OpenAI compatible
example: "1253935178"
owned_by:
type: string
- description: "The entity that owns the model."
+ description: |
+ "The entity that owns the model."
+
+ OpenAI compatible
example: "_"
- required:
- - id
- - object
- - created
- - owned_by
GetModelResponse:
type: object
@@ -253,10 +260,7 @@ components:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true
- required:
- - id
- - object
- - deleted
+
StartModelResponse:
type: object
@@ -313,8 +317,4 @@ components:
type: string
description: "The current state of the model after the start operation."
example: "downloaded"
- required:
- - id
- - object
- - state
From ed3548444c0fc0548a49ba99e9af2106f2f7d060 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 06:51:48 +0900
Subject: [PATCH 04/11] docs: add ChatCompletion
---
docs/openapi/jan.yaml | 61 +++++++++--
docs/openapi/specs/chat.yaml | 197 +++++++++++++++++++++++++++++++++++
2 files changed, 247 insertions(+), 11 deletions(-)
create mode 100644 docs/openapi/specs/chat.yaml
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 2a04467de..2eb9b815b 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -14,8 +14,10 @@ servers:
tags:
- name: Models
description: List and describe the various models available in the API.
- - name: Chat Completion
- description: Given a list of messages comprising a conversation, the model will return a response.
+ - name: Chat
+ description: |
+ Given a list of messages comprising a conversation, the model will return a response.
+
- name: Messages
description: |
Messages capture a conversation's content. This can include the content from LLM responses and other metadata from [chat completions](/specs/chats).
@@ -38,13 +40,51 @@ x-tagGroups:
- name: Endpoints
tags:
- Models
- - Chat Completion
+ - Chat
- name: Chat
tags:
- Assistants
- Messages
- Threads
paths:
+ /chat/completions:
+ post:
+ operationId: createChatCompletion
+ tags:
+ - Chat
+ summary: Create chat completion
+ description: |
+
+ and Jan specified
+
+ Creates a model response for the given chat conversation.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "specs/chat.yaml#/components/schemas/ChatCompletionRequest"
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: "specs/chat.yaml#/components/schemas/ChatCompletionResponse"
+ x-codeSamples:
+ - lang: "curl"
+ source: |
+ curl -X POST 'http://localhost:3982/inferences/llamacpp/chat_completion' \
+ -H "Content-Type: application/json" \
+ -d '{
+ "llama_model_path": "/path/to/your/model.gguf",
+ "messages": [
+ {
+ "role": "user",
+ "content": "hello"
+ },
+ ]
+ }'
+
### MODELS
/models:
get:
@@ -54,10 +94,9 @@ paths:
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
@@ -96,7 +135,7 @@ paths:
- Models
summary: Retrieve model
description: |
-
+
Get a model instance, providing basic information about the model such as the owner and permissioning.
parameters:
@@ -128,7 +167,7 @@ paths:
- Models
summary: Delete model
description: |
-
+
Delete a model.
parameters:
@@ -192,7 +231,7 @@ paths:
summary: Stop model
description: |
Jan
-
+
Stop an imported model.
parameters:
- in: path
@@ -589,12 +628,12 @@ paths:
'write:pets': modify pets in your account
'read:pets': read your pets
description: |
-
+
Returns a list of message files.
-
+
parameters:
@@ -675,7 +714,7 @@ x-webhooks:
post:
summary: The model object
description: |
-
+
Describe a model offering that can be used with the API.
diff --git a/docs/openapi/specs/chat.yaml b/docs/openapi/specs/chat.yaml
new file mode 100644
index 000000000..7aef0cfe0
--- /dev/null
+++ b/docs/openapi/specs/chat.yaml
@@ -0,0 +1,197 @@
+components:
+ schemas:
+ ChatObject:
+ type: object
+ properties:
+ messages:
+ type: arrays
+ description: |
+ Contains input data or prompts for the model to process
+ example:
+ [
+ { "content": "Hello there :wave:", "role": "assistant" },
+ { "content": "Can you write a long story", "role": "user" },
+ ]
+ stream:
+ type: boolean
+ default: true
+ description: Enables continuous output generation, allowing for streaming of model responses
+ model:
+ type: string
+ example: "gpt-3.5-turbo"
+ description: Specifies the model being used for inference or processing tasks
+ max_tokens:
+ type: number
+ default: 2048
+ description: The maximum number of tokens the model will generate in a single response
+ stop:
+ type: arrays
+ example: ["hello"]
+ description: Defines specific tokens or phrases at which the model will stop generating further output
+ frequency_penalty:
+ type: number
+ default: 0
+ description: Adjusts the likelihood of the model repeating words or phrases in its output
+ presence_penalty:
+ type: number
+ default: 0
+ description: Influences the generation of new and varied concepts in the model's output
+ temperature:
+ type: number
+ default: 0.7
+ min: 0
+ max: 1
+ description: Controls the randomness of the model's output
+ top_p:
+ type: number
+ default: 0.95
+ min: 0
+ max: 1
+ description: Set probability threshold for more relevant outputs
+ cache_prompt:
+ type: boolean
+ default: true
+ description: Optimize performance in repeated or similar requests.
+ ChatCompletionRequest:
+ type: object
+ properties:
+ messages:
+ type: arrays
+ description: |
+ Contains input data or prompts for the model to process
+
+ OpenAI compatible
+ example:
+ [
+ { "content": "Hello there :wave:", "role": "assistant" },
+ { "content": "Can you write a long story", "role": "user" },
+ ]
+ model:
+ type: string
+ example: model-zephyr-7B
+ description: |
+ Specifies the model being used for inference or processing tasks
+
+ OpenAI compatible
+ stream:
+ type: boolean
+ default: true
+ description: |
+ Enables continuous output generation, allowing for streaming of model responses
+
+ OpenAI compatible
+ max_tokens:
+ type: number
+ default: 2048
+ description: |
+ The maximum number of tokens the model will generate in a single response
+
+ OpenAI compatible
+ stop:
+ type: arrays
+ example: ["hello"]
+ description: |
+ Defines specific tokens or phrases at which the model will stop generating further output
+
+ OpenAI compatible
+ frequency_penalty:
+ type: number
+ default: 0
+ description: |
+ Adjusts the likelihood of the model repeating words or phrases in its output
+
+ OpenAI compatible
+ presence_penalty:
+ type: number
+ default: 0
+ description: |
+ Influences the generation of new and varied concepts in the model's output
+
+ OpenAI compatible
+ temperature:
+ type: number
+ default: 0.7
+ min: 0
+ max: 1
+ description: |
+ Controls the randomness of the model's output
+
+ OpenAI compatible
+ top_p:
+ type: number
+ default: 0.95
+ min: 0
+ max: 1
+ description: |
+ Set probability threshold for more relevant outputs
+
+ OpenAI compatible
+
+ ChatCompletionResponse:
+ type: object
+ description: Description of the response structure
+ properties:
+ choices:
+ type: array
+ description: Array of choice objects
+ items:
+ type: object
+ properties:
+ finish_reason:
+ type: string
+ nullable: true
+ example: null
+ description: Reason for finishing the response, if applicable
+ index:
+ type: integer
+ example: 0
+ description: Index of the choice
+ message:
+ type: object
+ properties:
+ content:
+ type: string
+ example: "Hello user. What can I help you with?"
+ description: Content of the message
+ role:
+ type: string
+ example: assistant
+ description: Role of the sender
+ created:
+ type: integer
+ example: 1700193928
+ description: Timestamp of when the response was created
+ id:
+ type: string
+ example: ebwd2niJvJB1Q2Whyvkz
+ description: Unique identifier of the response
+ model:
+ type: string
+ nullable: true
+ example: _
+ description: Model used for generating the response
+ object:
+ type: string
+ example: chat.completion
+ description: Type of the response object
+ system_fingerprint:
+ type: string
+ nullable: true
+ example: _
+ description: System fingerprint
+ usage:
+ type: object
+ description: Information about the usage of tokens
+ properties:
+ completion_tokens:
+ type: integer
+ example: 500
+ description: Number of tokens used for completion
+ prompt_tokens:
+ type: integer
+ example: 33
+ description: Number of tokens used in the prompt
+ total_tokens:
+ type: integer
+ example: 533
+ description: Total number of tokens used
From 5d1b953eaf4a3c5374722bae5667f284e763c682 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 06:58:37 +0900
Subject: [PATCH 05/11] docs: add introduction
---
docs/openapi/jan.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 2eb9b815b..dbda21ac0 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -1,7 +1,9 @@
openapi: 3.0.0
info:
title: API Reference
- description: Please see https://jan.ai for documentation.
+ description: |
+ # Introduction
+ Jan API is compatible with the [OpenAI API](https://platform.openai.com/docs/api-reference).
version: "0.1.8"
contact:
name: Jan Discord
From 31f16503c7b994572ff66262777562da034919fd Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 07:14:39 +0900
Subject: [PATCH 06/11] docs: label message
---
docs/openapi/jan.yaml | 96 +++++++++++++++++++++-----------
docs/openapi/specs/messages.yaml | 50 +++++++++++++----
2 files changed, 102 insertions(+), 44 deletions(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index dbda21ac0..36e2adf5b 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -505,7 +505,10 @@ paths:
tags:
- Messages
summary: List messages
- description: Retrieves all messages from the given thread.
+ description: |
+
+
+ Retrieves all messages from the given thread.
parameters:
- in: path
name: thread_id
@@ -513,7 +516,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread from which to retrieve messages.
+ description: |
+ The ID of the thread from which to retrieve messages.
+
+ OpenAI compatible
responses:
"200":
description: List of messages retrieved successfully
@@ -531,7 +537,10 @@ paths:
tags:
- Messages
summary: Create message
- description: Create a message
+ description: |
+
+
+ Create a message
parameters:
- in: path
name: thread_id
@@ -539,7 +548,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread to which the message will be posted.
+ description: |
+ The ID of the thread to which the message will be posted.
+
+ OpenAI compatible
requestBody:
required: true
content:
@@ -549,12 +561,18 @@ paths:
properties:
role:
type: string
- description: "Role of the sender, either 'user' or 'assistant'."
+ description: |
+ "Role of the sender, either 'user' or 'assistant'."
+
+ OpenAI compatible
example: "user"
enum: ["user", "assistant"]
content:
type: string
- description: "Text content of the message."
+ description: |
+ "Text content of the message."
+
+ OpenAI compatible
example: "How does AI work? Explain it in simple terms."
required:
- role
@@ -581,8 +599,11 @@ paths:
operationId: retrieveMessage
tags:
- Messages
- summary: Retrieve Message
- description: Retrieve a specific message from a thread using its thread_id and message_id.
+ summary: Retrieve message
+ description: |
+
+
+ Retrieve a specific message from a thread using its thread_id and message_id.
parameters:
- in: path
name: thread_id
@@ -590,14 +611,20 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread containing the message.
+ description: |
+ The ID of the thread containing the message.
+
+ OpenAI compatible
- in: path
name: message_id
required: true
schema:
type: string
example: msg_abc123
- description: The ID of the message to retrieve.
+ description: |
+ The ID of the message to retrieve.
+
+ OpenAI compatible
responses:
"200":
description: OK
@@ -617,27 +644,10 @@ paths:
tags:
- Messages
summary: List message files
- securitySchemes:
- petstore_auth:
- description: |
- Get access to data while protecting your account credentials.
- OAuth2 is also a safer and more secure way to give you access.
- type: oauth2
- flows:
- implicit:
- authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
- scopes:
- 'write:pets': modify pets in your account
- 'read:pets': read your pets
description: |
-
-
+
Returns a list of message files.
-
-
-
-
parameters:
- in: path
name: thread_id
@@ -645,7 +655,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread containing the message.
+ description: |
+ The ID of the thread containing the message.
+
+ OpenAI compatible
- in: path
name: message_id
required: true
@@ -675,7 +688,10 @@ paths:
tags:
- Messages
summary: Retrieve message file
- description: Retrieves a file associated with a specific message in a thread.
+ description: |
+
+
+ Retrieves a file associated with a specific message in a thread.
parameters:
- in: path
name: thread_id
@@ -683,21 +699,30 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread containing the message.
+ description: |
+ The ID of the thread containing the message.
+
+ OpenAI compatible
- in: path
name: message_id
required: true
schema:
type: string
example: msg_abc123
- description: The ID of the message associated with the file.
+ description: |
+ The ID of the message associated with the file.
+
+ OpenAI compatible
- in: path
name: file_id
required: true
schema:
type: string
example: file-abc123
- description: The ID of the file to retrieve.
+ description: |
+ The ID of the file to retrieve.
+
+ OpenAI compatible
responses:
"200":
description: File retrieved successfully
@@ -733,7 +758,10 @@ x-webhooks:
MessageObject:
post:
summary: The message object
- description: Information about a message in the thread
+ description: |
+
+
+ Information about a message in the thread
operationId: MessageObject
tags:
- Messages
diff --git a/docs/openapi/specs/messages.yaml b/docs/openapi/specs/messages.yaml
index daa998767..97ff9ae4e 100644
--- a/docs/openapi/specs/messages.yaml
+++ b/docs/openapi/specs/messages.yaml
@@ -5,28 +5,46 @@ components:
properties:
id:
type: string
- description: "Sequential or UUID identifier of the message."
+ description: |
+ "Sequential or UUID identifier of the message."
+
+ OpenAI compatible
example: 0
object:
type: string
- description: "Type of the object, defaults to 'thread.message'."
+ description: |
+ "Type of the object, defaults to 'thread.message'."
+
+ OpenAI compatible
example: thread.message
created_at:
type: integer
format: int64
- description: "Unix timestamp representing the creation time of the message."
+ description: |
+ "Unix timestamp representing the creation time of the message."
+
+ OpenAI compatible
thread_id:
type: string
- description: "Identifier of the thread to which this message belongs. Defaults to parent thread."
+ description: |
+ "Identifier of the thread to which this message belongs. Defaults to parent thread."
+
+ OpenAI compatible
example: "thread_asdf"
assistant_id:
type: string
- description: "Identifier of the assistant involved in the message. Defaults to parent thread."
+ description: |
+ "Identifier of the assistant involved in the message. Defaults to parent thread."
+
+ OpenAI compatible
example: jan
role:
type: string
enum: ["user", "assistant"]
- description: "Role of the sender, either 'user' or 'assistant'."
+ description: |
+ "Role of the sender, either 'user' or 'assistant'."
+
+ OpenAI compatible
content:
type: array
items:
@@ -34,23 +52,35 @@ components:
properties:
type:
type: string
- description: "Type of content, e.g., 'text'."
+ description: |
+ "Type of content, e.g., 'text'."
+
+ OpenAI compatible
text:
type: object
properties:
value:
type: string
- description: "Text content of the message."
+ description: |
+ "Text content of the message."
+
+ OpenAI compatible
example: "Hi!?"
annotations:
type: array
items:
type: string
- description: "Annotations for the text content, if any."
+ description: |
+ "Annotations for the text content, if any."
+
+ OpenAI compatible
example: []
metadata:
type: object
- description: "Metadata associated with the message, defaults to an empty object."
+ description: |
+ "Metadata associated with the message, defaults to an empty object."
+
+ OpenAI compatible
example: {}
GetMessageResponse:
From 2877f3234b3128fb6e45c6e1ac5e7346b5529d2f Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 07:49:49 +0900
Subject: [PATCH 07/11] docs: finalize thread
---
docs/openapi/jan.yaml | 70 +++++++++++++++++-------
docs/openapi/specs/threads.yaml | 94 +++++++++++++++++++++++----------
2 files changed, 117 insertions(+), 47 deletions(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 36e2adf5b..cfaa06847 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -263,7 +263,10 @@ paths:
tags:
- Threads
summary: Create thread
- description: Create a thread
+ description: |
+
+
+ Create a thread
requestBody:
required: false
content:
@@ -303,7 +306,10 @@ paths:
tags:
- Threads
summary: List threads
- description: Retrieves a list of all threads available in the system.
+ description: |
+ Jan
+
+ Retrieves a list of all threads available in the system.
responses:
"200":
description: List of threads retrieved successfully
@@ -336,8 +342,11 @@ paths:
operationId: getThread
tags:
- Threads
- summary: Get thread
- description: Retrieves detailed information about a specific thread using its thread_id.
+ summary: Retrieve thread
+ description: |
+
+
+ Retrieves detailed information about a specific thread using its thread_id.
parameters:
- in: path
name: thread_id
@@ -345,7 +354,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread to retrieve.
+ description: |
+ The ID of the thread to retrieve.
+
+ OpenAI compatible
responses:
"200":
description: Thread details retrieved successfully
@@ -362,7 +374,10 @@ paths:
tags:
- Threads
summary: Modify thread
- description: Modifies a thread
+ description: |
+
+
+ Modifies a thread
parameters:
- in: path
name: thread_id
@@ -370,7 +385,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread to be modified.
+ description: |
+ The ID of the thread to be modified.
+
+ OpenAI compatible
requestBody:
required: false
content:
@@ -411,7 +429,10 @@ paths:
tags:
- Threads
summary: Delete thread
- description: Delete a thread
+ description: |
+
+
+ Delete a thread
parameters:
- in: path
name: thread_id
@@ -419,7 +440,10 @@ paths:
schema:
type: string
example: thread_abc123
- description: The ID of the thread to be deleted.
+ description: |
+ The ID of the thread to be deleted.
+
+ OpenAI compatible
responses:
"200":
description: Thread deleted successfully
@@ -439,8 +463,10 @@ paths:
tags:
- Threads
summary: Get Thread.Assistants
- description:
- - Can achieve this goal by calling Get thread API
+ description: |
+ Jan
+
+ Can achieve this goal by calling Get thread API
parameters:
- in: path
name: thread_id
@@ -467,8 +493,10 @@ paths:
tags:
- Threads
summary: Modify Thread.Assistants
- description:
- - Can achieve this goal by calling Modify Assistant API with thread.assistant[]
+ description: |
+ Jan
+
+ Can achieve this goal by calling Modify Assistant API with thread.assistant[]
/threads/{thread_id}/:
get:
@@ -476,8 +504,10 @@ paths:
tags:
- Threads
summary: List Thread.Messages
- description:
- - Can achieve this goal by calling Get Thread API
+ description: |
+ Jan
+
+ Can achieve this goal by calling Get Thread API
parameters:
- in: path
name: thread_id
@@ -775,9 +805,13 @@ x-webhooks:
post:
summary: The thread object
description: |
- - Each `thread` folder contains a `thread.json` file, which is a representation of a thread.
- - `thread.json` contains metadata and model parameter overrides.
- - There are no required fields.
+ and Jan
+
+ Each `thread` folder contains a `thread.json` file, which is a representation of a thread.
+
+ `thread.json` contains metadata and model parameter overrides.
+
+ There are no required fields.
operationId: ThreadObject
tags:
diff --git a/docs/openapi/specs/threads.yaml b/docs/openapi/specs/threads.yaml
index 317447f90..f071d14a6 100644
--- a/docs/openapi/specs/threads.yaml
+++ b/docs/openapi/specs/threads.yaml
@@ -5,47 +5,73 @@ components:
properties:
id:
type: string
- description: "The identifier of the thread, defaults to foldername."
+ description: |
+ "The identifier of the thread, defaults to foldername."
+
+ OpenAI compatible
example: thread_....
object:
type: string
- description: "Type of the object, defaults to thread."
+ description: |
+ "Type of the object, defaults to thread."
+
+ OpenAI compatible
example: thread
- summary:
+ title:
type: string
- description: "A brief summary or description of the thread, defaults to an empty string."
+ description: |
+ "A brief summary or description of the thread, defaults to an empty string."
+
+ Jan
example: "funny physics joke"
assistants:
type: array
+ description: |
+ Jan
items:
- type: string
- description: "List of assistants involved in the thread, defaults to [\"jan\"]."
- example: ["jan"]
+ properties:
+ assistant_id:
+ type: string
+ description: |
+ The identifier of assistant, defaults to "jan"
+
+ Jan
+ example: jan
+ model:
+ type: object
+ properties:
+ id:
+ type: string
+ description: |
+ Jan
+ example: ...
+ settings:
+ type: object
+ description: |
+ Defaults to and overrides assistant.json's "settings" (and if none, then model.json "settings")
+
+ Jan
+ parameters:
+ type: object
+ description: |
+ Defaults to and overrides assistant.json's "parameters" (and if none, then model.json "parameters")
+
+ Jan
created:
type: integer
format: int64
- description: "Unix timestamp representing the creation time of the thread, defaults to file creation time."
+ description: |
+ "Unix timestamp representing the creation time of the thread, defaults to file creation time."
+
+ OpenAI compatible
example: 1231231
metadata:
type: object
- description: "Metadata associated with the thread, defaults to an empty object."
+ description: |
+ "Metadata associated with the thread, defaults to an empty object."
+
+ OpenAI compatible
example: {}
- messages:
- type: array
- description: "List of messages within the thread."
- items:
- type: string
- example: []
- model_id:
- type: string
- description: "Model identifier associated with the thread, defaults to assistant.model."
- example: "..."
- settings:
- type: object
- description: "Settings for the thread, defaults to and overrides assistant.settings."
- parameters:
- type: object
- description: "Parameters for the thread, defaults to and overrides assistant.settings."
GetThreadResponse:
type: object
@@ -106,23 +132,33 @@ components:
properties:
role:
type: string
- description: "Role of the sender, either 'user' or 'assistant'."
+ description: |
+ "Role of the sender, either 'user' or 'assistant'."
+
+ OpenAI compatible
enum: ["user", "assistant"]
content:
type: string
- description: "Text content of the message."
+ description: |
+ "Text content of the message."
+
+ OpenAI compatible
file_ids:
type: array
items:
type: string
- description: "Array of file IDs associated with the message, if any."
+ description: |
+ "Array of file IDs associated with the message, if any."
+
+ OpenAI compatible
ModifyThreadResponse:
type: object
properties:
id:
type: string
- description: "The identifier of the modified thread."
+ description: |
+ "The identifier of the modified thread."
example: thread_abc123
object:
type: string
From 28288f972b6c45dda467a2b25c4f6c875b85ca33 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 08:01:17 +0900
Subject: [PATCH 08/11] docs: change OpenAI compatible color
---
docs/openapi/jan.yaml | 66 ++++++++++++++++----------------
docs/openapi/specs/chat.yaml | 18 ++++-----
docs/openapi/specs/messages.yaml | 20 +++++-----
docs/openapi/specs/models.yaml | 8 ++--
docs/openapi/specs/threads.yaml | 14 +++----
5 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index cfaa06847..de01e271b 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -56,7 +56,7 @@ paths:
- Chat
summary: Create chat completion
description: |
-
+
and Jan specified
Creates a model response for the given chat conversation.
@@ -96,7 +96,7 @@ paths:
summary: List models
description: |
-
+
Lists the currently available models, and provides basic information about each one such as the owner and availability.
responses:
@@ -137,7 +137,7 @@ paths:
- Models
summary: Retrieve model
description: |
-
+
Get a model instance, providing basic information about the model such as the owner and permissioning.
parameters:
@@ -151,7 +151,7 @@ paths:
description: |
The ID of the model to use for this request
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: OK
@@ -169,7 +169,7 @@ paths:
- Models
summary: Delete model
description: |
-
+
Delete a model.
parameters:
@@ -182,7 +182,7 @@ paths:
description: |
The model to delete
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: OK
@@ -264,7 +264,7 @@ paths:
- Threads
summary: Create thread
description: |
-
+
Create a thread
requestBody:
@@ -344,7 +344,7 @@ paths:
- Threads
summary: Retrieve thread
description: |
-
+
Retrieves detailed information about a specific thread using its thread_id.
parameters:
@@ -357,7 +357,7 @@ paths:
description: |
The ID of the thread to retrieve.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: Thread details retrieved successfully
@@ -375,7 +375,7 @@ paths:
- Threads
summary: Modify thread
description: |
-
+
Modifies a thread
parameters:
@@ -388,7 +388,7 @@ paths:
description: |
The ID of the thread to be modified.
- OpenAI compatible
+ OpenAI compatible
requestBody:
required: false
content:
@@ -430,7 +430,7 @@ paths:
- Threads
summary: Delete thread
description: |
-
+
Delete a thread
parameters:
@@ -443,7 +443,7 @@ paths:
description: |
The ID of the thread to be deleted.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: Thread deleted successfully
@@ -506,7 +506,7 @@ paths:
summary: List Thread.Messages
description: |
Jan
-
+
Can achieve this goal by calling Get Thread API
parameters:
- in: path
@@ -536,7 +536,7 @@ paths:
- Messages
summary: List messages
description: |
-
+
Retrieves all messages from the given thread.
parameters:
@@ -549,7 +549,7 @@ paths:
description: |
The ID of the thread from which to retrieve messages.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: List of messages retrieved successfully
@@ -568,7 +568,7 @@ paths:
- Messages
summary: Create message
description: |
-
+
Create a message
parameters:
@@ -581,7 +581,7 @@ paths:
description: |
The ID of the thread to which the message will be posted.
- OpenAI compatible
+ OpenAI compatible
requestBody:
required: true
content:
@@ -594,7 +594,7 @@ paths:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
+ OpenAI compatible
example: "user"
enum: ["user", "assistant"]
content:
@@ -602,7 +602,7 @@ paths:
description: |
"Text content of the message."
- OpenAI compatible
+ OpenAI compatible
example: "How does AI work? Explain it in simple terms."
required:
- role
@@ -631,7 +631,7 @@ paths:
- Messages
summary: Retrieve message
description: |
-
+
Retrieve a specific message from a thread using its thread_id and message_id.
parameters:
@@ -644,7 +644,7 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
+ OpenAI compatible
- in: path
name: message_id
required: true
@@ -654,7 +654,7 @@ paths:
description: |
The ID of the message to retrieve.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: OK
@@ -675,7 +675,7 @@ paths:
- Messages
summary: List message files
description: |
-
+
Returns a list of message files.
parameters:
@@ -688,7 +688,7 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
+ OpenAI compatible
- in: path
name: message_id
required: true
@@ -698,7 +698,7 @@ paths:
description: |
The ID of the message whose files are to be listed.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: List of files retrieved successfully
@@ -719,7 +719,7 @@ paths:
- Messages
summary: Retrieve message file
description: |
-
+
Retrieves a file associated with a specific message in a thread.
parameters:
@@ -732,7 +732,7 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
+ OpenAI compatible
- in: path
name: message_id
required: true
@@ -742,7 +742,7 @@ paths:
description: |
The ID of the message associated with the file.
- OpenAI compatible
+ OpenAI compatible
- in: path
name: file_id
required: true
@@ -752,7 +752,7 @@ paths:
description: |
The ID of the file to retrieve.
- OpenAI compatible
+ OpenAI compatible
responses:
"200":
description: File retrieved successfully
@@ -771,7 +771,7 @@ x-webhooks:
post:
summary: The model object
description: |
-
+
Describe a model offering that can be used with the API.
@@ -789,7 +789,7 @@ x-webhooks:
post:
summary: The message object
description: |
-
+
Information about a message in the thread
operationId: MessageObject
@@ -805,7 +805,7 @@ x-webhooks:
post:
summary: The thread object
description: |
- and Jan
+ and Jan
Each `thread` folder contains a `thread.json` file, which is a representation of a thread.
diff --git a/docs/openapi/specs/chat.yaml b/docs/openapi/specs/chat.yaml
index 7aef0cfe0..db738aee5 100644
--- a/docs/openapi/specs/chat.yaml
+++ b/docs/openapi/specs/chat.yaml
@@ -60,7 +60,7 @@ components:
description: |
Contains input data or prompts for the model to process
- OpenAI compatible
+ OpenAI compatible
example:
[
{ "content": "Hello there :wave:", "role": "assistant" },
@@ -72,42 +72,42 @@ components:
description: |
Specifies the model being used for inference or processing tasks
- OpenAI compatible
+ OpenAI compatible
stream:
type: boolean
default: true
description: |
Enables continuous output generation, allowing for streaming of model responses
- OpenAI compatible
+ OpenAI compatible
max_tokens:
type: number
default: 2048
description: |
The maximum number of tokens the model will generate in a single response
- OpenAI compatible
+ OpenAI compatible
stop:
type: arrays
example: ["hello"]
description: |
Defines specific tokens or phrases at which the model will stop generating further output
- OpenAI compatible
+ OpenAI compatible
frequency_penalty:
type: number
default: 0
description: |
Adjusts the likelihood of the model repeating words or phrases in its output
- OpenAI compatible
+ OpenAI compatible
presence_penalty:
type: number
default: 0
description: |
Influences the generation of new and varied concepts in the model's output
- OpenAI compatible
+ OpenAI compatible
temperature:
type: number
default: 0.7
@@ -116,7 +116,7 @@ components:
description: |
Controls the randomness of the model's output
- OpenAI compatible
+ OpenAI compatible
top_p:
type: number
default: 0.95
@@ -125,7 +125,7 @@ components:
description: |
Set probability threshold for more relevant outputs
- OpenAI compatible
+ OpenAI compatible
ChatCompletionResponse:
type: object
diff --git a/docs/openapi/specs/messages.yaml b/docs/openapi/specs/messages.yaml
index 97ff9ae4e..d4f61117e 100644
--- a/docs/openapi/specs/messages.yaml
+++ b/docs/openapi/specs/messages.yaml
@@ -8,14 +8,14 @@ components:
description: |
"Sequential or UUID identifier of the message."
- OpenAI compatible
+ OpenAI compatible
example: 0
object:
type: string
description: |
"Type of the object, defaults to 'thread.message'."
- OpenAI compatible
+ OpenAI compatible
example: thread.message
created_at:
type: integer
@@ -23,20 +23,20 @@ components:
description: |
"Unix timestamp representing the creation time of the message."
- OpenAI compatible
+ OpenAI compatible
thread_id:
type: string
description: |
"Identifier of the thread to which this message belongs. Defaults to parent thread."
- OpenAI compatible
+ OpenAI compatible
example: "thread_asdf"
assistant_id:
type: string
description: |
"Identifier of the assistant involved in the message. Defaults to parent thread."
- OpenAI compatible
+ OpenAI compatible
example: jan
role:
type: string
@@ -44,7 +44,7 @@ components:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
+ OpenAI compatible
content:
type: array
items:
@@ -55,7 +55,7 @@ components:
description: |
"Type of content, e.g., 'text'."
- OpenAI compatible
+ OpenAI compatible
text:
type: object
properties:
@@ -64,7 +64,7 @@ components:
description: |
"Text content of the message."
- OpenAI compatible
+ OpenAI compatible
example: "Hi!?"
annotations:
type: array
@@ -73,14 +73,14 @@ components:
description: |
"Annotations for the text content, if any."
- OpenAI compatible
+ OpenAI compatible
example: []
metadata:
type: object
description: |
"Metadata associated with the message, defaults to an empty object."
- OpenAI compatible
+ OpenAI compatible
example: {}
GetMessageResponse:
diff --git a/docs/openapi/specs/models.yaml b/docs/openapi/specs/models.yaml
index b4a5937b9..fdb9e1f9a 100644
--- a/docs/openapi/specs/models.yaml
+++ b/docs/openapi/specs/models.yaml
@@ -120,14 +120,14 @@ components:
description: |
"The identifier of the model."
- OpenAI compatible
+ OpenAI compatible
example: "zephyr-7b"
object:
type: string
description: |
"The type of the object, indicating it's a model."
- OpenAI compatible
+ OpenAI compatible
default: "model"
created:
type: integer
@@ -135,14 +135,14 @@ components:
description: |
"Unix timestamp representing the creation time of the model."
- OpenAI compatible
+ OpenAI compatible
example: "1253935178"
owned_by:
type: string
description: |
"The entity that owns the model."
- OpenAI compatible
+ OpenAI compatible
example: "_"
GetModelResponse:
diff --git a/docs/openapi/specs/threads.yaml b/docs/openapi/specs/threads.yaml
index f071d14a6..578e1ecdc 100644
--- a/docs/openapi/specs/threads.yaml
+++ b/docs/openapi/specs/threads.yaml
@@ -8,14 +8,14 @@ components:
description: |
"The identifier of the thread, defaults to foldername."
- OpenAI compatible
+ OpenAI compatible
example: thread_....
object:
type: string
description: |
"Type of the object, defaults to thread."
- OpenAI compatible
+ OpenAI compatible
example: thread
title:
type: string
@@ -63,14 +63,14 @@ components:
description: |
"Unix timestamp representing the creation time of the thread, defaults to file creation time."
- OpenAI compatible
+ OpenAI compatible
example: 1231231
metadata:
type: object
description: |
"Metadata associated with the thread, defaults to an empty object."
- OpenAI compatible
+ OpenAI compatible
example: {}
GetThreadResponse:
@@ -135,14 +135,14 @@ components:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
+ OpenAI compatible
enum: ["user", "assistant"]
content:
type: string
description: |
"Text content of the message."
- OpenAI compatible
+ OpenAI compatible
file_ids:
type: array
items:
@@ -150,7 +150,7 @@ components:
description: |
"Array of file IDs associated with the message, if any."
- OpenAI compatible
+ OpenAI compatible
ModifyThreadResponse:
type: object
From cd32b09b2c7047c9beb2a7c823dda55305c70eb8 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 11:51:21 +0900
Subject: [PATCH 09/11] docs: change jan label
---
docs/openapi/jan.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index de01e271b..445daf8a4 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -57,7 +57,7 @@ paths:
summary: Create chat completion
description: |
- and Jan specified
+ and Jan
Creates a model response for the given chat conversation.
requestBody:
From fc9ce395f615bb83b4bb5bf2ac139859f814eb2f Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Thu, 30 Nov 2023 10:27:04 +0900
Subject: [PATCH 10/11] docs: new version API reference
---
docs/openapi/jan.yaml | 128 ++++++------------------------
docs/openapi/specs/assistant.yaml | 59 ++++++++++++++
docs/openapi/specs/chat.yaml | 18 +----
docs/openapi/specs/messages.yaml | 18 +----
docs/openapi/specs/models.yaml | 4 -
docs/openapi/specs/threads.yaml | 19 ++---
docs/src/styles/base.scss | 13 +++
7 files changed, 105 insertions(+), 154 deletions(-)
create mode 100644 docs/openapi/specs/assistant.yaml
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 445daf8a4..49c59c5c3 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -23,19 +23,7 @@ tags:
- name: Messages
description: |
Messages capture a conversation's content. This can include the content from LLM responses and other metadata from [chat completions](/specs/chats).
-
- - Users and assistants can send multimedia messages.
-
- - An [OpenAI Message API](https://platform.openai.com/docs/api-reference/messages) compatible endpoint at `localhost:1337/v1/messages`.
-
- - Jan's `messages` API is compatible with [OpenAI's Messages API](https://platform.openai.com/docs/api-reference/messages), with additional methods for managing messages locally.
-
- name: Threads
- description: |
- Threads are conversations between an `assistant` and the user:
- - Users can tweak `model` params and `assistant` behavior within each thread.
- - Users can import and export threads.
- - An [OpenAI Thread API](https://platform.openai.com/docs/api-reference/threads) compatible endpoint at `localhost:1337/v1/threads`.
- name: Assistants
description: Configures and utilizes different AI assistants for varied tasks
x-tagGroups:
@@ -54,12 +42,10 @@ paths:
operationId: createChatCompletion
tags:
- Chat
- summary: Create chat completion
+ summary: |
+ Create chat completion
description: |
-
- and Jan
-
- Creates a model response for the given chat conversation.
+ Creates a model response for the given chat conversation. Equivalent to OpenAI's create chat completion.
requestBody:
content:
application/json:
@@ -93,12 +79,9 @@ paths:
operationId: listModels
tags:
- Models
-
summary: List models
description: |
-
-
- Lists the currently available models, and provides basic information about each one such as the owner and availability.
+ Lists the currently available models, and provides basic information about each one such as the owner and availability. Equivalent to OpenAI's list model.
responses:
"200":
description: OK
@@ -116,8 +99,6 @@ paths:
- Models
summary: Download model
description: |
- Jan
-
Download a model.
responses:
"200":
@@ -137,9 +118,7 @@ paths:
- Models
summary: Retrieve model
description: |
-
-
- Get a model instance, providing basic information about the model such as the owner and permissioning.
+ Get a model instance, providing basic information about the model such as the owner and permissioning. Equivalent to OpenAI's retrieve model.
parameters:
- in: path
name: model_id
@@ -150,8 +129,6 @@ paths:
example: zephyr-7b
description: |
The ID of the model to use for this request
-
- OpenAI compatible
responses:
"200":
description: OK
@@ -169,9 +146,7 @@ paths:
- Models
summary: Delete model
description: |
-
-
- Delete a model.
+ Delete a model. Equivalent to OpenAI's delete model.
parameters:
- in: path
name: model
@@ -181,8 +156,6 @@ paths:
example: zephyr-7b
description: |
The model to delete
-
- OpenAI compatible
responses:
"200":
description: OK
@@ -201,8 +174,6 @@ paths:
- Models
summary: Start model
description: |
- Jan
-
Starts an imported model. Loads the model into V/RAM.
parameters:
- in: path
@@ -232,8 +203,6 @@ paths:
- Models
summary: Stop model
description: |
- Jan
-
Stop an imported model.
parameters:
- in: path
@@ -264,9 +233,7 @@ paths:
- Threads
summary: Create thread
description: |
-
-
- Create a thread
+ Create a thread. Equivalent to OpenAI's create thread.
requestBody:
required: false
content:
@@ -307,8 +274,6 @@ paths:
- Threads
summary: List threads
description: |
- Jan
-
Retrieves a list of all threads available in the system.
responses:
"200":
@@ -344,9 +309,7 @@ paths:
- Threads
summary: Retrieve thread
description: |
-
-
- Retrieves detailed information about a specific thread using its thread_id.
+ Retrieves detailed information about a specific thread using its thread_id. Equivalent to OpenAI's retrieve thread.
parameters:
- in: path
name: thread_id
@@ -357,7 +320,6 @@ paths:
description: |
The ID of the thread to retrieve.
- OpenAI compatible
responses:
"200":
description: Thread details retrieved successfully
@@ -375,9 +337,7 @@ paths:
- Threads
summary: Modify thread
description: |
-
-
- Modifies a thread
+ Modifies a thread. Equivalent to OpenAI's modify thread.
parameters:
- in: path
name: thread_id
@@ -388,7 +348,6 @@ paths:
description: |
The ID of the thread to be modified.
- OpenAI compatible
requestBody:
required: false
content:
@@ -430,9 +389,7 @@ paths:
- Threads
summary: Delete thread
description: |
-
-
- Delete a thread
+ Delete a thread. Equivalent to OpenAI's delete thread.
parameters:
- in: path
name: thread_id
@@ -443,7 +400,6 @@ paths:
description: |
The ID of the thread to be deleted.
- OpenAI compatible
responses:
"200":
description: Thread deleted successfully
@@ -464,7 +420,7 @@ paths:
- Threads
summary: Get Thread.Assistants
description: |
- Jan
+
Can achieve this goal by calling Get thread API
parameters:
@@ -494,7 +450,7 @@ paths:
- Threads
summary: Modify Thread.Assistants
description: |
- Jan
+
Can achieve this goal by calling Modify Assistant API with thread.assistant[]
@@ -505,7 +461,7 @@ paths:
- Threads
summary: List Thread.Messages
description: |
- Jan
+
Can achieve this goal by calling Get Thread API
parameters:
@@ -536,9 +492,7 @@ paths:
- Messages
summary: List messages
description: |
-
-
- Retrieves all messages from the given thread.
+ Retrieves all messages from the given thread. Equivalent to OpenAI's list messages.
parameters:
- in: path
name: thread_id
@@ -549,7 +503,6 @@ paths:
description: |
The ID of the thread from which to retrieve messages.
- OpenAI compatible
responses:
"200":
description: List of messages retrieved successfully
@@ -568,9 +521,7 @@ paths:
- Messages
summary: Create message
description: |
-
-
- Create a message
+ Create a message. Equivalent to OpenAI's list messages.
parameters:
- in: path
name: thread_id
@@ -581,7 +532,6 @@ paths:
description: |
The ID of the thread to which the message will be posted.
- OpenAI compatible
requestBody:
required: true
content:
@@ -594,7 +544,7 @@ paths:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
+ OpenAI compatible
example: "user"
enum: ["user", "assistant"]
content:
@@ -602,7 +552,7 @@ paths:
description: |
"Text content of the message."
- OpenAI compatible
+ OpenAI compatible
example: "How does AI work? Explain it in simple terms."
required:
- role
@@ -631,9 +581,7 @@ paths:
- Messages
summary: Retrieve message
description: |
-
-
- Retrieve a specific message from a thread using its thread_id and message_id.
+ Retrieve a specific message from a thread using its thread_id and message_id. Equivalent to OpenAI's retrieve messages.
parameters:
- in: path
name: thread_id
@@ -644,7 +592,6 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
- in: path
name: message_id
required: true
@@ -654,7 +601,6 @@ paths:
description: |
The ID of the message to retrieve.
- OpenAI compatible
responses:
"200":
description: OK
@@ -673,11 +619,10 @@ paths:
operationId: listMessageFiles
tags:
- Messages
- summary: List message files
+ summary: |
+ List message files
description: |
-
-
- Returns a list of message files.
+ Returns a list of message files. Equivalent to OpenAI's list message files.
parameters:
- in: path
name: thread_id
@@ -688,7 +633,6 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
- in: path
name: message_id
required: true
@@ -698,7 +642,6 @@ paths:
description: |
The ID of the message whose files are to be listed.
- OpenAI compatible
responses:
"200":
description: List of files retrieved successfully
@@ -719,9 +662,7 @@ paths:
- Messages
summary: Retrieve message file
description: |
-
-
- Retrieves a file associated with a specific message in a thread.
+ Retrieves a file associated with a specific message in a thread. Equivalent to OpenAI's retrieve message file.
parameters:
- in: path
name: thread_id
@@ -732,7 +673,6 @@ paths:
description: |
The ID of the thread containing the message.
- OpenAI compatible
- in: path
name: message_id
required: true
@@ -742,7 +682,6 @@ paths:
description: |
The ID of the message associated with the file.
- OpenAI compatible
- in: path
name: file_id
required: true
@@ -752,7 +691,6 @@ paths:
description: |
The ID of the file to retrieve.
- OpenAI compatible
responses:
"200":
description: File retrieved successfully
@@ -771,11 +709,7 @@ x-webhooks:
post:
summary: The model object
description: |
-
-
- Describe a model offering that can be used with the API.
-
-
+ Describe a model offering that can be used with the API. Equivalent to OpenAI's model object.
operationId: ModelObject
tags:
- Models
@@ -784,14 +718,11 @@ x-webhooks:
application/json:
schema:
$ref: 'specs/models.yaml#/components/schemas/ModelObject'
-
MessageObject:
post:
summary: The message object
description: |
-
-
- Information about a message in the thread
+ Information about a message in the thread. Equivalent to OpenAI's message object.
operationId: MessageObject
tags:
- Messages
@@ -800,19 +731,10 @@ x-webhooks:
application/json:
schema:
$ref: 'specs/messages.yaml#/components/schemas/MessageObject'
-
ThreadObject:
post:
summary: The thread object
- description: |
- and Jan
-
- Each `thread` folder contains a `thread.json` file, which is a representation of a thread.
-
- `thread.json` contains metadata and model parameter overrides.
-
- There are no required fields.
-
+ description: Represents a thread that contains messages. Equivalent to OpenAI's thread object.
operationId: ThreadObject
tags:
- Threads
diff --git a/docs/openapi/specs/assistant.yaml b/docs/openapi/specs/assistant.yaml
new file mode 100644
index 000000000..95b4cd22d
--- /dev/null
+++ b/docs/openapi/specs/assistant.yaml
@@ -0,0 +1,59 @@
+AssistantObject:
+ type: object
+ properties:
+ avatar:
+ type: string
+ description: "URL of the assistant's avatar. Jan-specific property."
+ example: "https://lala.png"
+ id:
+ type: string
+ description: "The identifier of the assistant."
+ example: "asst_abc123"
+ object:
+ type: string
+ description: "Type of the object, indicating it's an assistant."
+ default: "assistant"
+ version:
+ type: integer
+ description: "Version number of the assistant."
+ example: 1
+ created_at:
+ type: integer
+ format: int64
+ description: "Unix timestamp representing the creation time of the assistant."
+ name:
+ type: string
+ description: "Name of the assistant."
+ example: "Math Tutor"
+ description:
+ type: string
+ description: "Description of the assistant. Can be null."
+ models:
+ type: array
+ description: "List of models associated with the assistant. Jan-specific property."
+ items:
+ type: object
+ properties:
+ model_id:
+ type: string
+ # Additional properties for models can be added here
+ events:
+ type: object
+ description: "Event subscription settings for the assistant."
+ properties:
+ in:
+ type: array
+ items:
+ type: string
+ out:
+ type: array
+ items:
+ type: string
+ # If there are specific event types, they can be detailed here
+ metadata:
+ type: object
+ description: "Metadata associated with the assistant."
+ required:
+ - name
+ - models
+ - events
\ No newline at end of file
diff --git a/docs/openapi/specs/chat.yaml b/docs/openapi/specs/chat.yaml
index db738aee5..05444c444 100644
--- a/docs/openapi/specs/chat.yaml
+++ b/docs/openapi/specs/chat.yaml
@@ -59,8 +59,6 @@ components:
type: arrays
description: |
Contains input data or prompts for the model to process
-
- OpenAI compatible
example:
[
{ "content": "Hello there :wave:", "role": "assistant" },
@@ -71,43 +69,31 @@ components:
example: model-zephyr-7B
description: |
Specifies the model being used for inference or processing tasks
-
- OpenAI compatible
stream:
type: boolean
default: true
description: |
Enables continuous output generation, allowing for streaming of model responses
-
- OpenAI compatible
max_tokens:
type: number
default: 2048
description: |
The maximum number of tokens the model will generate in a single response
-
- OpenAI compatible
stop:
type: arrays
example: ["hello"]
description: |
Defines specific tokens or phrases at which the model will stop generating further output
-
- OpenAI compatible
frequency_penalty:
type: number
default: 0
description: |
Adjusts the likelihood of the model repeating words or phrases in its output
-
- OpenAI compatible
presence_penalty:
type: number
default: 0
description: |
Influences the generation of new and varied concepts in the model's output
-
- OpenAI compatible
temperature:
type: number
default: 0.7
@@ -115,8 +101,6 @@ components:
max: 1
description: |
Controls the randomness of the model's output
-
- OpenAI compatible
top_p:
type: number
default: 0.95
@@ -125,7 +109,7 @@ components:
description: |
Set probability threshold for more relevant outputs
- OpenAI compatible
+
ChatCompletionResponse:
type: object
diff --git a/docs/openapi/specs/messages.yaml b/docs/openapi/specs/messages.yaml
index d4f61117e..b99fc4221 100644
--- a/docs/openapi/specs/messages.yaml
+++ b/docs/openapi/specs/messages.yaml
@@ -7,36 +7,26 @@ components:
type: string
description: |
"Sequential or UUID identifier of the message."
-
- OpenAI compatible
example: 0
object:
type: string
description: |
"Type of the object, defaults to 'thread.message'."
-
- OpenAI compatible
example: thread.message
created_at:
type: integer
format: int64
description: |
"Unix timestamp representing the creation time of the message."
-
- OpenAI compatible
thread_id:
type: string
description: |
"Identifier of the thread to which this message belongs. Defaults to parent thread."
-
- OpenAI compatible
example: "thread_asdf"
assistant_id:
type: string
description: |
"Identifier of the assistant involved in the message. Defaults to parent thread."
-
- OpenAI compatible
example: jan
role:
type: string
@@ -44,7 +34,6 @@ components:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
content:
type: array
items:
@@ -55,7 +44,7 @@ components:
description: |
"Type of content, e.g., 'text'."
- OpenAI compatible
+
text:
type: object
properties:
@@ -63,8 +52,6 @@ components:
type: string
description: |
"Text content of the message."
-
- OpenAI compatible
example: "Hi!?"
annotations:
type: array
@@ -72,15 +59,12 @@ components:
type: string
description: |
"Annotations for the text content, if any."
-
- OpenAI compatible
example: []
metadata:
type: object
description: |
"Metadata associated with the message, defaults to an empty object."
- OpenAI compatible
example: {}
GetMessageResponse:
diff --git a/docs/openapi/specs/models.yaml b/docs/openapi/specs/models.yaml
index fdb9e1f9a..aa5cc4155 100644
--- a/docs/openapi/specs/models.yaml
+++ b/docs/openapi/specs/models.yaml
@@ -120,14 +120,12 @@ components:
description: |
"The identifier of the model."
- OpenAI compatible
example: "zephyr-7b"
object:
type: string
description: |
"The type of the object, indicating it's a model."
- OpenAI compatible
default: "model"
created:
type: integer
@@ -135,14 +133,12 @@ components:
description: |
"Unix timestamp representing the creation time of the model."
- OpenAI compatible
example: "1253935178"
owned_by:
type: string
description: |
"The entity that owns the model."
- OpenAI compatible
example: "_"
GetModelResponse:
diff --git a/docs/openapi/specs/threads.yaml b/docs/openapi/specs/threads.yaml
index 578e1ecdc..c009381e3 100644
--- a/docs/openapi/specs/threads.yaml
+++ b/docs/openapi/specs/threads.yaml
@@ -8,26 +8,24 @@ components:
description: |
"The identifier of the thread, defaults to foldername."
- OpenAI compatible
example: thread_....
object:
type: string
description: |
"Type of the object, defaults to thread."
- OpenAI compatible
example: thread
title:
type: string
description: |
"A brief summary or description of the thread, defaults to an empty string."
- Jan
+
example: "funny physics joke"
assistants:
type: array
description: |
- Jan
+
items:
properties:
assistant_id:
@@ -35,7 +33,7 @@ components:
description: |
The identifier of assistant, defaults to "jan"
- Jan
+
example: jan
model:
type: object
@@ -43,34 +41,32 @@ components:
id:
type: string
description: |
- Jan
+
example: ...
settings:
type: object
description: |
Defaults to and overrides assistant.json's "settings" (and if none, then model.json "settings")
- Jan
+
parameters:
type: object
description: |
Defaults to and overrides assistant.json's "parameters" (and if none, then model.json "parameters")
- Jan
+
created:
type: integer
format: int64
description: |
"Unix timestamp representing the creation time of the thread, defaults to file creation time."
- OpenAI compatible
example: 1231231
metadata:
type: object
description: |
"Metadata associated with the thread, defaults to an empty object."
- OpenAI compatible
example: {}
GetThreadResponse:
@@ -135,14 +131,12 @@ components:
description: |
"Role of the sender, either 'user' or 'assistant'."
- OpenAI compatible
enum: ["user", "assistant"]
content:
type: string
description: |
"Text content of the message."
- OpenAI compatible
file_ids:
type: array
items:
@@ -150,7 +144,6 @@ components:
description: |
"Array of file IDs associated with the message, if any."
- OpenAI compatible
ModifyThreadResponse:
type: object
diff --git a/docs/src/styles/base.scss b/docs/src/styles/base.scss
index a59df6f73..b94081d66 100644
--- a/docs/src/styles/base.scss
+++ b/docs/src/styles/base.scss
@@ -1,4 +1,5 @@
@layer base {
+
html[data-theme="light"] {
--ifm-background-color: white;
--ifm-color-primary: #2563eb; /* New Primary Blue */
@@ -39,4 +40,16 @@
text-decoration: none;
}
}
+ compatible-label {
+ display: inline-block;
+ padding: 2px 8px;
+ margin: 0;
+ background-color: #228B22;
+ color: #000;
+ font-size: 13px;
+ vertical-align: middle;
+ line-height: 1.6;
+ border-radius: 4px;
+ font-weight: var(--ifm-font-weight-bold);
+}
}
From 668078c59737c7e85f9b6981ef2b75ee989b6570 Mon Sep 17 00:00:00 2001
From: hieu-jan <150573299+hieu-jan@users.noreply.github.com>
Date: Thu, 30 Nov 2023 10:34:42 +0900
Subject: [PATCH 11/11] docs: change JAN_URL to localhost:1337
---
docs/openapi/jan.yaml | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml
index 49c59c5c3..43c07cb3c 100644
--- a/docs/openapi/jan.yaml
+++ b/docs/openapi/jan.yaml
@@ -256,7 +256,7 @@ paths:
x-codeSamples:
- lang: "cURL"
source: |
- curl -X POST {JAN_URL}/v1/threads \
+ curl -X POST http://localhost:1337/v1/threads \
-H "Content-Type: application/json" \
-d '{
"messages": [{
@@ -299,7 +299,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads \
+ curl http://localhost:1337/v1/threads \
-H "Content-Type: application/json" \
/threads/{thread_id}:
@@ -330,7 +330,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}
+ curl http://localhost:1337/v1/threads/{thread_id}
post:
operationId: modifyThread
tags:
@@ -370,7 +370,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl -X POST {JAN_URL}/v1/threads/{thread_id} \
+ curl -X POST http://localhost:1337/v1/threads/{thread_id} \
-H "Content-Type: application/json" \
-d '{
"messages": [{
@@ -382,7 +382,6 @@ paths:
"content": "How does AI work? Explain it in simple terms."
}]
}'
-
delete:
operationId: deleteThread
tags:
@@ -399,7 +398,6 @@ paths:
example: thread_abc123
description: |
The ID of the thread to be deleted.
-
responses:
"200":
description: Thread deleted successfully
@@ -410,8 +408,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl -X DELETE {JAN_URL}/v1/threads/{thread_id}
-
+ curl -X DELETE http://localhost:1337/v1/threads/{thread_id}
/threads/{thread_id}/assistants:
get:
@@ -420,8 +417,6 @@ paths:
- Threads
summary: Get Thread.Assistants
description: |
-
-
Can achieve this goal by calling Get thread API
parameters:
- in: path
@@ -441,7 +436,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}/assistants
+ curl http://localhost:1337/v1/threads/{thread_id}/assistants
/threads/{thread_id}/assistants/{assistants_id}:
post:
@@ -461,8 +456,6 @@ paths:
- Threads
summary: List Thread.Messages
description: |
-
-
Can achieve this goal by calling Get Thread API
parameters:
- in: path
@@ -482,7 +475,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}
+ curl http://localhost:1337/v1/threads/{thread_id}
### MESSAGES
/threads/{thread_id}/messages:
@@ -502,7 +495,6 @@ paths:
example: thread_abc123
description: |
The ID of the thread from which to retrieve messages.
-
responses:
"200":
description: List of messages retrieved successfully
@@ -513,7 +505,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}/messages \
+ curl http://localhost:1337/v1/threads/{thread_id}/messages \
-H "Content-Type: application/json"
post:
operationId: createMessage
@@ -531,7 +523,6 @@ paths:
example: thread_abc123
description: |
The ID of the thread to which the message will be posted.
-
requestBody:
required: true
content:
@@ -567,7 +558,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl -X POST {JAN_URL}/v1/threads/{thread_id}/messages \
+ curl -X POST http://localhost:1337/v1/threads/{thread_id}/messages \
-H "Content-Type: application/json" \
-d '{
"role": "user",
@@ -611,7 +602,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id} \
+ curl http://localhost:1337/v1/threads/{thread_id}/messages/{message_id} \
-H "Content-Type: application/json"
/threads/{thread_id}/messages/{message_id}/files:
@@ -652,7 +643,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id}/files \
+ curl http://localhost:1337/v1/threads/{thread_id}/messages/{message_id}/files \
-H "Content-Type: application/json"
/threads/{thread_id}/messages/{message_id}/files/{file_id}:
@@ -701,7 +692,7 @@ paths:
x-codeSamples:
- lang: "curl"
source: |
- curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id}/files/{file_id} \
+ curl http://localhost:1337/v1/threads/{thread_id}/messages/{message_id}/files/{file_id} \
-H "Content-Type: application/json"
x-webhooks: