Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #185 from janhq/pena-patch
Browse files Browse the repository at this point in the history
Update Cortex Docs
  • Loading branch information
irfanpena authored Aug 16, 2024
2 parents 603a62d + 46c2729 commit e39582f
Show file tree
Hide file tree
Showing 22 changed files with 7,272 additions and 72 deletions.
5 changes: 3 additions & 2 deletions docs/architecture.md → docs/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ The following guide details Cortex's core components, providing insights and ins

## Architecture

![Architecture](/img/docs/architecture.png)
import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/Architecture.excalidraw"} />

### Main Components

Expand Down Expand Up @@ -119,7 +121,6 @@ sequenceDiagram
Chat Controller/Service -->> Model Entity: findOne()
Cortex->>Model Entity: Store the model data
Chat Controller/Service -->> Extension Repository: findAll()
%% Responses
Extension Repository ->> Chat Controller/Service: Response stream
Chat Controller/Service ->> Chat Controller/Service: Formatted response/stream
Expand Down
6 changes: 5 additions & 1 deletion docs/benchmarking-architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ slug: "benchmarking-architecture"
:::

## Architecture
![benchmark-architecture](/img/docs/benchmark-architecture.png)

import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/benchmarking.excalidraw"} />

The benchmarking capability comprises several key components:
1. **User Devices**:
- **Workstation, Desktop, Server**: These devices collect and send benchmarking data directly to the Supabase Backend in the Jan Cloud.
Expand Down
7 changes: 5 additions & 2 deletions docs/cortex-llamacpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ You can download precompiled models from the [Cortex Hub](https://huggingface.co

## Architecture

![Cortex llamacpp architecture](/img/docs/llama-cpp1.png)
import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/llamacpp1.excalidraw"} />

### Main Components

Expand All @@ -145,7 +147,8 @@ You can download precompiled models from the [Cortex Hub](https://huggingface.co

### Communication Protocols

![Cortex llamacpp architecture](/img/docs/llama-cpp2.png)
<Diagram diagramPath={"/diagrams/llamacpp2.excalidraw"} />

The diagram above illustrates how `cortex.llamacpp` communication protocol works:

- `Streaming`: Responses are processed and returned one token at a time.
Expand Down
4 changes: 3 additions & 1 deletion docs/cortex-onnx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ All the interfaces above contain the following parameters:


## Architecture
![onnx Architecture](/img/docs/onnx-1.png)
import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/ONNX.excalidraw"} />

### Main Components
These are the main components that interact to provide an API for `inference` tasks using the `onnxruntime-genai` library:
Expand Down
6 changes: 5 additions & 1 deletion docs/cortex-tensorrt-llm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ All the interfaces above contain the following parameters:


## Architecture
![tensorrt-llm Architecture](/img/docs/trt1.png)

import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/TensorRT-LLM.excalidraw"} />

These are the main components that interact to provide an API for `inference` tasks using the `tensorrt-llm`:
1. **cortex-cpp**: Acts as an intermediary between `cortex-js` and the inference engine (`cortex.tensorrt-llm`). It processes incoming HTTP requests and forwards them to the appropriate components for handling. Once a response is generated, it sends it back to `cortex-js`.

Expand Down
23 changes: 12 additions & 11 deletions docs/installation/linux.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ npm i -g cortexso
You can also install Cortex using the Cortex Installer available on [GitHub Releases](https://github.com/janhq/cortex/releases).
:::

## Uninstall Cortex
```sh
# Uninstall cortex
sudo apt remove cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
:::info
Delete the Cortex data folder located in your home folder.
:::

## Build from Source

1. Clone the Cortex repository [here](https://github.com/janhq/cortex/tree/dev).
Expand Down Expand Up @@ -59,17 +71,6 @@ npm link
# Get the help information
cortex -h
```
## Uninstall Cortex
```sh
# Uninstall cortex
sudo apt remove cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
:::info
Delete the Cortex data folder located in your home folder.
:::

## Prerequisites
### Dependencies
Expand Down
23 changes: 12 additions & 11 deletions docs/installation/mac.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ npm i -g cortexso
:::info
You can also install Cortex using the Cortex Installer available on [GitHub Releases](https://github.com/janhq/cortex/releases).
:::

## Uninstall Cortex
```sh
# Uninstall using Brew
brew uninstall cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
:::info
Delete the Cortex data folder located in your home folder.
:::
## Build from Source

1. Clone the Cortex repository [here](https://github.com/janhq/cortex/tree/dev).
Expand Down Expand Up @@ -51,17 +63,6 @@ npm link
# Get the help information
cortex -h
```
## Uninstall Cortex
```sh
# Uninstall using Brew
brew uninstall cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
:::info
Delete the Cortex data folder located in your home folder.
:::

## Prerequisites

Expand Down
17 changes: 16 additions & 1 deletion docs/installation/windows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ For Windows, Cortex can be installed in two ways:
### Install Cortex
Before installation, make sure that you have met the required [dependencies](#windows) and [hardware](#hardware) to run Cortex.
```sh
# Install using NPM
# Install using winget
winget install cortexso

# Install using NPM (Not Recommended)
npm i -g cortexso
```

### Uninstall Cortex
```sh
# Uninstall using winget
winget uninstall cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
Expand All @@ -44,6 +50,12 @@ Before installation, make sure that you have met the required [dependencies](#wi
# Install using Brew
brew install cortexso

# Install Cortex
sudo apt install openmpi-bin libopenmpi-dev
sudo add-apt-repository ppa:homebrew-computer/main
sudo apt update
sudo apt install cortexso

# Install using NPM (Not Recommended)
npm i -g cortexso

Expand All @@ -55,6 +67,9 @@ npm i -g cortexso
# Uninstall using Brew
brew uninstall cortexso

# Uninstall cortex
sudo apt remove cortexso

# Uninstall using NPM
npm uninstall -g cortexso
```
Expand Down
19 changes: 13 additions & 6 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@ import TabItem from "@theme/TabItem";
# Install using Brew for Mac and Linux
brew install cortexso

# Install using NPM for Windows
npm i -g cortexso
# Install using winger for Windows
winget install cortexso

# Install using Sudo for Linux
sudo add-apt-repository ppa:homebrew-computer/main
sudo apt update
sudo apt install cortexso

```
## Start Cortex Processes and API Server
```sh
# By default the server will be started on port `1337`
cortex
```
## Run a Model
```sh
Expand Down Expand Up @@ -95,11 +105,8 @@ cortex stop
# Show a model and cortex system status
cortex ps

# Fetch telemetry logs to assess the cortex's performance, usage, and health.
# Fetch telemetry logs to assess the cortex's crash.
cortex telemetry

# Show the Cortex logs
cortex logs
```
## Run Different Model Variants
:::info
Expand Down
4 changes: 3 additions & 1 deletion docs/telemetry-architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import TabItem from '@theme/TabItem';
:::

## Architecture
![cortex-architecture.png](/img/docs/telemetry1.png)
import Diagram from "../src/components/Diagram"

<Diagram diagramPath={"/diagrams/Telemetry.excalidraw"} />
The telemetry capability comprises several key components:
1. **Telemetry Collector**: This component gathers telemetry data from the Cortex and exports it to other observability tools for further analysis and monitoring.
2. **Jan Telemetry Server**: This component ingests telemetry data from Cortex. It processes this data and forwards events to Google Logging for further handling.
Expand Down
3 changes: 2 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ const config: Config = {
},
} as ScalarOptions,
],
"docusaurus-plugin-dotenv",
],

scripts: [
Expand Down Expand Up @@ -370,7 +371,7 @@ const config: Config = {
docId: "overview",
label: "Docs",
},
{ to: "/docs/cli", label: "CLI", position: "left" },
// { to: "/docs/cli", label: "CLI", position: "left" },
{ to: "/models", label: "Models", position: "right" },
{
type: "search",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-live-codeblock": "^3.4.0",
"@docusaurus/theme-mermaid": "^3.4.0",
"@excalidraw/excalidraw": "^0.17.6",
"@huggingface/hub": "^0.15.1",
"@mdx-js/react": "3.0.1",
"@radix-ui/react-select": "^2.1.1",
Expand All @@ -32,6 +33,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"docusaurus-plugin-dotenv": "^1.0.1",
"docusaurus-plugin-sass": "^0.2.5",
"framer-motion": "^11.2.12",
"highlight.js": "^11.9.0",
Expand Down
52 changes: 18 additions & 34 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ const sidebars: SidebarsConfig = {
{ type: "doc", id: "chat-completions", label: "Chat Completions" },
{ type: "doc", id: "embeddings", label: "Embeddings" },
{ type: "doc", id: "benchmarking", label: "Benchmarking" },
// CLI
{
type: "html",
value: "CLI",
className: "sidebar-divider",
},
{ type: "doc", id: "cli/cortex", label: "cortex" },
{ type: "doc", id: "cli/chat", label: "cortex chat" },
{ type: "doc", id: "cli/embeddings", label: "cortex embeddings" },
{ type: "doc", id: "cli/presets", label: "cortex presets" },
{ type: "doc", id: "cli/pull", label: "cortex pull" },
{ type: "doc", id: "cli/run", label: "cortex run" },
{ type: "doc", id: "cli/models/index", label: "cortex models" },
{ type: "doc", id: "cli/engines/index", label: "cortex engines" },
{ type: "doc", id: "cli/stop", label: "cortex stop" },
{ type: "doc", id: "cli/ps", label: "cortex ps" },
{ type: "doc", id: "cli/telemetry", label: "cortex telemetry" },
{ type: "doc", id: "cli/benchmark", label: "cortex benchmark" },
// ARCHITECTURE
{
type: "html",
Expand Down Expand Up @@ -149,40 +167,6 @@ const sidebars: SidebarsConfig = {
},
{ type: "doc", id: "troubleshooting", label: "Troubleshooting" },
],
cli: [
{
type: "html",
value: "Usage",
className: "sidebar-divider",
},
{ type: "doc", id: "cli/cortex", label: "cortex" },
{ type: "doc", id: "cli/chat", label: "cortex chat" },
{ type: "doc", id: "cli/embeddings", label: "cortex embeddings" },
{ type: "doc", id: "cli/presets", label: "cortex presets" },
{
type: "html",
value: "Model Operations",
className: "sidebar-divider",
},
{ type: "doc", id: "cli/pull", label: "cortex pull" },
{ type: "doc", id: "cli/run", label: "cortex run" },
{ type: "doc", id: "cli/models/index", label: "cortex models" },
{ type: "doc", id: "cli/engines/index", label: "cortex engines" },
{
type: "html",
value: "System",
className: "sidebar-divider",
},
{ type: "doc", id: "cli/stop", label: "cortex stop" },
{ type: "doc", id: "cli/ps", label: "cortex ps" },
{ type: "doc", id: "cli/telemetry", label: "cortex telemetry" },
{
type: "html",
value: "Benchmarking",
className: "sidebar-divider",
},
{ type: "doc", id: "cli/benchmark", label: "cortex benchmark" },
],
};

export default sidebars;
58 changes: 58 additions & 0 deletions src/components/Diagram/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import BrowserOnly from "@docusaurus/BrowserOnly";
import { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types/types";

interface DiagramProps {
diagramPath: string;
}

export default function Diagram({ diagramPath }: DiagramProps) {
return (
<BrowserOnly>
{() => {
const { Excalidraw, loadFromBlob } =
require("@excalidraw/excalidraw") as typeof import("@excalidraw/excalidraw");
const { useState, useEffect } =
require("react") as typeof import("react");

function ExcalidrawDiagram({ diagramPath }: DiagramProps) {
const [excalidrawAPI, setExcalidrawAPI] =
useState<ExcalidrawImperativeAPI | null>(null);

useEffect(() => {
if (excalidrawAPI !== null) {
fetch(diagramPath)
.then((res) => res.blob())
.then((blob) =>
loadFromBlob(blob, excalidrawAPI.getAppState(), null)
)
.then((data) => {
excalidrawAPI.updateScene(data);
});
}
}, [excalidrawAPI]);

return (
<div style={{ height: "600px" }}>
<Excalidraw
excalidrawAPI={(api) => setExcalidrawAPI(api)}
isCollaborating={false}
zenModeEnabled={false}
viewModeEnabled={true}
gridModeEnabled={false}
UIOptions={{
canvasActions: {
export: false,
loadScene: false,
saveToActiveFile: false,
},
}}
/>
</div>
);
}

return <ExcalidrawDiagram diagramPath={diagramPath} />;
}}
</BrowserOnly>
);
}
Loading

0 comments on commit e39582f

Please sign in to comment.