This repository is forked from https://github.com/tomwarias/Terminal-Groq-Chat 该贡献者提出了一种在命令行调用Groq的API展开多轮对话的prompt界面,就像这样:
>>> User:
<<< Jarvis:
运行Terminal-Groq-Chat的代码需要在其项目目录下使用python3 groq.py
命令,而无法随时随地使用tgroq
运行,也不能像这样tgroq "My Question is..."
However, 我做了以下改进:
- rename
groq.py
为tgroq
以避免import groq
和自身文件名的冲突 - 修改代码使得可以直接将问题作为参数以运行
tgroq "My Question is..."
- 编辑了
init.sh
并添加到环境变量以随时随地调用tgroq
呼出 - 保留了多轮对话机制。当无参调用
tgroq
时,开始多轮对话,当使用tgroq "My Question is..."
时,直接将回答输出到终端
-
Clone the Repository
git clone https://github.com/AWSzyAI/tgroq.git cd tgroq
-
Install Dependencies
Set API key, you can found it here https://console.groq.com/keys:
export GROQ_API_KEY=<your_api>
-
Install Dependencies Install pip:
python3 get-pip.py
Install the necessary Python packages by running:
pip install groq asyncio
-
Add tgroq to PATH
chmod +x init.sh sudo ./init.sh /usr/local/bin/
/usr/local/bin/
can also be changed by any PATH you want to add.
-
Run the Application
Start the code with:
tgroq tgroq "Your question"