Commit graph

13,209 commits

Author SHA1 Message Date
Nicolò Boschi
05044a3434
feat: migrate agents and toolkits to Component syntax (#2579)
* feat: migrate agents and toolkits to Component syntax

* fix mypy

* fix mypy

* [autofix.ci] apply automated fixes

* fix mypy

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-10 05:09:14 -07:00
Nicolò Boschi
9c41b0c895
fix: azure embeddings models with fixed dimensions fail (#2619)
* fix: azure embeddings models with fixed dimensions fail

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-10 04:53:23 -07:00
himan-k
7414a01235
fixing ThreadingInMemoryCache usage (#2604)
* ThreadingInMemoryCache usage is broken. This commit addresses those issues along with missing documentation about the caching options.

* make lint & make unit_tests fixes

* removing unnecessary changes from unclear test results in  last run

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-10 04:52:37 -07:00
Gabriel Luiz Freitas Almeida
d28fe8eedc
fix: Improve vertex filtering and update is_vertex_runnable logic (#2612)
* feat: improve is_vertex_runnable method in RunnableVerticesManager

This commit improves the `is_vertex_runnable` method in the `RunnableVerticesManager` class. It adds an additional parameter `activated_vertices` to the method signature and updates the logic to check if a vertex is runnable based on the presence of activated vertices. This enhancement improves the accuracy of determining whether a vertex is runnable or not.

* fix: add predecessors to vertices_to_run

* style: fix lint issues

* feat: optimize vertex filtering in useFlowStore

This commit optimizes the vertex filtering logic in the `useFlowStore` function in `flowStore.ts`. It introduces a more efficient way to filter out vertices that are already being built, resulting in improved performance and accuracy.

* refactor: add is_active method to Vertex class

This commit adds the `is_active` method to the `Vertex` class in the `base.py` file. The `is_active` method checks if the state of the vertex is set to `ACTIVE` and returns a boolean value accordingly. This enhancement improves the readability and maintainability of the codebase.

* refactor: improve is_vertex_runnable method in RunnableVerticesManager

* refactor: improve find_runnable_predecessors_for_successors method in Graph class

* refactor: move test_create_function
2024-07-10 07:40:16 -03:00
Jordan Frazier
46966d164d
tests: fix up the astra integ tests and add vectorize tests (#2616)
* fix up the astra integ tests and add vectorize tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-10 11:32:34 +02:00
Gabriel Luiz Freitas Almeida
34c1a4d469
fix: add timeout for unit tests workflows (#2613)
fix: add timeout for unit tests and test CLI in Python workflow
2024-07-09 19:08:39 -07:00
Cristhian Zanforlin Lousa
7174e6ef7d
fix: show loading component state while images arent fully loaded (#2609)
*  (ProfilePictureForm): add loading state to handle initial loading state

* ♻️ (use-get-profile-pictures.ts): refactor profile pictures query to process data on the server side
♻️ (ProfilePictureForm): simplify state management by removing redundant loading state

* ♻️ (use-get-profile-pictures.ts): rename ProfilePicturesResponse to ProfilePicturesQueryResponse for clarity
♻️ (use-preload-images.tsx): add loading check to useEffect to prevent unnecessary execution
♻️ (profilePictureChooserComponent): update profilePictures prop type to handle undefined and add loading to usePreloadImages
♻️ (ProfilePictureForm): remove unnecessary state and use response directly from useGetProfilePicturesQuery

* 🐛 (use-preload-images.tsx): add missing dependency 'loading' to useEffect dependency array to ensure images are preloaded correctly
2024-07-09 19:57:46 -03:00
Cristhian Zanforlin Lousa
0df06c01b0
fix: re-implement logic to correctly save or update flow in the appropriate folder on autologin = false (#2610)
♻️ (frontend): remove unused imports and variables in cardComponent
 (authContext): add setAllFlows and setSelectedFolder to AuthProvider
 (undrawCards): add folderIdUrl for better URL handling
 (collectionCard): add folder URL handling for navigation
 (use-delete-multiple): add setAllFlows and setSelectedFolder to handleDeleteMultiple
 (componentsComponent): add isLoadingFolders and setSelectedFolder
 (tabsComponent): add folder URL handling for tab navigation
 (flowsManagerStore): add folder URL handling in saveFlowDebounce

 (foldersStore.tsx): add setSelectedFolder method to manage selected folder state
♻️ (foldersStore.tsx): move setIsLoadingFolders call to improve loading state management
 (flowsManager/index.ts): add folderId parameter to saveFlow and saveFlowDebounce methods for better flow management
 (folders/index.ts): add setSelectedFolder method to FoldersStoreType for better folder state management
2024-07-09 15:29:52 -07:00
Gabriel Luiz Freitas Almeida
fd36938a03
feat: update custom component attributes on /update endpoint (#2607)
feat: Update custom component attributes with load from DB fields

This commit updates the `custom_component_update` endpoint in `endpoints.py` to include the logic for updating custom component attributes with load from DB fields. The `cc_instance` is checked for the presence of a `set_attributes` method, and if it exists, the template and parameters are extracted from the code request. The load from DB fields are identified and used to update the parameters. Finally, the `set_attributes` method is called with the updated parameters. This enhancement improves the flexibility and functionality of custom components.
2024-07-09 11:29:30 -07:00
Gabriel Luiz Freitas Almeida
06464eda46
feat: adds NVIDIA components (#2591)
* chore: Update langchain-nvidia-ai-endpoints dependency to version 0.1.2

* feat: Add NVIDIAEmbeddingsComponent for generating embeddings using NVIDIA models

* feat: Add NVIDIAModelComponent for generating text using NVIDIA LLMs

* feat: Add NvidiaRerankComponent for reranking documents using the NVIDIA API and a retriever

* fix: add type ignore

* chore: Update NVIDIAEmbeddingsComponent and NVIDIAModelComponent to handle type ignore

* chore(poetry.lock): update lock
2024-07-09 15:26:23 -03:00
João Pedro Miranda C. Hluchan
a6f128c4cf
Add CrewAI Component Documentation (#2519)
* feat: CrewAI components static files

* feat: CrewAI add .md guide files

* feat: CrewAI add CrewAI_components_bundle.json

* chore: Comment out CrewAI section in sidebars.js

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-09 17:01:11 +00:00
Nicolò Boschi
e7e53abfbe
fix: astra vectorize auth error (#2606) 2024-07-09 17:23:30 +02:00
Gabriel Luiz Freitas Almeida
063cf54495
fix: update test_create_function to use pathlib.Path (#2605)
feat(test_validate_code.py): update test_create_function to use pathlib.Path instead of math.sin to check if it breaks ci
2024-07-09 08:16:50 -07:00
Gabriel Luiz Freitas Almeida
c20630b77d
fix: add vertices in the first layer to the vertices being run (#2594) 2024-07-09 12:03:55 -03:00
Nicolò Boschi
21adbd5531
fix: stream option is not working with tracing enabled (#2602)
* fix: cannot create 'generator' instances

* fix: cannot create 'generator' instances

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-09 13:37:47 +00:00
ming
ce9b4b09e5
feat: exception and error middleware (#2590)
exception and error middleware
2024-07-09 06:13:18 -07:00
Gabriel Luiz Freitas Almeida
4c43b4cc82
fix(runnable_vertices_manager.py): add recursive function to find predecessors (#2593)
fix(runnable_vertices_manager.py): add recursive function to find runnable predecessors
2024-07-08 22:14:36 +00:00
anovazzi1
311b66361e
fix: make chat lock when building (#2592)
Fix:lock chat bug
2024-07-08 14:22:00 -07:00
Gabriel Luiz Freitas Almeida
0d99bd3971
feat: update dependencies to add crewai (#2588)
Update the dependencies in `pyproject.toml` to their latest versions. Specifically, update `chromadb` to version `0.4`, `docstring-parser` to version `0.16`, and `crewai` to version `0.36.0`. This ensures that the project is using the most up-to-date packages and improves compatibility and stability.
2024-07-08 14:14:32 -07:00
skipandsnow
da2cab5a91
fix: Qdrant shows Qdrant.from_documents() missing 1 required positional argument: ‘embedding’ (#2587)
fixes the error
2024-07-08 21:08:58 +00:00
anovazzi1
ca3367d8e5
fix: Refactor messages API and session view (#2577)
* feat: create boilerplate code for messages api

* centering functionality on one component

* refactor useGetMessages

* update to new type format

* refactor Session view and get messages logic

* update to session view to useGetMessageQuery

* remove old api call

* feat: create boilerplate code for messages api

* centering functionality on one component

* refactor useGetMessages

* update to new type format

* refactor Session view and get messages logic

* update to session view to useGetMessageQuery

* remove old api call

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
2024-07-08 14:05:31 -07:00
Gabriel Luiz Freitas Almeida
38b10b02df
feat: add vertices_being_run set to RunnableVerticesManager (#2589)
* refactor(base.py): remove unnecessary conditional statements for adding edges to predecessor and successor maps in Graph class

* refactor(graph/base.py): optimize the process of adding vertices to the set and updating the predecessor map in the Graph class

* refactor(graph/base.py): remove unnecessary line that adds vertex_id to vertices_ids set
refactor(graph/base.py): fix indentation for predecessor_map and successor_map dictionaries to improve code readability

* feat: Add vertices_being_run set to RunnableVerticesManager

This commit adds a new set called `vertices_being_run` to the `RunnableVerticesManager` class. This set keeps track of vertices that are currently running. The purpose of this set is to prevent a vertex from being considered runnable if it is already being run.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* chore: Remove unnecessary vertex from next_runnable_vertices in RunnableVerticesManager

* feat: Update vertices_to_run logic in retrieve_vertices_order function

This commit updates the logic for retrieving the vertices to run in the `retrieve_vertices_order` function in `chat.py`. The previous implementation used the `list` function to convert the `vertices_to_run` set to a list and then concatenated it with the result of the `get_top_level_vertices` function. The updated logic uses the `union` method to combine the two sets directly. This change improves the efficiency and readability of the code.

* refactor(graph/base.py): optimize the process of adding vertices to the set and updating the predecessor map in the Graph class
2024-07-08 13:48:20 -07:00
Gabriel Luiz Freitas Almeida
46b7911110
test(test_webhook): change component in webhook test to be async (#2578)
* feat: Add aiofiles package for asyncio file support

* fix: add async component in webhook test flow

* refactor: deactivate astra db test

* refactor: remove AstraDB test and related code

* feat: add component that makes an async api call

* chore: Update langsmith and sentry-sdk dependencies to latest versions
2024-07-08 09:38:22 -07:00
Gabriel Luiz Freitas Almeida
7e222187e4
fix: remove redundant superuser only if it has never logged in (#2582)
fix: Remove redundant superuser only if it has never logged in

The code changes in `utils.py` check if the superuser exists and if it has never logged in. If both conditions are true, the superuser is deleted from the database. This improves the efficiency and security of the application.
2024-07-08 16:37:03 +00:00
feiyang_deepnova
4d5a0df8d1
fix: the pythonfunction test error (#2572)
fix the test error
2024-07-08 15:48:33 +00:00
Lucas Oliveira
74433bf023
fix: outdated code conditions and global variable (#2581)
* Fixed Check Code Validity to set outdated as false when type does not exist

* feat: Refactor update_template_values function

Refactor the `update_template_values` function to improve code readability and maintainability. Rename the parameters `frontend_template` to `new_template` and `raw_template` to `previous_template` for clarity. Update the variable names within the function accordingly.

* feat(update_template_field): update load_from_db in case field value is not the default

* refactor: update template values in PromptComponent

Update the `update_template_values` function in the `PromptComponent` class to improve code readability and maintainability. Rename the parameters `frontend_template` to `new_template` and `raw_template` to `previous_template` for clarity. Update the variable names within the function accordingly.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-08 15:23:03 +00:00
Jordan Frazier
2736d5920b
docs: small updates to vectorize docs (#2580)
* small updates to vectorize docs

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-08 08:17:56 -07:00
Nicolò Boschi
8339fcf0d8
fix: astradb ingests twice (#2573) 2024-07-08 04:21:34 -07:00
ming
7dcc716811
fix: remove redundant and incorrect health check (#2571)
remove redundant health check and incorrect checks
2024-07-08 09:34:47 +02:00
ming
f6636551bb
feat: inmemory and async cache expire configurable (#2496)
inmemory and async cache expire configurable
2024-07-08 09:19:42 +02:00
Gabriel Luiz Freitas Almeida
7abf697b7b
fix: update run_manager on state changes (#2560)
* feat: update RunnableVerticesManager to include an update_run_state method

* feat: refactor build_run_map method in RunnableVerticesManager

This commit refactors the `build_run_map` method in the `RunnableVerticesManager` class. Instead of directly accessing the `graph` object, it now takes `predecessor_map` and `vertices_to_run` as parameters. This improves code readability and maintainability.

* fix(state): set vertices_to_run and predecessor_map correctly when updating a state

* fix: set inactive vertices to active when updating graph

* fix: add conditions to avoid duplicated vertices in maps

This commit fixes a bug in the Graph class where the predecessor and successor maps were not being updated correctly. The bug caused incorrect mapping of edges in the graph. This fix ensures that the maps are updated properly when adding edges to the graph.

* refactor: fix vertex build response in chat.py

This commit fixes the `build_vertex` function in `chat.py` to correctly handle the `VertexBuildResponse` object. The `inactivated_vertices`, `next_vertices_ids`, and `top_level_vertices` attributes are now converted to lists to remove any duplicate values. This ensures that the response object contains unique values for these attributes. The fix improves the accuracy and reliability of the vertex build process.

* style(graph/base.py): update type annotations for predecessor_map and successor_map variables to improve code readability and maintain consistency

* fix: uncomment code for stopping build in MenuBar component
2024-07-06 22:54:25 -04:00
Rodrigo Nader
64880850ce
Update README.md 2024-07-06 16:36:21 -03:00
Alexandre E. Souza
6257a32523
fix(QDrant): Resolve bug in document search functionality (#2518)
* Update Qdrant.py

fixed embeddings and distance_func for search_documents issue #2517

* [autofix.ci] apply automated fixes

* fixed documents link

* update params Qdrant

* Update Qdrant.py

* Update Qdrant.py

* Update Qdrant.py

* [autofix.ci] apply automated fixes

* Update args

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-06 10:06:00 -07:00
Gabriel Luiz Freitas Almeida
9e6fe193c9
chore: update version to 1.0.7 in pyproject.toml (#2562)
* chore: update version to 0.0.83 in pyproject.toml

* chore: update version to 1.0.7 in pyproject.toml

---------

Co-authored-by: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
2024-07-06 10:05:21 -07:00
dependabot[bot]
ac469531ea
chore(deps): bump certifi from 2023.11.17 to 2024.7.4 (#2566)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.11.17 to 2024.7.4.
- [Commits](https://github.com/certifi/python-certifi/compare/2023.11.17...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-06 10:04:19 -07:00
Gabriel Luiz Freitas Almeida
1d8362c9c1
fix: add user to database if not present in health_check (#2564)
* fix: add user to database if not already present in health_check

The code changes in `health_check_router.py` add functionality to check if a user with a specific ID exists in the database. If the user does not exist, the code adds the user to the database with the necessary details. This ensures that the user is present in the database for further processing in the health check.

* style(health_check_router): format
2024-07-05 20:33:26 +00:00
Cristhian Zanforlin Lousa
e63479556c
fix: add click event on button to retry check connection to backend (#2558)
♻️ (App.tsx): remove console.log statement from setRetry function
🐛 (fetchErrorComponent): add onClick handler to Retry button to ensure retry logic is executed
2024-07-05 16:57:20 +00:00
Nicolò Boschi
eb3420523e
feat: migrate chains and memories to Component syntax (#2528)
* feat: migrate chains and memories to Component syntax

* use base class

* add classes

* [autofix.ci] apply automated fixes

* fix tests

* fix tests

*  (filterSidebar.spec.ts): increase waitForTimeout from 1000ms to 2000ms to ensure elements are fully loaded before interaction

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
2024-07-05 16:30:23 +00:00
Gabriel Luiz Freitas Almeida
5d9b29e2ae
fix: make sure old secret keys are handled as before (#2557)
* refactor: add padding function for string in auth utils

* fix(auth utils): run add_padding if the secret_key is valid
2024-07-05 09:11:03 -07:00
Gabriel Luiz Freitas Almeida
5da1130f84
chore: add --ignore=tests/integration flag from pytest command in pyproject.toml and remove unit (#2468)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-05 16:08:44 +00:00
Carlos Coelho
bc6b846454
fix: change DirectoryComponent to filter file paths by types (#2391)
* Refactor DirectoryComponent to filter file paths by types

* fix: sets types is_list to True

* chore: Remove Optional from load_directory method signature

* chore: Update return type annotation for load_directory method

* style(GroqModel.py): improve code readability by fixing indentation and adding a comment for type hint ignore in ChatGroq instantiation.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-05 12:17:14 -03:00
Gabriel Luiz Freitas Almeida
e536272759
fix(langflow): handle KeyboardInterrupt and terminate process in run function for graceful shutdown (#2551)
* fix(langflow): handle KeyboardInterrupt and terminate process in run function for graceful shutdown

* refactor(langflow): remove unnecessary try-except block and sys.exit calls in run_langflow function

* fix(langflow): handle exceptions properly and exit with appropriate status codes

* refactor: update multiprocess imports in langflow/__main__.py

Adds type ignore
2024-07-05 15:04:33 +00:00
codeflash-ai[bot]
4954b3fa66
perf: ️ Speed up convert_kwargs() by 9% in src/backend/base/langflow/interface/initialize/loading.py (#2529)
* refactor(base.py): refactor logic to find start_component_id based on multiple keywords for improved flexibility and readability

* feat(schema.py): add WebhookInput component type to INPUT_COMPONENTS list for handling webhook inputs in the graph schema

* refactor(base.py): refactor logic to determine start_component_id based on webhook or chat component presence in input vertices

* refactor: prioritize webhook component for determining start_component_id

* ️ Speed up convert_kwargs() by 9%
To optimize the given Python program, we can focus on a few key areas.

1. **Avoid Repeated Lookups:** Instead of repeatedly looking up keys and values in the dictionary, we can iterate over items directly.
2. **Efficient JSON Parsing:** Using `orjson` is already a good choice for performance. We will handle the exception based on `orjson` capabilities.
3. **In-place Modification:** We can modify the dictionary in place without creating additional lists.

Here is the optimized program.



### Changes Made.

1. **Direct Looping:** We iterate directly over `params.items()` to process keys and values together, which helps avoid multiple lookups.
2. **Exception Handling:** We catch `orjson.JSONDecodeError` directly, avoiding unnecessary import and potential mismatches.
3. **Deferred Removal:** We collect keys to remove in `items_to_remove` and then remove them outside the loop, which helps avoid modification issues during iteration.

This should result in more efficient iteration and handling while reducing overhead from unnecessary operations.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-05 07:51:50 -07:00
Igor Carvalho
6f827ca3dd
fix: pasting files not working (#2548)
* fix: pasting files not working

* [autofix.ci] apply automated fixes

* refactor: change new import

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-05 13:57:48 +00:00
Gabriel Luiz Freitas Almeida
6488b0247e
ci: add delete-reports job to delete if all jobs succeed (#2542)
chore: Add conditional step to delete-reports job in TypeScript test workflow
2024-07-05 10:56:27 -03:00
anovazzi1
eed5a6390a
fix: version display (#2555)
* fix version

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-05 13:38:58 +00:00
Gabriel Luiz Freitas Almeida
3900c58983
fix(ordering): correctly remove vertex from list of runnable vertices (#2554) 2024-07-05 13:30:54 +00:00
anovazzi1
46f82a6af4
fix: update use-get-health.ts (#2553)
* update getHealth function to use options param

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-05 13:18:38 +00:00
ming
c444a6905c
feat: opentelemetry and prometheus (#2543)
* opentelemetry and prometheus

* set env override in create_app

* add prometheus_client to pyproject

* update top level poetry.lock
2024-07-05 12:50:53 +00:00
Lucas Oliveira
6b3f34da77
fix: refactor of api structure (#2544)
* Refactored mutation and query types and callables

* Refactored version and other queries to new way of calling function

* update type declaration to support options

* update getVersionQuery

* [autofix.ci] apply automated fixes

* update type declaration to remove on Fetch options

* remove onFetch from version

* update transactions query

* [autofix.ci] apply automated fixes

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-07-05 12:44:10 +00:00