Skip to content

Commit 4fae071

Browse files
committed
Modify API key storage user recommendation
1 parent cbe5e75 commit 4fae071

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

interpreter/core/respond.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def respond(interpreter):
9090
):
9191
output = traceback.format_exc()
9292
raise Exception(
93-
f"{output}\n\nThere might be an issue with your API key(s).\n\nTo reset your API key (we'll use OPENAI_API_KEY for this example, but you may need to reset your ANTHROPIC_API_KEY, HUGGINGFACE_API_KEY, etc):\n Mac/Linux: 'export OPENAI_API_KEY=your-key-here',\n Windows: 'setx OPENAI_API_KEY your-key-here' then restart terminal.\n\n"
93+
f"{output}\n\nThere might be an issue with your API key(s).\n\nTo reset your API key (we'll use OPENAI_API_KEY for this example, but you may need to reset your ANTHROPIC_API_KEY, HUGGINGFACE_API_KEY, etc):\n Mac/Linux: 'export OPENAI_API_KEY=your-key-here'. Update your ~/.zshrc on MacOS or ~/.bashrc on Linux with the new key if it has already been persisted there.,\n Windows: 'setx OPENAI_API_KEY your-key-here' then restart terminal.\n\n"
9494
)
9595
elif interpreter.offline == False and "not have access" in str(e).lower():
9696
response = input(

interpreter/terminal_interface/validate_llm_settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ def validate_llm_settings(interpreter):
4949
display_markdown_message(
5050
"""
5151
52-
**Tip:** To save this key for later, run `export OPENAI_API_KEY=your_api_key` on Mac/Linux or `setx OPENAI_API_KEY your_api_key` on Windows.
52+
**Tip:** To save this key for later, run one of the following and then restart your terminal.
53+
MacOS: `echo '\\nexport OPENAI_API_KEY=your_api_key' >> ~/.zshrc`
54+
Linux: `echo '\\nexport OPENAI_API_KEY=your_api_key' >> ~/.bashrc`
55+
Windows: `setx OPENAI_API_KEY your_api_key`
5356
5457
---"""
5558
)

0 commit comments

Comments
 (0)