Skip to content

Commit

Permalink
Migrate Model definitions to Swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-menlo committed Nov 19, 2023
1 parent c8fd780 commit a900ad7
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 14 deletions.
6 changes: 5 additions & 1 deletion docs/docs/specs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Models
---

import ApiSchema from '@theme/ApiSchema';

:::warning

Draft Specification: functionality has not been implemented yet.
Expand All @@ -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
Expand Down Expand Up @@ -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.

<ApiSchema example pointer="#/components/schemas/Model" />;

```json
// ./models/zephr/zephyr-7b-beta-Q4_K_M.json
{
Expand Down
123 changes: 110 additions & 13 deletions docs/openapi/jan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
type: string
description: The object type, which is always "model".
enum: [model]
owned_by:
description: The Unix timestamp (in seconds) for when the model was created
state:
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
Expand Down

0 comments on commit a900ad7

Please sign in to comment.