Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
meloalright authored Apr 8, 2024
1 parent e183de2 commit 209161b
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,47 +215,45 @@ $ 3body
## 🤗 Large Language Model
三体编程语言可以通过 "智子工程" 加载本地大语言模型进行推理,不过目前仍然是一个实验功能。
![sophon workflow](https://github.com/rustq/3body-lang/actions/workflows/Sophon.yml/badge.svg)
三体编程语言可以通过 "智子工程" 加载本地大语言模型进行推理。
Able to use three body language sophon to load a local large language model for reasoning, inspired by [wiki/Sophon](https://three-body-problem.fandom.com/wiki/Sophon) and powered by [rustformers/llm](https://github.com/rustformers/llm).
##### Sophon 智子工程
![sophon](https://github.com/rustq/3body-lang/assets/11075892/b5ddbe31-2f67-4b49-b3eb-1168419e5a43)
#### Sophon Initializing
```shell
智子工程({ "type": <string>, "path": <string>, "prompt": <string> })
```
##### Initialize Properties 初始化参数
|property|type|Explanation|
|---|---|---|
|type|string|模型类型|
|path|string|模型所在路径|
|prompt|string|提示词|
##### APIs
|property|type|Explanation|
|---|---|---|
|model|<NativeObject::LLMModel>|模型|
|character|string|提示词所提示的角色|
|infer|BuiltinFunc|执行推理的方法|
|close|BuiltinFunc|关闭会话|
##### Reasoning 本地推理
#### Reasoning
```rust
let 智子 = fn () {
let instance = 智子工程({ "type": "llama", "path": "./Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" });
return { "回答": fn (问题) { instance.infer(instance, 问题) } }
}();
let 智子 = fn () { let instance = 智子工程({ "type": "llama", "path": "./Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" }); return { "回答": fn (问题) { instance.infer(instance, 问题) } } }();

智子.回答("中国最佳科幻小说是哪个")

// > 推理中...
```
Reasoning Example 推理示例: [runs/8582743599](https://github.com/rustq/3body-lang/actions/runs/8582743599/job/23521175335#step:5:8796)
⚛️ Example: [runs/8582743599](https://github.com/rustq/3body-lang/actions/runs/8582743599/job/23521175335#step:5:8796)
|property|type|Explanation|
|---|---|---|
|model|<NativeObject::LLMModel>|模型|
|character|string|提示词所提示的角色|
|infer|BuiltinFunc|执行推理的方法|
|close|BuiltinFunc|关闭会话|
## Development
Expand Down

0 comments on commit 209161b

Please sign in to comment.