[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon Bedrock Generators missing kwargs init params when serializing #783

Open
sjrl opened this issue Jun 4, 2024 · 0 comments · May be fixed by #833
Open

Amazon Bedrock Generators missing kwargs init params when serializing #783

sjrl opened this issue Jun 4, 2024 · 0 comments · May be fixed by #833
Assignees
Labels

Comments

@sjrl
Copy link
Contributor
sjrl commented Jun 4, 2024

Describe the bug
The Amazon Bedrock Generators init method allows for kwargs

def __init__(
self,
model: str,
aws_access_key_id: Optional[Secret] = Secret.from_env_var("AWS_ACCESS_KEY_ID", strict=False), # noqa: B008
aws_secret_access_key: Optional[Secret] = Secret.from_env_var( # noqa: B008
"AWS_SECRET_ACCESS_KEY", strict=False
),
aws_session_token: Optional[Secret] = Secret.from_env_var("AWS_SESSION_TOKEN", strict=False), # noqa: B008
aws_region_name: Optional[Secret] = Secret.from_env_var("AWS_DEFAULT_REGION", strict=False), # noqa: B008
aws_profile_name: Optional[Secret] = Secret.from_env_var("AWS_PROFILE", strict=False), # noqa: B008
max_length: Optional[int] = 100,
**kwargs,
):

but in the to_dict method ignores these kwargs

def to_dict(self) -> Dict[str, Any]:
"""
Serializes the component to a dictionary.
:returns:
Dictionary with serialized data.
"""
return default_to_dict(
self,
aws_access_key_id=self.aws_access_key_id.to_dict() if self.aws_access_key_id else None,
aws_secret_access_key=self.aws_secret_access_key.to_dict() if self.aws_secret_access_key else None,
aws_session_token=self.aws_session_token.to_dict() if self.aws_session_token else None,
aws_region_name=self.aws_region_name.to_dict() if self.aws_region_name else None,
aws_profile_name=self.aws_profile_name.to_dict() if self.aws_profile_name else None,
model=self.model,
max_length=self.max_length,
)

which means serializing and then deserializing will result in a different Generator with different behavior (e.g. if a user sets the temperature as a kwarg then this value will be "forgotten").

To Reproduce
Serialize a Bedrock generator using a kwarg and then deserialize.

Describe your environment (please complete the following information):

  • OS: [e.g. iOS] MacOS
  • Haystack version: 2.2
  • Integration version: 0.8.0
@sjrl sjrl added bug Something isn't working integration:amazon-bedrock labels Jun 4, 2024
@shadeMe shadeMe added the P1 label Jun 14, 2024
@Amnah199 Amnah199 linked a pull request Jun 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants