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