Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista committed Feb 14, 2024
1 parent 33949aa commit d6668d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ class AmazonBedrockGenerator:
def __init__(
self,
model: str,

aws_access_key_id: Optional[Secret] = EnvVarSecret(
env_vars=["AWS_ACCESS_KEY_ID"], strict=False).from_env_var("AWS_ACCESS_KEY_ID"),

aws_access_key_id: Optional[Secret] = EnvVarSecret(env_vars=["AWS_ACCESS_KEY_ID"], strict=False).from_env_var(
"AWS_ACCESS_KEY_ID"
),
aws_secret_access_key: Optional[Secret] = EnvVarSecret(
env_vars=["AWS_SECRET_ACCESS_KEY"], strict=False).from_env_var("AWS_SECRET_ACCESS_KEY"),

aws_session_token: Optional[Secret] = EnvVarSecret(
env_vars=["AWS_SESSION_TOKEN"], strict=False).from_env_var("AWS_SESSION_TOKEN"),

aws_region_name: Optional[Secret] = EnvVarSecret(
env_vars=["AWS_DEFAULT_REGION"], strict=False).from_env_var("AWS_DEFAULT_REGION"),

aws_profile_name: Optional[str] = EnvVarSecret(
env_vars=["AWS_PROFILE"], strict=False).from_env_var("AWS_PROFILE"),
env_vars=["AWS_SECRET_ACCESS_KEY"], strict=False
).from_env_var("AWS_SECRET_ACCESS_KEY"),
aws_session_token: Optional[Secret] = EnvVarSecret(env_vars=["AWS_SESSION_TOKEN"], strict=False).from_env_var(
"AWS_SESSION_TOKEN"
),
aws_region_name: Optional[Secret] = EnvVarSecret(env_vars=["AWS_DEFAULT_REGION"], strict=False).from_env_var(
"AWS_DEFAULT_REGION"
),
aws_profile_name: Optional[str] = EnvVarSecret(env_vars=["AWS_PROFILE"], strict=False).from_env_var(
"AWS_PROFILE"
),
max_length: Optional[int] = 100,
**kwargs,
):
Expand All @@ -98,7 +98,6 @@ def __init__(
self.max_length = max_length

def resolve_secret(secret: Optional[Secret]) -> Optional[str]:
print(secret, secret.resolve_value())
return secret.resolve_value() if secret else None

try:
Expand All @@ -109,11 +108,6 @@ def resolve_secret(secret: Optional[Secret]) -> Optional[str]:
aws_region_name=resolve_secret(aws_region_name),
aws_profile_name=resolve_secret(aws_profile_name),
)

creds = session.get_credentials()
print("\n\n\n\nCreds")
print(creds.access_key, creds.secret_key, creds.token, creds.method, creds.expired, creds._refresh_needed)

self.client = session.client("bedrock-runtime")
except Exception as exception:
msg = (
Expand Down
3 changes: 2 additions & 1 deletion integrations/amazon_bedrock/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from unittest.mock import MagicMock, patch

import pytest


@pytest.fixture
def set_env_variables(monkeypatch):
Expand Down

0 comments on commit d6668d5

Please sign in to comment.