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

docs: Update modelyaml, llama.cpp parameters, log in the data folder #202

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/basic-usage/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ slug: "command-line"
Cortex has a [Docker](https://docs.docker.com/engine/reference/commandline/cli/) and [Ollama](https://ollama.com/)-inspired [CLI syntax](/docs/cli) for running model operations.

## How It Works
Cortex’s CLI invokes the Cortex Engine’s API, which runs in the background on port `1337`.
Cortex’s CLI invokes the Cortex Engine’s API, which runs in the background on port `3928`.


## Basic Usage
### [Start Cortex Server](/docs/cli)
```bash
# By default the server will be started on port `1337`
# By default the server will be started on port `3928`
cortex
```
### [Run Model](/docs/cli/run)
Expand Down
45 changes: 45 additions & 0 deletions docs/basic-usage/cortexrc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: .cortexrc
description: .cortexrc Overview.
slug: "cortexrc"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::warning
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
:::

Cortex.cpp supports reading its configuration from a file called `.cortexrc`. Using this file, you can also change the data folder, Cortex.cpp API server port, and host.

## File Location
The configuration file is stored in the following locations:

- **Windows**:
- Stable: `C:\Users\<username>\.cortexrc`
- Beta: `C:\Users\<username>\.cortexrc-beta`
- Nighty: `C:\Users\<username>\.cortexrc-nightly`
- **Linux**:
- Stable: `/home/<username>/.cortexrc`
- Beta: `/home/<username>/.cortexrc-beta`
- Nighty: `/home/<username>/.cortexrc-nightly`
- **macOS**:
- Stable: `/Users/<username>/.cortexrc`
- Beta: `/Users/<username>/.cortexrc-beta`
- Nighty: `/Users/<username>/.cortexrc-nightly`

## Configuration Parameters
You can configure the following parameters in the `.cortexrc` file:
| Parameter | Description | Default Value |
|------------------|--------------------------------------------------|--------------------------------|
| `dataFolderPath` | Path to the folder where `.cortexrc` located. | User's home folder. |
| `apiServerHost` | Host address for the Cortex.cpp API server. | `127.0.0.1` |
| `apiServerPort` | Port number for the Cortex.cpp API server. | `3928` |

Example of the `.cortexrc` file:
```
dataFolderPath: /Users/<username>/cortexcpp
apiServerHost: 127.0.0.1
apiServerPort: 3928
```
140 changes: 140 additions & 0 deletions docs/basic-usage/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: API
description: Cortex Server Overview.
slug: "basic-usage"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::warning
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
:::

Cortex has an [API server](https://cortex.so/api-reference) that runs at `localhost:3928`.


## Usage
### Start Cortex.cpp Server
<Tabs>
<TabItem value="MacOs/Linux" label="MacOs/Linux">
```sh
# Stable
cortex

# Beta
cortex-beta

# Nightly
cortex-nightly
```
</TabItem>
<TabItem value="Windows" label="Windows">
```sh
# Stable
cortex.exe

# Beta
cortex-beta.exe

# Nightly
cortex-nightly.exe
```
</TabItem>
</Tabs>
### Run Model
```bash
# Pull a model
curl --request POST \
--url http://localhost:3928/v1/models/mistral/pull
# Start the model
curl --request POST \
--url http://localhost:3928/v1/models/mistral/start \
--header 'Content-Type: application/json' \
--data '{
"prompt_template": "system\n{system_message}\nuser\n{prompt}\nassistant",
"stop": [],
"ngl": 4096,
"ctx_len": 4096,
"cpu_threads": 10,
"n_batch": 2048,
"caching_enabled": true,
"grp_attn_n": 1,
"grp_attn_w": 512,
"mlock": false,
"flash_attn": true,
"cache_type": "f16",
"use_mmap": true,
"engine": "llamacpp"
}'
```
### Show the Model State
```bash
# Check the model status
curl --request GET \
--url http://localhost:3928/v1/system/events/model
```
### Chat with Model
```bash
# Invoke the chat completions endpoint
curl http://localhost:3928/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "",
"messages": [
{
"role": "user",
"content": "Hello"
},
],
"model": "mistral",
"stream": true,
"max_tokens": 1,
"stop": [
null
],
"frequency_penalty": 1,
"presence_penalty": 1,
"temperature": 1,
"top_p": 1
}'
```
### Stop Model
```bash
# Stop a model
curl --request POST \
--url http://localhost:3928/v1/models/mistral/stop
```
### Pull Model
```bash
# Pull a model
curl --request POST \
--url http://localhost:3928/v1/models/mistral/pull
```
### Stop Cortex.cpp Server
<Tabs>
<TabItem value="MacOs/Linux" label="MacOs/Linux">
```sh
# Stable
cortex stop

# Beta
cortex-beta stop

# Nightly
cortex-nightly stop
```
</TabItem>
<TabItem value="Windows" label="Windows">
```sh
# Stable
cortex.exe stop

# Beta
cortex-beta.exe stop

# Nightly
cortex-nightly.exe stop
```
</TabItem>
</Tabs>
2 changes: 1 addition & 1 deletion docs/basic-usage/server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Cortex has an [API server](https://cortex.so/api-reference) that runs at `localh
## Usage
### Start Cortex Server
```bash
# By default the server will be started on port `1337`
# By default the server will be started on port `3928`
cortex
# Start a server with different port number
cortex -a <address> -p <port_number>
Expand Down
32 changes: 29 additions & 3 deletions docs/cli/chat.md → docs/cli/chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Cortex chat command.
slug: "chat"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::warning
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
:::
Expand All @@ -18,10 +21,33 @@ This CLI command calls the following API endpoint:
This command starts a chat session with a specified model, allowing you to interact directly with it through an interactive chat interface.

## Usage
<Tabs>
<TabItem value="MacOs/Linux" label="MacOs/Linux">
```sh
# Stable
cortex chat [options] <model_id> <message>

# Beta
cortex-beta chat [options] <model_id> <message>

# Nightly
cortex-nightly chat [options] <model_id> <message>
```
</TabItem>
<TabItem value="Windows" label="Windows">
```sh
# Stable
cortex.exe chat [options] <model_id> <message>

# Beta
cortex-beta.exe chat [options] <model_id> <message>

# Nightly
cortex-nightly.exe chat [options] <model_id> <message>
```
</TabItem>
</Tabs>

```bash
cortex chat [options] <model_id> <message>
```
:::info
This command uses a `model_id` from the model that you have downloaded or available in your file system.
:::
Expand Down
37 changes: 32 additions & 5 deletions docs/cli/cortex.md → docs/cli/cortex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Cortex CLI.
slug: /cli
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::warning
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
:::
Expand All @@ -13,13 +16,36 @@ slug: /cli
This is the initial command you need to run to start using Cortex.cpp.
:::

This command starts the Cortex.cpp process and the API server, which runs on port `1337` by default.
This command starts the Cortex.cpp API server, which runs on port `3928` by default.

## Usage
<Tabs>
<TabItem value="MacOs/Linux" label="MacOs/Linux">
```sh
# Stable
cortex [command] [options]

# Beta
cortex-beta [command] [options]

# Nightly
cortex-nightly [command] [options]
```
</TabItem>
<TabItem value="Windows" label="Windows">
```sh
# Stable
cortex.exe [command] [options]

# Beta
cortex-beta.exe [command] [options]

# Nightly
cortex-nightly.exe [command] [options]
```
</TabItem>
</Tabs>

```bash
cortex [command] [options]
```

## Options

Expand Down Expand Up @@ -50,4 +76,5 @@ For example:
- [cortex engines](/docs/cli/engines): Manage Cortex.cpp engines.
- [cortex pull|download](/docs/cli/pull): Download a model.
- [cortex run](/docs/cli/run): Shortcut to start a model and chat.
- [cortex update](/docs/cli/stop): Update the Cortex.cpp version.
- [cortex update](/docs/cli/update): Update the Cortex.cpp version.
- [cortex stop](/docs/cli/stop): Stop the Cortex.cpp API server.
36 changes: 29 additions & 7 deletions docs/cli/embeddings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Cortex embeddings command.
slug: "embeddings"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::warning
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
:::
Expand All @@ -19,14 +22,33 @@ This command creates the embedding vector representing the input text.

## Usage

```bash
<Tabs>
<TabItem value="MacOs/Linux" label="MacOs/Linux">
```sh
# Stable
cortex embeddings [options] [model_id] [message]

# Beta
cortex-beta embeddings [options] [model_id] [message]

# Nightly
cortex-nightly embeddings [options] [model_id] [message]
```
</TabItem>
<TabItem value="Windows" label="Windows">
```sh
# Stable
cortex.exe embeddings [options] [model_id] [message]

# Beta
cortex-beta.exe embeddings [options] [model_id] [message]

# Nightly
cortex-nightly.exe embeddings [options] [model_id] [message]
```
</TabItem>
</Tabs>

# With a model started
cortex models start [model_id]
cortex embeddings [options] [message]
# Without any started models
cortex embeddings [options] [model_id] [message]
```
:::info
This command uses a `model_id` from the model that you have downloaded or available in your file system.
:::
Expand Down
Loading
Loading