The version number has been updated from 0.1.4 to 0.1.5 to reflect the changes made in the package. This is a chore commit as it does not add any new features or fix any bugs, but rather updates the version number.
The conditional statement in the update_flow function was incorrect. The if statement was checking for the opposite of what was intended. The fix changes the if statement to check for the correct condition.
# Pull Request Description
## Summary
This Pull Request includes several code improvements, refactoring,
feature additions, and documentation updates mainly focused on enhancing
the functionality and maintainability of the codebase.
## Details
### Refactoring and Improvements:
- **Commit (5ea20aa) by @ogabrielluiz**: Unnecessary indentation in the
`getPythonCode` function within `constants.tsx` has been removed to
improve code readability.
- **Commit (6886828) by @ogabrielluiz**:
- Changed the `load_flow_from_json` function signature in `process.py`
to accept either a JSON file path or a JSON object.
- Updated the import statement for `Chain` in `base.py` to be more
explicit by importing it from `langchain.chains.base` instead of
`langflow.graph.vertex.types`.
- Removed a print statement from the `process_tweaks` function in
`process.py`.
- Added an optional `tweaks` parameter to the `load_flow_from_json`
function.
- Changed the return type of the `build` method in the `Graph` class
from `List[Vertex]` to `Chain`.
- **Commit (83c28dc) by @ogabrielluiz**: The `process_tweaks` function
in `process.py` has been refactored to improve readability and
maintainability. An `apply_tweaks` function was added to apply tweaks to
the node, and a `validate_input` function was added for input
validation. The function now raises a `ValueError` if the input is not
in the expected format.
- **Commit (11185af) by @ogabrielluiz**: Refactored the
`fix_memory_inputs` function in `process.py` to improve readability by
reducing nesting. The function now checks if the `langchain_object` has
a `memory` attribute and if it is not `None` before proceeding. The
try-except block was also refactored to reduce nesting.
- **Commit (f180fa6) by @ogabrielluiz**: The input parameter in
`process.py` has been changed to accept a `Path` object in addition to a
string or dictionary, improving the flexibility of the function and
allowing for easier file handling.
### Features:
- **Commit (8a5525f) by @ogabrielluiz**: The `getPythonCode` function in
`constants.tsx` now accepts a `tweaks` parameter which is used to
customize the behavior of the flow. A `buildTweaks` function generates
the `tweaks` object which is passed to the `load_flow_from_json`
function.
- **Commit (c5d6f48) by @ogabrielluiz**: Added a `build_and_install`
target to the `Makefile` to build the package and install it without
running it. This is useful for building and installing on a remote
server. Additionally, fixed the path to the `langflow.main` module in
the backend target of the `Makefile`.
### Documentation:
- **Commit (76a1265) by @ogabrielluiz**: Updated the Langflow API usage
example in `README.md` to reflect the new API endpoint URL. Added a new
optional `tweaks` parameter to the `run_flow` function for flow
customization and updated the example code accordingly.
### Other:
- **Commit (0dcd93e) by @lucaseduoli**: Added Discord and Twitter icons,
and GitHub stars.
- **Commit (0dcd93e) by @lucaseduoli**: Fixed the Twitter link.
The version number has been updated from 0.1.3 to 0.1.4. This is a chore commit as it does not introduce any new features or bug fixes, but rather updates the version number to reflect changes made in the package.
✨ feat(chat.py): add progress logging to stream_build function
The variable node was renamed to vertex to improve semantics and consistency with the naming conventions. Progress logging was added to the stream_build function to provide feedback to the user on the progress of the build process.
🐛 fix(index.tsx): fix typo in setSuccessData function call
✨ feat(index.tsx): add success logging to handleBuild function
A typo in the setSuccessData function call was fixed. Success logging was added to the handleBuild function to provide feedback to the user on the success of the build process.
The path to the langflow.main module was incorrect, causing the backend target to fail. The path has been updated to the correct location.
The build_and_install target has been added to build the package and install it without running it. This is useful when the package needs to be built and installed on a remote server.
🐛 fix(Makefile): fix path to langflow.main module in backend target
The input parameter now accepts a Path object in addition to a string or dictionary. This improves the flexibility of the function and allows for easier file handling.
The `getPythonCode` function now accepts a `tweaks` parameter which is used to customize the behavior of the flow. The `buildTweaks` function is called to generate the `tweaks` object which is then passed to the `load_flow_from_json` function. This allows for more flexibility in the usage of the flow.
The Langflow API usage example has been updated to reflect the new API endpoint URL. Additionally, a new optional `tweaks` parameter has been added to the `run_flow` function to allow customization of the flow. The example code has been updated to demonstrate how to use the `tweaks` parameter.
The fix_memory_inputs function was refactored to reduce nesting and improve readability. The function now checks if the langchain_object has a memory attribute and if it is not None before proceeding. The try-except block was also refactored to reduce nesting.
✨ feat(process.py): add input validation to process_tweaks function
The process_tweaks function has been refactored to improve readability and maintainability. The apply_tweaks function has been added to apply the tweaks to the node. The validate_input function has been added to validate the input parameters. The process_tweaks function now raises a ValueError if the input is not in the expected format.
🔀 refactor(base.py): import Chain from langchain.chains.base instead of importing it from langflow.graph.vertex.types
🔀 refactor(process.py): remove print statement from process_tweaks function
🔀 refactor(process.py): change load_flow_from_json function signature to accept optional tweaks parameter
🔀 refactor(process.py): change return type of build method in Graph class from List[Vertex] to Chain
🧪 test(loading.py): add test case for loading a flow from a JSON file and applying tweaks
🧪 test(loading.py): remove unused import statement
The import statement for Chain in base.py is now more explicit and imports it from langchain.chains.base instead of importing it from langflow.graph.vertex.types. The load_flow_from_json function in process.py now accepts either a JSON file path or a JSON object. The print statement in process_tweaks function has been removed. The load_flow_from_json function in process.py now accepts an optional tweaks parameter. The return type of the build method in the Graph class has been changed from List[Vertex] to Chain. A new test case has been added to loading.py to test loading a flow from a JSON file and applying tweaks. An unused import statement has been removed from loading.py.
🚀 chore(pyproject.toml): rename dev-dependencies to dev.dependencies
The Dockerfile now removes unnecessary files after installing dependencies to reduce the image size. The pyproject.toml file now uses the correct naming convention for dev dependencies, which is dev.dependencies instead of dev-dependencies.
The version number has been updated from 0.1.2 to 0.1.3 to reflect the changes made in the package. This is a chore commit as it does not add any new features or fix any bugs, but rather updates the version number.
✨ feat(__main__.py): add support for running Langflow on MacOS and Linux using gunicorn
The changes add support for running Langflow on Windows by using uvicorn instead of gunicorn. This is because Windows doesn't support gunicorn. The changes also add support for running Langflow on MacOS and Linux using gunicorn. This is because MacOS requires an env variable to be set to use gunicorn.
This commit updates the dependencies in the pyproject.toml file to their latest versions. Specifically, fastapi is updated to version 0.97.0, uvicorn is updated to version 0.22.0, typer is updated to version 0.9.0, rich is updated to version 13.4.2, llama-cpp-python is updated to version ~0.1.0, pyarrow is updated to version 12.0.0, and weaviate-client is updated to version 3.21.0.