Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jun 10, 2024
1 parent ce1e998 commit 476049a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 39 deletions.
40 changes: 34 additions & 6 deletions README.cn.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ai-agent(WIP)

AI Agent Script Engine 代理体脚本客户端
AI Agent Script Engine 智能体脚本客户端

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/ai-agent.svg)](https://npmjs.org/package/@offline-ai/cli)
[![Downloads/week](https://img.shields.io/npm/dw/ai-agent.svg)](https://npmjs.org/package/@offline-ai/cli)

AI Agent 脚本引擎特点:

* 简单,方便代理开发,创建智能应用...
* 简单,方便智能体开发,创建智能应用...
* 低代码,少量代码,甚至无代码就能快速开发...
* 灵活,可以在脚本中自由添加新的指令,脚本之间可以自由调用...
* 数据开放,在脚本中可以自由访问输入输出数据,以及内部数据...
Expand All @@ -23,9 +23,36 @@ AI Agent 脚本引擎特点:
3. 选择合适的量化程度,量化(压缩)程度越大,速度越快,体积越小,精度越差...
4. 选择合适的最大窗口正文长度(`content_size`), 一般 2048 足够, 这个参数也会影响模型的性能...
5. 然后直接使用客户端(`@offline-ai/cli`)下载: `ai brain download`
2. 创建应用的智能代理脚本文件,使用客户端(`@offline-ai/cli`)调试代理提示词
2. 创建应用的智能体脚本文件,使用客户端(`@offline-ai/cli`)调试智能体提示词
3. 嵌入到自己的应用中

## Quick Start

### Install

```bash
npm install -g @offline-ai/cli
ai brain download QuantFactory/Phi-3-mini-4k-instruct-GGUF-v2 -q Q4_0
Downloading to ~/.local/share/ai/brain
Downloading https://huggingface.co/QuantFactory/Phi-3-mini-4k-instruct-GGUF-v2/resolve/main/Phi-3-mini-4k-instruct.Q4_0.gguf... 5.61% 121977704 bytes
1. https://hf-mirror.com/QuantFactory/Phi-3-mini-4k-instruct-GGUF-v2/resolve/main/Phi-3-mini-4k-instruct.Q4_0.gguf
~/.local/share/ai/brain/phi-3-mini-4k-instruct.Q4_0.gguf
done
mkdir llamacpp
cd llamacpp
wget https://github.com/ggerganov/llama.cpp/releases/download/b3091/llama-b3091-bin-ubuntu-x64.zip
unzip llama-b3091-bin-ubuntu-x64.zip
```

### Run

```bash
#run llama.cpp server
cd llamacpp/build/bin
#set -ngl 0 if no gpu
./server -t 4 -c 4096 -ngl 33 -m ~/.local/share/ai/brain/phi-3-mini-4k-instruct.Q4_0.gguf
```

## Usage

安装客户端:
Expand All @@ -43,15 +70,16 @@ USAGE
```

从huggingface上下载大脑🧠(LLM).
如果本地无法访问huggingfaces, 请用代理或者Mirror.
如果本地无法访问huggingface, 请用代理或者Mirror.

运行如下命令执行下载命令, 选择一个下载, 或者输入更多来减少脑(模型)列表.

注意:

* 所有的量化(压缩)大脑🧠模型均为用户自行上传,因此并不能保证这些用户自行量化(压缩)的大脑🧠模型都能使用
* 目前已经存在的GGUF量化大脑🧠模型已经上万,有不少都是重复的
* 列表中显示的大脑列表,默认是经过`featured`过滤了的一部分列表, 如果要显示所有的大脑列表,请输入`--no-onlyFeatured`
* `ai brain list` 列表中显示的大脑列表,默认是经过`featured`过滤了的一部分列表, 如果要显示所有的大脑列表,请输入`--no-onlyFeatured`
* `ai brain download` 下载支持自动续传


```bash
Expand Down Expand Up @@ -132,7 +160,7 @@ cd build/bin
#不用输入扩展名 `.ai.yaml`.
#默认脚本的搜索路径是当前目录和`~/.local/share/ai/agent`目录 . 你可以在`agentDirs`中配置, 或者直接在命令行中指定,注意命令行指定将覆盖配置文件中的设置.
#`-f` means the agent file
#`-i` means 进入交互模式, char-dobby 是一个角色代理脚本,扮演哈利波特中的dobby.
#`-i` means 进入交互模式, char-dobby 是一个角色智能体脚本,扮演哈利波特中的dobby.
$ai run -if examples/char-dobby
Dobby: I am Dobby. Dobby is happy.
You: intro yourself pls.
Expand Down
69 changes: 36 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ cd llamacpp/build/bin
./server -t 4 -c 4096 -ngl 33 -m ~/.local/share/ai/brain/phi-3-mini-4k-instruct.Q4_0.gguf
```




## Usage

Install the CLI globally:
Expand All @@ -70,7 +67,7 @@ $ npm install -g @offline-ai/cli
$ ai COMMAND
running command...
$ ai (--version)
@offline-ai/cli/0.0.5 linux-x64 node-v20.14.0
@offline-ai/cli/0.0.6 linux-x64 node-v20.14.0
$ ai --help [COMMAND]
USAGE
$ ai COMMAND
Expand Down Expand Up @@ -248,28 +245,34 @@ Specific script instruction manual see: [ai-tool-agent](https://www.npmjs.com/pa
## Commands

<!-- commands -->
* [`ai agent`](#ai-agent)
* [`ai autocomplete [SHELL]`](#ai-autocomplete-shell)
* [`ai brain [NAME]`](#ai-brain-name)
* [`ai brain dn [NAME]`](#ai-brain-dn-name)
* [`ai brain down [NAME]`](#ai-brain-down-name)
* [`ai brain download [NAME]`](#ai-brain-download-name)
* [`ai brain list [NAME]`](#ai-brain-list-name)
* [`ai config [ITEM_NAME]`](#ai-config-item_name)
* [`ai config save [DATA]`](#ai-config-save-data)
* [`ai help [COMMAND]`](#ai-help-command)
* [`ai plugins`](#ai-plugins)
* [`ai plugins add PLUGIN`](#ai-plugins-add-plugin)
* [`ai plugins:inspect PLUGIN...`](#ai-pluginsinspect-plugin)
* [`ai plugins install PLUGIN`](#ai-plugins-install-plugin)
* [`ai plugins link PATH`](#ai-plugins-link-path)
* [`ai plugins remove [PLUGIN]`](#ai-plugins-remove-plugin)
* [`ai plugins reset`](#ai-plugins-reset)
* [`ai plugins uninstall [PLUGIN]`](#ai-plugins-uninstall-plugin)
* [`ai plugins unlink [PLUGIN]`](#ai-plugins-unlink-plugin)
* [`ai plugins update`](#ai-plugins-update)
* [`ai run [DATA]`](#ai-run-data)
* [`ai version`](#ai-version)
- [ai-agent](#ai-agent)
- [Quick Start](#quick-start)
- [Install](#install)
- [Run](#run)
- [Usage](#usage)
- [Commands](#commands)
- [`ai agent`](#ai-agent-1)
- [`ai autocomplete [SHELL]`](#ai-autocomplete-shell)
- [`ai brain [NAME]`](#ai-brain-name)
- [`ai brain dn [NAME]`](#ai-brain-dn-name)
- [`ai brain down [NAME]`](#ai-brain-down-name)
- [`ai brain download [NAME]`](#ai-brain-download-name)
- [`ai brain list [NAME]`](#ai-brain-list-name)
- [`ai config [ITEM_NAME]`](#ai-config-item_name)
- [`ai config save [DATA]`](#ai-config-save-data)
- [`ai help [COMMAND]`](#ai-help-command)
- [`ai plugins`](#ai-plugins)
- [`ai plugins add PLUGIN`](#ai-plugins-add-plugin)
- [`ai plugins:inspect PLUGIN...`](#ai-pluginsinspect-plugin)
- [`ai plugins install PLUGIN`](#ai-plugins-install-plugin)
- [`ai plugins link PATH`](#ai-plugins-link-path)
- [`ai plugins remove [PLUGIN]`](#ai-plugins-remove-plugin)
- [`ai plugins reset`](#ai-plugins-reset)
- [`ai plugins uninstall [PLUGIN]`](#ai-plugins-uninstall-plugin)
- [`ai plugins unlink [PLUGIN]`](#ai-plugins-unlink-plugin)
- [`ai plugins update`](#ai-plugins-update)
- [`ai run [DATA]`](#ai-run-data)
- [`ai version`](#ai-version)

## `ai agent`

Expand All @@ -288,7 +291,7 @@ EXAMPLES
$ ai agent publish <agent-name>
```

_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/agent/index.ts)_
_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/agent/index.ts)_

## `ai autocomplete [SHELL]`

Expand Down Expand Up @@ -360,7 +363,7 @@ EXAMPLES
$ ai brain download <brain-name>
```

_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/brain/index.ts)_
_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/brain/index.ts)_

## `ai brain dn [NAME]`

Expand Down Expand Up @@ -488,7 +491,7 @@ EXAMPLES
$ ai brain download <brain-name> [-q <QUANT>]
```

_See code: [src/commands/brain/download.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/brain/download.ts)_
_See code: [src/commands/brain/download.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/brain/download.ts)_

## `ai brain list [NAME]`

Expand Down Expand Up @@ -516,7 +519,7 @@ GLOBAL FLAGS
--json Format output as json.
```

_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/brain/list.ts)_
_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/brain/list.ts)_

## `ai config [ITEM_NAME]`

Expand Down Expand Up @@ -553,7 +556,7 @@ EXAMPLES
}
```

_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/config/index.ts)_
_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/config/index.ts)_

## `ai config save [DATA]`

Expand Down Expand Up @@ -593,7 +596,7 @@ GLOBAL FLAGS
--json Format output as json.
```

_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/config/save.ts)_
_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/config/save.ts)_

## `ai help [COMMAND]`

Expand Down Expand Up @@ -953,7 +956,7 @@ EXAMPLES
│[info]:Start Script: ...
```

_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.5/src/commands/run/index.ts)_
_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.6/src/commands/run/index.ts)_

## `ai version`

Expand Down

0 comments on commit 476049a

Please sign in to comment.