Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 69c371b

Browse files
authored
Merge pull request #630 from janhq/readme
Update the README.md
2 parents 4fe8eb8 + ab19475 commit 69c371b

File tree

6 files changed

+299
-230
lines changed

6 files changed

+299
-230
lines changed

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### Repo Structure
2+
```
3+
# Entity Definitions
4+
domain/ # This is the core directory where the domains are defined.
5+
abstracts/ # Abstract base classes for common attributes and methods.
6+
models/ # Domain interface definitions, e.g. model, assistant.
7+
repositories/ # Extensions abstract and interface
8+
9+
# Business Rules
10+
usecases/ # Application logic
11+
assistants/ # CRUD logic (invokes dtos, entities).
12+
chat/ # Logic for chat functionalities.
13+
models/ # Logic for model operations.
14+
15+
# Adapters & Implementations
16+
infrastructure/ # Implementations for Cortex interactions
17+
commanders/ # CLI handlers
18+
models/
19+
questions/ # CLI installation UX
20+
shortcuts/ # CLI chained syntax
21+
types/
22+
usecases/ # Invokes UseCases
23+
24+
controllers/ # Nest controllers and HTTP routes
25+
assistants/ # Invokes UseCases
26+
chat/ # Invokes UseCases
27+
models/ # Invokes UseCases
28+
29+
database/ # Database providers (mysql, sqlite)
30+
31+
# Framework specific object definitions
32+
dtos/ # DTO definitions (data transfer & validation)
33+
entities/ # TypeORM entity definitions (db schema)
34+
35+
# Providers
36+
providers/cortex # Cortex [server] provider (a core extension)
37+
repositories/extensions # Extension provider (core & external extensions)
38+
39+
extensions/ # External extensions
40+
command.module.ts # CLI Commands List
41+
main.ts # Entrypoint
42+
```

README.md

Lines changed: 78 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
1-
# Cortex Monorepo
1+
# Cortex - CLI
2+
<p align="center">
3+
<img alt="cortex-cpplogo" src="https://raw.githubusercontent.com/janhq/cortex/dev/assets/cortex-banner.png">
4+
</p>
25

3-
# Installation
6+
<p align="center">
7+
<a href="https://jan.ai/cortex">Documentation</a> - <a href="https://jan.ai/api-reference">API Reference</a>
8+
- <a href="https://github.com/janhq/cortex/releases">Changelog</a> - <a href="https://github.com/janhq/cortex/issues">Bug reports</a> - <a href="https://discord.gg/AsJ8krTT3N">Discord</a>
9+
</p>
10+
11+
> ⚠️ **Cortex is currently in Development**: Expect breaking changes and bugs!
12+
13+
## About
14+
Cortex is an openAI-compatible local AI server that developers can use to build LLM apps. It is packaged with a Docker-inspired command-line interface and a Typescript client library. It can be used as a standalone server, or imported as a library.
15+
16+
Cortex currently supports two inference engines:
17+
18+
- Llama.cpp
19+
- TensorRT-LLM
20+
21+
> Read more about Cortex at https://jan.ai/cortex
22+
23+
## Quicklinks
24+
**Cortex**:
25+
- [Website](https://jan.ai/)
26+
- [GitHub](https://github.com/janhq/cortex)
27+
- [User Guides](https://jan.ai/cortex)
28+
- [API reference](https://jan.ai/api-reference)
429

530
## Prerequisites
631

@@ -12,10 +37,9 @@ Before installation, ensure that you have installed the following:
1237
- **NPM**: Needed to manage packages.
1338
- **CPU Instruction Sets**: Available for download from the [Cortex GitHub Releases](https://github.com/janhq/cortex/releases) page.
1439

15-
<aside>
16-
💡 The **CPU instruction sets** are not required for the initial installation of Cortex. This dependency will be automatically installed during the Cortex initialization if they are not already on your system.
1740

18-
</aside>
41+
>💡 The **CPU instruction sets** are not required for the initial installation of Cortex. This dependency will be automatically installed during the Cortex initialization if they are not already on your system.
42+
1943

2044
### **Hardware**
2145

@@ -37,88 +61,42 @@ Ensure that your system meets the following requirements to run Cortex:
3761

3862
- **Disk**: At least 10GB for app and model download.
3963

40-
## Cortex Installation
41-
42-
To install Cortex, follow the steps below:
43-
44-
### Step 1: Install Cortex
45-
46-
Run the following command to install Cortex globally on your machine:
47-
48-
```bash
49-
# Install using NPM globally
64+
## Quickstart
65+
To install Cortex CLI, follow the steps below:
66+
1. Install the Cortex NPM package globally:
67+
``` bash
5068
npm i -g @janhq/cortex
5169
```
5270

53-
### Step 2: Verify the Installation
54-
55-
After installation, you can verify that Cortex is installed correctly by getting help information.
56-
57-
```bash
58-
# Get the help information
59-
cortex -h
60-
```
61-
62-
### Step 3: Initialize Cortex
63-
64-
Once verified, you need to initialize the Cortex engine.
65-
66-
1. Initialize the Cortex engine:
67-
68-
```
71+
2. Initialize a compatible engine:
72+
``` bash
6973
cortex init
7074
```
7175

72-
1. Select between `CPU` and `GPU` modes.
73-
74-
```bash
75-
? Select run mode (Use arrow keys)
76-
> CPU
77-
GPU
78-
```
79-
80-
2. Select between GPU types.
81-
82-
```bash
83-
? Select GPU types (Use arrow keys)
84-
> Nvidia
85-
Others (Vulkan)
86-
```
76+
3. Download a GGUF model from Hugging Face:
77+
``` bash
78+
# Pull a model most compatible with your hardware
79+
cortex pull llama3
8780

88-
3. Select CPU instructions (will be deprecated soon).
81+
# Pull a specific variant with `repo_name:branch`
82+
cortex pull llama3:7b
8983

90-
```bash
91-
? Select CPU instructions (Use arrow keys)
92-
> AVX2
93-
AVX
94-
AVX-512
84+
# Pull a model with the HuggingFace `model_id`
85+
cortex pull microsoft/Phi-3-mini-4k-instruct-gguf
9586
```
96-
97-
1. Cortex will download the required CPU instruction sets if you choose `CPU` mode. If you choose `GPU` mode, Cortex will download the necessary dependencies to use your GPU.
98-
2. Once downloaded, Cortex is ready to use!
99-
100-
### Step 4: Pull a model
101-
102-
From HuggingFace
103-
104-
```bash
105-
cortex pull janhq/phi-3-medium-128k-instruct-GGUF
87+
4. Load the model:
88+
``` bash
89+
cortex models start llama3:7b
10690
```
10791

108-
From Jan Hub (TBD)
109-
110-
```bash
111-
cortex pull llama3
92+
5. Start chatting with the model:
93+
``` bash
94+
cortex chat tell me a joke
11295
```
11396

114-
### Step 5: Chat
115-
116-
```bash
117-
cortex run janhq/phi-3-medium-128k-instruct-GGUF
118-
```
11997

12098
## Run as an API server
121-
99+
To run Cortex as an API server:
122100
```bash
123101
cortex serve
124102
```
@@ -135,18 +113,40 @@ To install Cortex from the source, follow the steps below:
135113
npx nest build
136114
```
137115

138-
1. Make the `command.js` executable:
116+
4. Make the `command.js` executable:
139117

140118
```bash
141119
chmod +x '[path-to]/cortex/cortex-js/dist/src/command.js'
142120
```
143121

144-
1. Link the package globally:
122+
5. Link the package globally:
145123

146124
```bash
147125
npm link
148126
```
149127

128+
## Cortex CLI Command
129+
The following CLI commands are currently available:
130+
> ⚠️ **Cortex is currently in Development**: More commands will be added soon!
131+
132+
```bash
133+
134+
serve Providing API endpoint for Cortex backend
135+
chat Send a chat request to a model
136+
init|setup Init settings and download cortex's dependencies
137+
ps Show running models and their status
138+
kill Kill running cortex processes
139+
pull|download Download a model. Working with HuggingFace model id.
140+
run [options] EXPERIMENTAL: Shortcut to start a model and chat
141+
models Subcommands for managing models
142+
models list List all available models.
143+
models pull Download a specified model.
144+
models remove Delete a specified model.
145+
models get Retrieve the configuration of a specified model.
146+
models start Start a specified model.
147+
models stop Stop a specified model.
148+
models update Update the configuration of a specified model.
149+
```
150150
## Uninstall Cortex
151151
152152
Run the following command to uninstall Cortex globally on your machine:
@@ -155,3 +155,7 @@ Run the following command to uninstall Cortex globally on your machine:
155155
# Uninstall globally using NPM
156156
npm uninstall -g @janhq/cortex
157157
```
158+
## Contact Support
159+
- For support, please file a GitHub ticket.
160+
- For questions, join our Discord [here](https://discord.gg/FTk2MvZwJH).
161+
- For long-form inquiries, please email [hello@jan.ai](mailto:hello@jan.ai).

cortex-cpp/CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Repo Structure
2+
3+
```
4+
.
5+
├── common # Common libraries or shared resources
6+
├── controllers # Controller scripts or modules for managing interactions
7+
├── cortex-common # Shared components across different cortex modules
8+
├── cortex-cpp-deps # Dependencies specific to the cortex-cpp module
9+
├── engines # Different processing or computational engines
10+
├── examples # Example scripts or applications demonstrating usage
11+
├── test # Test scripts and testing frameworks
12+
└── utils # Utility scripts and helper functions
13+
14+
```

0 commit comments

Comments
 (0)