-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
refactor: input field handling and serialization #3118
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…erscore Refactored the `Component` class in `component.py` to handle inputs and outputs. Added a new method `map_outputs` to map a list of outputs to the component. Also updated the `__init__` method to properly initialize the inputs, outputs, and other attributes. This change improves the flexibility and extensibility of the `Component` class. Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Refactored the `instantiate_class` function in `loading.py` to update the initialization parameters for the `CustomComponent` class. Changed the parameter names from `user_id`, `parameters`, `vertex`, and `tracing_service` to `_user_id`, `_parameters`, `_vertex`, and `_tracing_service` respectively. This change ensures consistency and improves code readability. Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Updated the `BaseComponent` class in `base_component.py` to accept a `UUID` type for the `_user_id` attribute. This change improves the type safety and ensures consistency with the usage of `_user_id` throughout the codebase.
The `nanoid` import in `component.py` has been updated to include a type annotation `# type: ignore`. This change ensures that the type checker ignores any errors related to the `nanoid` import.
…o functions to ensure compatibility with function signatures
…turn type to improve type checking and validation in custom components
…for consistency and clarity perf(utils.py): optimize code by reusing cc_instance instead of calling get_component_instance multiple times
…p_name' for clarity and consistency in codebase
The `schema.py` file in the `src/backend/base/langflow/graph/edge` directory has been updated to include the `TargetHandle` and `SourceHandle` models. These models define the structure and attributes of the target and source handles used in the edge data. This change improves the clarity and consistency of the codebase.
The `BaseInputMixin` class in `input_mixin.py` has been updated to handle invalid field types gracefully. Instead of raising an exception, it now returns `FieldTypes.OTHER` for any invalid field type. This change improves the robustness and reliability of the codebase.
The `file_types` field in the `FileMixin` class of `input_mixin.py` has been updated to use the `alias` parameter instead of `serialization_alias`. This change ensures consistency and improves the clarity of the codebase.
…sses to use SerializableFieldTypes enum for better type safety and clarity
dosubot
bot
added
the
size:M
This PR changes 30-99 lines, ignoring generated files.
label
Jul 31, 2024
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 satisfies all enabled pull request rules. Last Modified at 31 Jul 24 17:17 UTC |
…ulating by name The `model_config` attribute in the `BaseInputMixin` class of `input_mixin.py` has been updated to include the `populate_by_name=True` parameter. This change allows the model configuration to be populated by name, improving the flexibility and usability of the codebase.
…cept Any type The _extract_return_type method in CustomComponent has been updated to accept the Any type as the return_type parameter. This change improves the flexibility and compatibility of the method, allowing it to handle a wider range of return types.
italojohnny
approved these changes
Jul 31, 2024
Refactored the `BaseComponent` class in `base_component.py` to use the `get_template_config` method instead of duplicating the code. This change improves code readability and reduces redundancy.
dosubot
bot
added
size:L
This PR changes 100-499 lines, ignoring generated files.
and removed
size:M
This PR changes 30-99 lines, ignoring generated files.
labels
Aug 1, 2024
dosubot
bot
added
size:M
This PR changes 30-99 lines, ignoring generated files.
and removed
size:L
This PR changes 100-499 lines, ignoring generated files.
labels
Aug 1, 2024
github-actions
bot
added
refactor
Maintenance tasks and housekeeping
and removed
refactor
Maintenance tasks and housekeeping
labels
Aug 1, 2024
Improve the validation for the value type in the IntInput class. The updated code ensures that the value is of a valid type (int or float) and converts float values to integers. This change enhances the accuracy and reliability of the input validation process.
Improve the validation for the value type in the FloatInput class. The updated code ensures that the value is of a valid type (int or float) and converts integer values to floats. This change enhances the accuracy and reliability of the input validation process.
…processing to prevent potential errors
dosubot
bot
added
size:L
This PR changes 100-499 lines, ignoring generated files.
and removed
size:M
This PR changes 30-99 lines, ignoring generated files.
labels
Aug 1, 2024
…or input classes Add comprehensive unit tests for the input classes in the test_inputs.py file. This change ensures that the input classes are thoroughly tested and functioning correctly. The unit tests cover various scenarios and edge cases to validate the behavior of the input classes. This improvement enhances the reliability and stability of the codebase.
…est_inputs.py Cleaned up unnecessary test cases for invalid input types
The `get_file_content_dicts` method in the `Message` class has been updated to use an async version for improved performance. This change enhances the efficiency of retrieving file content dictionaries.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several refactorings to improve the handling and serialization of input fields in the codebase.
The
BaseInputMixin
class has been updated to handle invalid field types gracefully, returningFieldTypes.OTHER
instead of raising an exception. This improves the robustness and reliability of the code.The
file_types
field in theFileMixin
class has been updated to use thealias
parameter instead ofserialization_alias
, improving consistency and code clarity.In addition, the
field_type
declarations in various input classes have been updated to use theSerializableFieldTypes
enum for better type safety and clarity.Overall, these changes enhance the maintainability and readability of the codebase.