mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
feat: Handle AWS_PROFILE for Bedrock models in validate_environment
This commit is contained in:
parent
4f4b10fd86
commit
cc33fc2822
1 changed files with 15 additions and 0 deletions
|
@ -572,6 +572,21 @@ class Model(ModelSettings):
|
||||||
|
|
||||||
model = self.name
|
model = self.name
|
||||||
res = litellm.validate_environment(model)
|
res = litellm.validate_environment(model)
|
||||||
|
|
||||||
|
# If missing AWS credential keys but AWS_PROFILE is set, consider AWS credentials valid
|
||||||
|
if res["missing_keys"] and any(
|
||||||
|
key in ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"] for key in res["missing_keys"]
|
||||||
|
):
|
||||||
|
if model.startswith("bedrock/") or model.startswith("us.anthropic."):
|
||||||
|
if os.environ.get("AWS_PROFILE"):
|
||||||
|
res["missing_keys"] = [
|
||||||
|
k
|
||||||
|
for k in res["missing_keys"]
|
||||||
|
if k not in ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]
|
||||||
|
]
|
||||||
|
if not res["missing_keys"]:
|
||||||
|
res["keys_in_environment"] = True
|
||||||
|
|
||||||
if res["keys_in_environment"]:
|
if res["keys_in_environment"]:
|
||||||
return res
|
return res
|
||||||
if res["missing_keys"]:
|
if res["missing_keys"]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue