-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix: correct indentation issue in PythonCodeStructuredTool and correct type for int and float inputs when updating custom component #3323
Conversation
…ically and accept global variables
…uredTool.py for clarity and consistency
…l.py for improved readability and type safety
…uild method to asynchronous.
Pull Request Validation ReportThis comment is automatically generated by Conventional PR Whitelist Report
Result Pull request does not satisfy any enabled whitelist criteria. Pull request will be validated. Validation Report
Result Pull request is invalid. Reason
Last Modified at 14 Aug 24 06:41 UTC |
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, @goliath-yamon
key: value_dict.get("value") | ||
if value_dict.get("_input_type") != "IntInput" | ||
else ( | ||
int(value_dict.get("value")) | ||
if value_dict.get("_input_type") != "FloatInput" | ||
else float(value_dict.get("value")) | ||
) | ||
for key, value_dict in template.items() | ||
if isinstance(value_dict, dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this would be better
key: value_dict.get("value") | |
if value_dict.get("_input_type") != "IntInput" | |
else ( | |
int(value_dict.get("value")) | |
if value_dict.get("_input_type") != "FloatInput" | |
else float(value_dict.get("value")) | |
) | |
for key, value_dict in template.items() | |
if isinstance(value_dict, dict) | |
# Define a mapping of input types to their conversion functions | |
type_converters = { | |
"IntInput": int, | |
"FloatInput": float, | |
} | |
# Generate the params dictionary | |
params = { | |
key: type_converters.get(value_dict.get("_input_type"), lambda x: x)(value_dict.get("value")) | |
for key, value_dict in template.items() | |
if isinstance(value_dict, dict) | |
} |
…el to improve code readability and maintainability
No description provided.