From 779983cb85aa101b448715336e1ee487b4fbe0f6 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 6 Dec 2024 13:43:49 -0800 Subject: [PATCH] feat: add missing dependency hints for Gemini and Bedrock --- aider/exceptions.py | 9 +++++++++ aider/website/docs/llms/bedrock.md | 2 +- aider/website/docs/llms/gemini.md | 10 ++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/aider/exceptions.py b/aider/exceptions.py index e8fcc5997..27ab3e13f 100644 --- a/aider/exceptions.py +++ b/aider/exceptions.py @@ -78,4 +78,13 @@ class LiteLLMExceptions: def get_ex_info(self, ex): """Return the ExInfo for a given exception instance""" + import litellm + + if ex.__class__ is litellm.APIConnectionError: + if "google.auth" in str(ex): + return ExInfo( + "APIConnectionError", False, "You need to: pip install google-generativeai" + ) + if "boto3" in str(ex): + return ExInfo("APIConnectionError", False, "You need to: pip install boto3") return self.exceptions.get(ex.__class__, ExInfo(None, None, None)) diff --git a/aider/website/docs/llms/bedrock.md b/aider/website/docs/llms/bedrock.md index 4d5766fb8..5bcef9b16 100644 --- a/aider/website/docs/llms/bedrock.md +++ b/aider/website/docs/llms/bedrock.md @@ -50,7 +50,7 @@ pip install boto3 To use aider installed via `pipx` with AWS Bedrock, you must add the `boto3` dependency to aider's virtual environment by running ```bash -pipx inject aider boto3 +pipx inject aider-chat boto3 ``` diff --git a/aider/website/docs/llms/gemini.md b/aider/website/docs/llms/gemini.md index c8f045ac3..8d8234d88 100644 --- a/aider/website/docs/llms/gemini.md +++ b/aider/website/docs/llms/gemini.md @@ -5,15 +5,17 @@ nav_order: 300 # Gemini -Google currently offers -[*free* API access to the Gemini 1.5 Pro model](https://ai.google.dev/pricing). -This is the most capable free model to use with aider, -with code editing capability that's comparable to GPT-3.5. You'll need a [Gemini API key](https://aistudio.google.com/app/u/2/apikey). ``` python -m pip install -U aider-chat +# You may need to install google-generativeai +pip install -U google-generativeai + +# Or with pipx... +pipx inject aider-chat google-generativeai + export GEMINI_API_KEY= # Mac/Linux setx GEMINI_API_KEY # Windows, restart shell after setx