From 56e900e4916f9a53f6a27d88de647cb42fd83072 Mon Sep 17 00:00:00 2001 From: Gabrielle Ong Date: Tue, 5 Nov 2024 19:55:07 +0800 Subject: [PATCH] remove API server, combine into basic usage --- docs/docs/basic-usage/api-server.mdx | 90 ---------------------------- docs/sidebars.ts | 1 - 2 files changed, 91 deletions(-) delete mode 100644 docs/docs/basic-usage/api-server.mdx diff --git a/docs/docs/basic-usage/api-server.mdx b/docs/docs/basic-usage/api-server.mdx deleted file mode 100644 index 1003fff1f..000000000 --- a/docs/docs/basic-usage/api-server.mdx +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: API Server -description: Cortex Server Overview. ---- - -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - -Cortex has an [API server](https://cortex.so/api-reference) that runs at `localhost:39281`. - - -## Usage -### Start Cortex Server -```bash -# By default the server will be started on port `39281` -cortex -# Start a server with different port number -cortex -a
-p -# Set the data folder directory -cortex --dataFolder -``` -### Run Model -```bash -# Pull a model -curl --request POST \ - --url http://localhost:39281/v1/models/mistral/pull -# Start the model -curl --request POST \ - --url http://localhost:39281/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:39281/v1/system/events/model -``` -### Chat with Model -```bash -# Invoke the chat completions endpoint -curl http://localhost:39281/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:39281/v1/models/mistral/stop -``` -### Pull Model -```bash -# Pull a model -curl --request POST \ - --url http://localhost:39281/v1/models/mistral/pull -``` \ No newline at end of file diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 69479b32e..205d2a205 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -52,7 +52,6 @@ const sidebars: SidebarsConfig = { link: { type: "doc", id: "basic-usage/index" }, collapsed: true, items: [ - { type: "doc", id: "basic-usage/api-server", label: "API Server" }, { type: "doc", id: "basic-usage/cortex-js",