command_line_chatgpt
1.0.0
现在有官方 ChatGPT API!!!
在此处观看此存储库的演示视频:
如果您想查看该项目的旧代码,只需克隆存储库并签出davinci-version
分支即可。
git checkout davinci-version
否则,只需使用默认的main
分支,您将被插入官方 ChatGPT API!
这是一个使用 OpenAI ChatGPT API 的简单聊天机器人。
您可以在此处观看使用达芬奇模型的原始视频演练。很快就会发布一个新视频来匹配新代码。
确保你已经安装了 python3:
python3 --version
创建虚拟环境并安装依赖:
python3 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt
python -m venv venv
venvScriptsactivate.bat
pip install -r requirements.txt
将env.sample
复制到.env
并将您的 OpenAI API 密钥添加到该文件。
OPENAI_API_KEY=<<YOUR_API_KEY>>
编辑main.py
并将<<PUT THE PROMPT HERE>>
替换为您的提示:
例如创建一个简单的AI鸡尾酒助手
INSTRUCTIONS = """You are an AI assistant that is an expert in alcoholic beverages.
You know about cocktails, wines, spirits and beers.
You can provide advice on drink menus, cocktail ingredients, how to make cocktails, and anything else related to alcoholic drinks.
If you are unable to provide an answer to a question, please respond with the phrase "I'm just a simple barman, I can't help with that."
Please aim to be as helpful, creative, and friendly as possible in all of your responses.
Do not use any external URLs in your answers. Do not refer to any blogs in your answers.
Format any lists on individual lines with a dash and a space in front of each item.
"""
要运行只需执行以下操作:
. ./venv/bin/activate
python main.py
venvScriptsactivate.bat
python main.py