-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: improve maintainability and testability of Vertex.build_params
#5808
Draft
ogabrielluiz
wants to merge
5
commits into
main
Choose a base branch
from
refactor-build-params
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+410
−134
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
github-actions
bot
added
refactor
Maintenance tasks and housekeeping
and removed
refactor
Maintenance tasks and housekeeping
labels
Jan 20, 2025
CodSpeed Performance ReportMerging #5808 will degrade performances by 91.15%Comparing Summary
Benchmarks breakdown
|
ogabrielluiz
force-pushed
the
refactor-build-params
branch
from
January 20, 2025 16:56
331dc58
to
0ae4c42
Compare
github-actions
bot
added
refactor
Maintenance tasks and housekeeping
and removed
refactor
Maintenance tasks and housekeeping
labels
Jan 20, 2025
…ng names - Introduced a new OpenAIModelComponent class to facilitate text generation using OpenAI's language models. - Implemented various input fields including max_tokens, model_kwargs, json_mode, model_name, openai_api_base, api_key, temperature, and seed for enhanced configurability. - Added methods for building the model and handling exceptions from OpenAI API calls. - This component enhances the existing framework by integrating OpenAI's capabilities, allowing users to generate text with customizable parameters.
…_model - Changed import statements in model_input_constants.py, __init__.py, and test_tool_calling_agent.py to reflect the new OpenAIModelComponent location. - This refactor improves code organization and clarity by ensuring consistent usage of the updated component structure.
github-actions
bot
added
refactor
Maintenance tasks and housekeeping
and removed
refactor
Maintenance tasks and housekeeping
labels
Jan 20, 2025
- Introduced a ValueError exception for invalid field types in the ParameterHandler class. - This change enhances robustness by ensuring that only valid field types are processed, improving error reporting for developers.
github-actions
bot
added
refactor
Maintenance tasks and housekeeping
and removed
refactor
Maintenance tasks and housekeeping
labels
Jan 20, 2025
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.
Copilot reviewed 6 out of 11 changed files in this pull request and generated no comments.
Files not reviewed (5)
- src/backend/tests/unit/graph/init.py: Evaluated as low risk
- src/backend/base/langflow/components/models/init.py: Evaluated as low risk
- src/backend/tests/unit/components/agents/test_tool_calling_agent.py: Evaluated as low risk
- src/backend/base/langflow/graph/vertex/base.py: Evaluated as low risk
- src/backend/base/langflow/base/models/model_input_constants.py: Evaluated as low risk
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 introduces significant changes to the
langflow
project, focusing on refactoring the parameter handling logic in vertices and adding comprehensive tests for the new functionality. The most important changes include the introduction of a newParameterHandler
class, refactoring thebuild_params
method to use this new class, and adding tests to ensure the correctness of the new implementation.Refactoring and Code Simplification:
Introduction of
ParameterHandler
class:ParameterHandler
class insrc/backend/base/langflow/graph/vertex/param_handler.py
to handle parameter processing for vertices. This class centralizes the logic for processing edge and field parameters, improving code organization and maintainability.Refactoring
build_params
method:build_params
method insrc/backend/base/langflow/graph/vertex/base.py
to utilize the newParameterHandler
class for processing edge and field parameters. This change simplifies the parameter handling logic and reduces code duplication.Code Cleanup:
src/backend/base/langflow/graph/vertex/base.py
file by removing unused imports such asast
,os
, andpandas
.Documentation:
src/backend/tests/__init__.py
,src/backend/tests/unit/__init__.py
,src/backend/tests/unit/graph/__init__.py
, andsrc/backend/tests/unit/graph/vertex/__init__.py
. [1] [2] [3] [4]Testing:
ParameterHandler
:src/backend/tests/unit/graph/vertex/test_vertex_base.py
to verify the functionality of theParameterHandler
class. This includes tests for edge parameter processing, file field processing, field skipping logic, non-list edge parameter processing, and handling optional fields.