## 安裝WSL
如果你是linux 使用者可以跳過這個步驟,windows使用者建議安裝Windows子系統(WSL),直接在Windows 執行Linux,請先確認windows版本是 Windows 10 版本 2004(組建 19041 和更新版本)或 Windows 11以上的版本才能安裝WSL。
先搜尋PowerShell,以系統管理員開啟 PowerShell執行WSL並安裝linux ubuntu,安裝完畢後要重新開機。
### install wsl
安裝WSL並且安裝linux ubuntu。
```
$ wsl --install
```
安裝完畢,重新開機
### 更新ubuntu
重新開機後,開啟wsl,更新ubuntu到最新版本
```
$ sudo apt update -y && sudo apt upgrade -y
```
### 更新系統套件到最新版本
```
$sudo apt update && upgrade
```
### 安裝curl 套件
```
$sudo apt install curl
```
### 安裝anaconda
###先建立一個資料夾
```
$mkdir temp
```
###進入資料夾
```
$cd temp
```
###下載anaconda.sh
```
$curl https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh --output anaconda.sh
```
###安裝anaconda
```
$bash anaconda.sh
```
### 新增conda 指令
```
$source ~/.bashrc
```
### 確認conda 有安裝成功
```
$conda info
```
## 使用anaconda和pip安裝akasha套件
Linux使用者安裝完畢anaconda,進行安裝akasha套件。
```shell!
###create environment
$ conda create --name py3-8 python=3.8
$ activate py3-8
###install akasha
$ pip install akasha-terminal
```
</br>
</br>
## 在Python中使用
```python=
#PYTHON3.8
import akasha
ak = akasha.Doc_QA()
response = ak.get_response(dir_path, prompt, model="hf:meta-llama/Llama-2-7b-chat-hf")
```
</br>
</br>
## UI
在terminal上輸入,便會開起streamlit使用介面
```shell!
$ akasha ui
```
</br>
在瀏覽器中開啟 http://localhost:8501/ 
</br>
</br>
## CLI
透過command line interface使用akasha,你可以用'keep-responsing'來建立一個文檔問答模型,並可以提出不同的問題,根據給定目錄中的文檔獲取語言模型的回答。
```shell=!
$ akasha keep-responsing -d ../doc/plc/ -c 400 -k 1
Please input your question(type "exit()" to quit) : 應回收廢塑膠容器材質種類不包含哪種? 聚丙烯(PP) 聚苯乙烯(PS) 聚氯乙烯(PVC) 低密度聚乙烯(LDPE)
Response: 應回收廢塑膠容器材質種類不包含低密度聚乙烯(LDPE)。
Please input your question(type "exit()" to quit) : 所謂市盈率,是指每股市價除以每股盈餘,也就是股票的? 本益比 帳面值比 派息 資金
英國和德國等多個市場。然而,義大利、加拿大和澳洲並不在這些可交易的國家之列。
Please input your question(type "exit()" to quit) : exit()
```
</br>
</br>
現在可使用的指令: ***get-response***, ***keep-responsing***, ***chain-of-thought***, ***auto-create-questionset*** and ***auto-evaluation***.
</br>
```shell=!
$ akasha keep-responsing --help
Usage: akasha keep-responsing [OPTIONS]
Options:
-d, --doc_path TEXT document directory path, parse all .txt, .pdf,
.docx files in the directory [required]
-e, --embeddings TEXT embeddings for storing the documents
-c, --chunk_size INTEGER chunk size for storing the documents
-m, --model TEXT llm model for generating the response
-ur --use_rerank BOOL use rerank to sort the documents
-t, --threshold FLOAT threshold score for selecting the relevant
documents
-l, --language TEXT language for the documents, default is 'ch' for
chinese
-s, --search_type TEXT search type for the documents, include merge,
svm, mmr, tfidf
-sys, --system_prompt TEXT system prompt for the llm model
-md, --max_doc_len INTEGER max document length for the llm model input
--help Show this message and exit.
```