Skip to content

Fix LLMParams bug and add unit tests (fixes #158) - #547

Merged
drazvan merged 1 commit into
developfrom
fix/issue-158-llm-params
Jun 7, 2024
Merged

Fix LLMParams bug and add unit tests (fixes #158)#547
drazvan merged 1 commit into
developfrom
fix/issue-158-llm-params

Conversation

@Pouyanpi

@Pouyanpi Pouyanpi commented Jun 6, 2024

Copy link
Copy Markdown
Collaborator

Summary

This PR addresses the bug in the LLMParams class. The bug was causing incorrect handling of parameters that were not directly attributes of the llm object but were present in the model_kwargs dictionary. It resolves #158.

The changes ensure that if a parameter is not an attribute of llm, it checks if llm has an attribute model_kwargs. If model_kwargs exists, it checks if the parameter is in model_kwargs. If it is, it saves the original value and sets the new value. If it's not, it logs a warning and sets the new value.

Upon exiting the context manager, the original parameters are restored correctly, whether they were direct attributes of llm or keys in model_kwargs.

In addition to the bug fix, this PR also enhances the unit tests to cover these cases.

@Pouyanpi
Pouyanpi requested a review from drazvan June 6, 2024 09:46

@drazvan drazvan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This was a much needed fix! 👍

@drazvan
drazvan merged commit 76d1086 into develop Jun 7, 2024
@drazvan drazvan self-assigned this Jun 7, 2024
@drazvan drazvan added this to the v0.10.0 milestone Jun 7, 2024
@drazvan drazvan added the bug Something isn't working label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] WARNING: Parameter temperature does not exist for Bedrock

2 participants