Commit graph

559 commits

Author SHA1 Message Date
Ítalo Johnny
d93382e90a
refactor: runnable_vertices_manager.py (#2646)
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-15 17:57:00 +00:00
Gabriel Luiz Freitas Almeida
c47c358cad
feat: add payload validation, update Simple API Test fixture, run tests (#2664) 2024-07-12 18:15:43 +00:00
Nicolò Boschi
ab0ab5f306
perf: improve /logs concurrent access (#2633)
* perf: improve /logs concurrent access

* perf: improve /logs concurrency access

* fix

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-11 15:06:34 +00:00
ming
81849d5f8b
feat: log retriever endpoint (#2601)
* log retriever endpoint

* disabled by default

* realtime log stream via http/2 SSE

* read and write lock

* unit test
2024-07-11 11:19:21 +02:00
ming
7bd105007e
feat: add opentelemetry utility functions and unit tests (#2570)
* add opentelemetry utility functions and unit tests

* review comments

* add label validation
2024-07-10 15:01:38 -04:00
Ítalo Johnny
aa1958a4ad
feat: refactor graph vertex sorting (#2583)
* refactor: extract method from class to new func

* test: add new tests

* refactor: simplify funcs to improve readability

* refactor: extract new func from larger func

* refactor: remove recursion from func

* refactor: remove coupling with graph and vertex

* refactor: create adapter funcs to use new code

* refactor: add test for sorting up to vertex N with is_start=True

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-10 07:37:39 -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
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
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
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
feiyang_deepnova
4d5a0df8d1
fix: the pythonfunction test error (#2572)
fix the test error
2024-07-08 15:48:33 +00:00
Gabriel Luiz Freitas Almeida
03329b232e
fix: make webhook api call honor webhook component as input (#2511)
* 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

* feat(utils.py): add function find_start_component_id to find component ID based on priority list of input types

* refactor(graph/base.py): refactor logic to find start component id in Graph class for better readability and maintainability

* test(test_webhook.py): override pytest fixture to check for OpenAI API key in environment variables before running tests

* test(test_webhook.py): update webhook json

* feat(schema.py): update WebhookInput component type name

* refactor: log package run telemetry in simplified_run_flow

* test: add test for webhook flow on run endpoint

* refactor(graph/base.py): skip unbuilt vertices when getting vertex outputs in Graph class

* refactor: simplify data_input assignment in LCTextSplitterComponent

* refactor: remove unused build method in CharacterTextSplitterComponent

* refactor: update imports in CharacterTextSplitter.py
2024-07-04 11:11:55 -07:00
Nicolò Boschi
2787bec4fb
ci: skip tests with openai key required (#2477)
* ci: skip tests with openai key required

* ci: skip tests with openai key required

* ci: skip tests with openai key required

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-02 06:20:13 -07:00
Gabriel Luiz Freitas Almeida
32e12cf72a
refactor: move langflow api tests into integration tests (#2469) 2024-07-01 15:25:56 -07:00
Rodrigo
093fa018f1 feat: Add CreateListComponent for creating a list of texts
This commit adds a new component called CreateListComponent, which is responsible for creating a list of texts. The component takes in one or more texts as input and outputs a list of Data objects. This component is useful for scenarios where a list of texts needs to be processed or manipulated.

The CreateListComponent class is added to the helpers module in the langflow.components package. It includes the necessary inputs and outputs, as well as a create_list method that generates the list of Data objects based on the input texts.

This commit also includes some minor changes to other files, such as renaming the UUIDGeneratorComponent to IDGeneratorComponent and updating import statements.
2024-07-01 13:53:55 -03:00
Gabriel Luiz Freitas Almeida
d1f17db404 feat: Add test for webhook with random payload 2024-07-01 13:53:38 -03:00
Gabriel Luiz Freitas Almeida
802425c7de Refactor test_get_messages function to use list comprehension 2024-07-01 13:53:38 -03:00
Gabriel Luiz Freitas Almeida
d1d5eb6e39 refactor: Update add_messages and add_messagetables functions to return Message objects 2024-07-01 13:53:37 -03:00
Gabriel Luiz Freitas Almeida
f56965b16f (test_messages.py): Add unit tests for message handling functions in langflow module. 2024-07-01 13:53:37 -03:00
Gabriel Luiz Freitas Almeida
5ad37a16bf refactor: Remove unused imports and test adding messages 2024-07-01 13:53:37 -03:00
Gabriel Luiz Freitas Almeida
b81ea11edd refactor: Add test for adding messages 2024-07-01 13:53:37 -03:00
Gabriel Luiz Freitas Almeida
f0a0a483e9 test: add messages tests 2024-07-01 13:53:37 -03:00
Gabriel Luiz Freitas Almeida
fff4537b1e
Fixes CLI and server (#2342)
* chore: update linting workflows to include dev branch in merge_group

* Update README.md

Add 1.0 banner

* Update README.md

* chore: update package versions in pyproject.toml files

* Refactor "created_at" column type for consistency and fix cancel middleware (#2316)

* chore: update linting workflows to include dev branch in merge_group

* Update README.md

Add 1.0 banner

* Update README.md

* chore: update package versions in pyproject.toml files

* refactor: update "created_at" column type to use the "sa" module for consistency

* Update README.md

Add 1.0 banner

* chore: Remove unused import in ToolCallingAgent.py

* fix: adapt RequestCancelledMiddleware to handle cancelled requests

* chore: Remove unused import in test_helper_components.py

* refactor: Declare queue variable with explicit type in RequestCancelledMiddleware

---------

Co-authored-by: Rodrigo Nader <rodrigosilvanader@gmail.com>

* chore: Update AstraDB.py imports and method signature for search_documents

* chore: Update package versions in pyproject.toml files

* chore: Update run-name in release.yml for Langflow Release

* fix: add call to _add_documents_to_vector_store in AstraDB component

* chore: Fix missing parentheses in RequestCancelledMiddleware

* chore: Update pydantic-settings and tenacity versions

The commit updates the versions of the `pydantic-settings` and `tenacity` packages in the `poetry.lock` file. The `pydantic-settings` version is updated from 2.3.3 to 2.3.4, and the `tenacity` version is updated from 8.4.1 to 8.4.2.

* Update README.md

Add 1.0 banner

* fix fetch data to work even with autologin true

* format code

* deactivate stop button until we have a better solution (#2337)

* consistent auth error status code

* [Fix] unhandled http errors in background tasks (#2326)

* handle exceptions for background task

* revert changes that is not related to this HTTP handler exception

* Refactor model GoogleGenerativeAIModel (#2251)

* refactor model GoogleGenerativeAIModel

* adds model options

---------

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

* Fix .env values not being honored in CLI (#2336)

* chore: Update launch.json to include environment file

The launch.json file was updated to include the environment file path for the "run" command in the "Python: Flask" configuration. This change ensures that the necessary environment variables are loaded when running the backend base of Langflow frontend. The previous configuration had the environment variables set in the "env" field, but it has been removed as it is redundant with the new environment file inclusion.

* chore: Update dotenv import and environment variable handling

This commit updates the import statement for the `dotenv` module in the `__main__.py` file. It adds the `dotenv_values` function to the import statement to enable loading environment variables from a file. Additionally, it introduces a new section of code that maps environment variables to their corresponding variables and types, allowing for more flexible and dynamic configuration. The commit also updates the `run` function to update variables based on environment variables, if they are present. This change improves the handling of environment variables and enhances the configurability of the application.

* deactivate stop button until we have a better solution (#2337)

* consistent auth error status code

* [Fix] unhandled http errors in background tasks (#2326)

* handle exceptions for background task

* revert changes that is not related to this HTTP handler exception

* Refactor model GoogleGenerativeAIModel (#2251)

* refactor model GoogleGenerativeAIModel

* adds model options

---------

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

---------

Co-authored-by: ming luo <itestmycode@gmail.com>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>

* Update GitHub Actions workflows and dependencies (#2341)

* chore: Add GitHub Actions workflow for testing documentation build

* Fix server start command in GitHub Actions workflows

* chore: Bump langflow and langflow-base versions

* chore: Update GitHub Actions workflow for docs_test

* chore: Update typing import in __main__.py

* Fix user authentication and authorization issues (#2343)

---------

Co-authored-by: Rodrigo Nader <rodrigosilvanader@gmail.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: ming luo <itestmycode@gmail.com>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
2024-06-25 09:20:55 -07:00
Gabriel Luiz Freitas Almeida
d85657f214
Refactor "created_at" column type for consistency and fix cancel middleware (#2316) (#2320)
* chore: update linting workflows to include dev branch in merge_group

* Update README.md

Add 1.0 banner

* Update README.md

* chore: update package versions in pyproject.toml files

* Refactor "created_at" column type for consistency and fix cancel middleware (#2316)

* chore: update linting workflows to include dev branch in merge_group

* Update README.md

Add 1.0 banner

* Update README.md

* chore: update package versions in pyproject.toml files

* refactor: update "created_at" column type to use the "sa" module for consistency

* Update README.md

Add 1.0 banner

* chore: Remove unused import in ToolCallingAgent.py

* fix: adapt RequestCancelledMiddleware to handle cancelled requests

* chore: Remove unused import in test_helper_components.py

* refactor: Declare queue variable with explicit type in RequestCancelledMiddleware

---------

Co-authored-by: Rodrigo Nader <rodrigosilvanader@gmail.com>

* chore: Update AstraDB.py imports and method signature for search_documents

* chore: Update package versions in pyproject.toml files

* chore: Update run-name in release.yml for Langflow Release

* fix: add call to _add_documents_to_vector_store in AstraDB component

---------

Co-authored-by: Rodrigo Nader <rodrigosilvanader@gmail.com>
2024-06-24 13:15:54 -07:00
Gabriel Luiz Freitas Almeida
0268c7c0dd refactor: remove unused tests 2024-06-24 05:42:46 -07:00
Gabriel Luiz Freitas Almeida
61c34915a9 refactor: update dict to model_dump 2024-06-23 18:35:21 -07:00
Gabriel Luiz Freitas Almeida
93a2164543 refactor: rename TextInput to MessageTextInput 2024-06-23 15:24:11 -07:00
Gabriel Luiz Freitas Almeida
8d25605de4 chore: Build vector store in test_astra_setup 2024-06-22 12:32:54 -07:00
Gabriel Luiz Freitas Almeida
6e88eab7f5 chore: Remove unused vector search component and update vector store parameters format 2024-06-22 12:32:54 -07:00
ming luo
20f7c6757f mock kube-config 2024-06-21 20:55:42 -07:00
ming luo
17adc8b5a5 fix unit test 2024-06-21 20:55:42 -07:00
ming luo
1bf668a941 kubernetes secret manager 2024-06-21 20:55:42 -07:00
Gabriel Luiz Freitas Almeida
cad13f17c3 refactor: Update test_data_components.py to assert file_dict instead of result.text in test_directory_without_mocks 2024-06-21 15:46:17 -03:00
Gabriel Luiz Freitas Almeida
2e1bc10661 refactor: Update WebhookComponent to use MultilineInput for data field 2024-06-20 21:27:38 -03:00
Gabriel Luiz Freitas Almeida
29759f2c3e refactor: Rename test_record.py to test_data_class.py and update imports and references accordingly 2024-06-20 21:27:37 -03:00
Gabriel Luiz Freitas Almeida
b7154f470a fix path to data folder 2024-06-20 19:08:40 -03:00
Gabriel Luiz Freitas Almeida
47c0522c7b Merge remote-tracking branch 'origin/dev' into two_edges 2024-06-20 13:41:00 -03:00
Nicolò Boschi
e3656a6a43
fix: "Flow" object has no field "last_tested_version" when loading flows from dir (#2221) 2024-06-19 18:15:50 +02:00
Nicolò Boschi
51c1aa1ec8 fix: graph process should raise the actual error when failing 2024-06-19 08:46:09 -07:00
Nicolò Boschi
e45737aaaa fix: graph process should raise the actual error when failing 2024-06-19 08:46:09 -07:00
Nicolò Boschi
818dfa7c6d
ci: skip test run_flow_from_json_object (#2227)
ci: skip test test_run_flow_from_json_object
2024-06-19 11:11:59 -04:00
Nicolò Boschi
6e49a2ec3b
fix test: test_data_components.test_directory_without_mocks (#2223) 2024-06-19 08:41:51 -04:00
ogabrielluiz
be88c25dac Add io module for easier access to Inputs and Outputs 2024-06-19 01:22:59 -03:00
ogabrielluiz
b475e51c51 refactor: Update AstraDBMessageWriterComponent to use AstraVectorStoreComponent
This commit updates the AstraDBMessageWriterComponent class in the AstraDBMessageWriter.py file to use the AstraVectorStoreComponent for vector storage. By making this change, we ensure consistency and improve code organization. This update aligns with recent changes in the AstraDBVectorStoreComponent and promotes code reuse.
2024-06-19 01:07:05 -03:00
ogabrielluiz
74af14b373 refactor: Update docs_path in test_data_components.py to fix directory path
The code changes in test_data_components.py update the `docs_path` variable to fix the directory path for loading components. The previous path was incorrect, and this update ensures that the correct path is used. This refactor improves the accuracy and reliability of the code.
2024-06-18 22:42:14 -03:00
ogabrielluiz
412a793a4c refactor: Update DocumentsToDataComponent class name in test_helper_components.py
The code changes in test_helper_components.py update the class name from DocumentToDataComponent to DocumentsToDataComponent. This refactor improves the clarity and consistency of the code.
2024-06-18 22:42:06 -03:00
ogabrielluiz
ca95e66b88 (test_custom_component.py): update test_custom_component_get_function_entrypoint_args to reflect correct number of arguments in build method
📝 (test_custom_component.py): reorganize import statements for better readability and consistency
♻️ (test_custom_component.py): refactor build method in YourComponent class to simplify and improve code readability
2024-06-18 22:41:57 -03:00
ogabrielluiz
98e3f4bdaa refactor: Update langflow custom components to use specific input classes
The code changes update the langflow custom components to use specific input classes, such as IntInput and TextInput, instead of the generic field types. This refactor improves the clarity and type safety of the code.
2024-06-18 22:41:10 -03:00
ogabrielluiz
df04a329cc Update webhook test case 2024-06-18 22:17:35 -03:00