Skip to content

Commit

Permalink
Merge pull request #51 from dougollerenshaw/add_instructions_for_goog…
Browse files Browse the repository at this point in the history
…le_key

Added instructions for getting the Google API key
  • Loading branch information
dougollerenshaw authored Oct 10, 2024
2 parents b8e8317 + e515e29 commit 141c8c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions codeaide/logic/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_api_key_instructions(self, provider):
"2. Navigate to your account settings or API section.\n"
"3. Generate a new API key.\n"
"4. Add some funds to your account to cover the cost of using the API (start with as little as $1).\n"
"5. Copy the API key and paste it here.\n\n"
"5. Copy the API key and paste it in the chat window below.\n\n"
"Once you've pasted your API key, I'll save it securely in a .env file in the root of your project. "
"This file is already in .gitignore, so it won't be shared if you push your code to a repository.\n\n"
"Please paste your Anthropic API key now:"
Expand All @@ -128,13 +128,28 @@ def get_api_key_instructions(self, provider):
"1. Go to https://platform.openai.com/api-keys and sign in to your OpenAI account or create an account if you don't have one.\n"
"2. Generate a new API key.\n"
"3. Add some funds to your account to cover the cost of using the API (start with as little as $1).\n"
"4. Copy the API key and paste it here.\n\n"
"4. Copy the API key and paste it in the chat window below.\n\n"
"Once you've pasted your API key, I'll save it securely in a .env file in the root of your project. "
"This file is already in .gitignore, so it won't be shared if you push your code to a repository.\n\n"
"Please paste your OpenAI API key now:"
)
elif provider == "google":
return (
"It looks like you haven't set up your Google API key yet. "
"Here's how to get started:\n\n"
"1. Go to https://aistudio.google.com/app/apikey\n"
"2. Click on the 'Create API Key' button.\n"
"3. Copy the generated API key and paste it in the chat window below.\n\n"
"Important notes about the Google API:\n"
"- The Google API is free to use as long as you don't exceed the requests per minute limit.\n"
"- For Gemini Pro, the limit is 2 requests per minute.\n"
"- For Gemini Flash, the limit is 15 requests per minute.\n\n"
"Once you've pasted your API key, I'll save it securely in a .env file in the root of your project. "
"This file is already in .gitignore, so it won't be shared if you push your code to a repository.\n\n"
"Please paste your Google API key now:"
)
else:
return f"Please enter your API key for {provider.capitalize()}:"
return f"You don't have an API key set up for {provider}. Please choose another API provider."

def validate_api_key(self, api_key):
"""
Expand Down
2 changes: 1 addition & 1 deletion codeaide/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# The default model for each provider will be the first model in the list
AI_PROVIDERS = {
"google": {
"api_key_name": "GEMINI_API_KEY",
"api_key_name": "GOOGLE_API_KEY",
"models": {
"gemini-1.5-pro": {"max_tokens": 8192},
"gemini-1.5-flash": {"max_tokens": 8192},
Expand Down

0 comments on commit 141c8c5

Please sign in to comment.