Commit graph

6,115 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
d9a9401e3b
fix: ensure cache is set for graph in build flow (#3531)
added a condition to set the cache for the graph when it is built.

this ensures that the latest graph state is stored in the chat service.
2024-08-23 10:08:38 -07:00
Gabriel Luiz Freitas Almeida
189ef4147d
fix: update serialization and improve error handling (#3516)
* feat(utils): add support for V1BaseModel in serialize_field

Add support for V1BaseModel instances in the serialize_field function by
checking for a "to_json" method. If the method is not present, return the
attribute values as a dictionary.

* refactor: Update field serializer function and error handling in build_flow function
2024-08-23 06:30:42 -07:00
Gabriel Luiz Freitas Almeida
7e7d5a1a1c
refactor: improve metric creation logic and silence ot warnings (#3207)
refactor(opentelemetry.py): enhance metric creation logic warnings and improved metric handling methods
2024-08-23 12:51:36 +00:00
Ítalo Johnny
8e733ce580
fix: build version notification function (#3527)
fix: added try/except block to version notification function
2024-08-23 09:15:54 -03:00
hotamago
2896c72e99
feat: Enhance Chroma Handling, Bug Fixes & add GoogleGenerativeAIEmbeddingsComponent (#3476)
* Update Chroma.py

* Update utils.py

* Create GoogleGenerativeAIEmbeddings.py

* Update __init__.py

* Update GoogleGenerativeAIEmbeddings.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/embeddings/GoogleGenerativeAIEmbeddings.py

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

---------

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-08-23 04:45:13 -07:00
Gabriel Luiz Freitas Almeida
4e15090927
fix: check if variable is valid before converting (#3514)
* feat: Add logging and session imports to endpoints.py

Import logging and session modules for better error handling and database interaction in endpoints.py.

* refactor: Improve custom component parameter handling in update endpoint

* feat: Add parse_value function to parse values based on input type

Add a new function `parse_value` to `utils.py` that parses values based on the input type provided. The function handles different input types such as 'IntInput' and 'FloatInput' to ensure proper parsing.

* feat: Refactor custom_component_update() to use parse_value utility function

Use parse_value utility function to handle different input types and empty values in custom_component_update() for better readability and maintainability.
2024-08-22 21:27:36 +00:00
Gabriel Luiz Freitas Almeida
9d5f97acf2
chore: remove locust dependency (#3513)
Remove it so we don't have flask-cors as a dependency because of a vulnerability
2024-08-22 20:44:05 +00:00
Gabriel Luiz Freitas Almeida
a98e07e1a2
feat: Update project name retrieval in LCModelComponent and CustomComponent (#3506)
Return the project name using get_project_name method in both classes.
2024-08-22 19:13:22 +00:00
Gabriel Luiz Freitas Almeida
6d048b2d2c
refactor: add fixtures for client in test files to speed them up (#3490)
refactor: Add fixtures for client in test files to speed them up
2024-08-22 12:08:47 -07:00
Gabriel Luiz Freitas Almeida
2eca4d9e32
refactor: move import statement inside function to avoid unnecessary imports (#3505)
* fix: Add exception handling for missing langchain_anthropic package

* refactor: Move import statement for get_starter_projects_dump in get_starter_projects

* chore: Modify logger to use error level for exception in directory_reader
2024-08-22 07:56:36 -07:00
Gabriel Luiz Freitas Almeida
1e5aa0c2cf
feat: Add import check for langchain_aws module in AmazonBedrockComponent (#3492) 2024-08-21 19:09:12 -07:00
Gabriel Luiz Freitas Almeida
3623d9ac9c
chore(starter-projects): Update OpenAIModelComponent inputs and build_model method (#3489) 2024-08-21 18:35:59 -07:00
Gabriel Luiz Freitas Almeida
300e79f70c
build: Update langflow-base and langflow versions to 0.0.94 and 1.0.16 respectively. (#3455) 2024-08-21 18:07:32 -07:00
Gabriel Luiz Freitas Almeida
40237d0631
fix: improve end_traces so it doesn't block the build loop (#3482)
* refactor: Simplify log configuration logic in Graph class

* feat(tracing): Refactor _end_traces method to be async and use asyncio.to_thread.

This is an attempt to avoid blocking the build loop
2024-08-21 18:06:41 -07:00
Jordan Frazier
96ca71dab8
fix: moves caching of vector store to LCModelComponent level (#3435)
* refactor LCModelComponent to use a cached vector store to prevent multiple embeddings
2024-08-21 14:38:06 -07:00
Rodrigo Nader
a700ea003d
feat: remove api key from advanced and update HuggingFace components (#3397)
* feat:  remove api key from advanced

* refactor: 🎨 improve naming and descriptions

* fix: 🐛 Fix hf api component

* [autofix.ci] apply automated fixes

* feat: 🎨 Add default values

* [autofix.ci] apply automated fixes

* fix: 🐛 fix hf api component

* [autofix.ci] apply automated fixes

* feat: 🔥 remove hugging face embeddings (local)

* refactor: Removed HuggingFaceEmbeddingsComponent from __init__.py

---------

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-08-21 19:22:20 +00:00
MaxZhang
5ffaa78e1c
fix: allow setting temperature to 0 in OpenAIModel.py (#3465)
Update OpenAIModel.py- Fix can not set temperature to 0 bug.

As when the input temperature is 0, the condition would become False , so this expressing set it to 0.1, it become impossible to set it to 0.
2024-08-21 19:12:42 +00:00
Cristhian Zanforlin Lousa
1db1e3af3d
feat: add LANGFLOW_AUTO_SAVING_INTERVAL .env variable for flow auto-saving debounce (#3478)
* 📝 (langflow): Add support for configuring auto saving interval for Langflow
📝 (langflow): Update ConfigResponse and Settings to include auto_saving_interval
📝 (frontend): Update useGetConfigQuery and useSaveConfig to handle auto_saving_interval
📝 (frontend): Update useAutoSaveFlow and flowsManagerStore to handle auto saving interval

* 📝 (util.py): add support for setting auto_saving_interval in update_settings function to allow customization of auto-saving interval
2024-08-21 12:02:26 -07:00
Cristhian Zanforlin Lousa
8dd85d98b6
fix: auto_login=off error on login and editing a user + FE tests (#3471)
* 🐛 (users.py): Fix issue where user password was not being updated correctly
📝 (constants.ts, authContext.tsx, index.tsx): Add LANGFLOW_REFRESH_TOKEN constant and update related code to support refresh token functionality
📝 (userManagementModal/index.tsx): Update form reset logic and handle input values correctly
📝 (LoginPage/index.tsx, LoginAdminPage/index.tsx): Update login function to include refresh token parameter
📝 (components/index.ts, auth.ts): Update inputHandlerEventType to support boolean values

 (auto-login-off.spec.ts): Add end-to-end test for user login functionality with auto_login set to false, CRUD operations for users, and verification of user flows visibility based on permissions.

*  (auto-login-off.spec.ts): improve test description for better clarity and understanding
📝 (auto-login-off.spec.ts): add comments to clarify the purpose of intercepting requests and performing CRUD operations

* 🐛 (users.py): fix comparison of password to check for None using 'is not None' instead of '!= None' for better accuracy
2024-08-21 15:55:47 +00:00
Gabriel Luiz Freitas Almeida
bf650ecec5
refactor: improve attribute compatibility and error messages (#3367)
* feat: Refactor how configuration attributes are handled in Component class.

* refactor: Update method name to handle singular and plural inputs.

* refactor: Add value validation for input and attribute assignment.

* test: Add test for setting invalid input in task component.

* fix: add param without underscore to inputs

* test(astra): Refactor AstraDB imports in test_astra_component (#3413)

* test(astra): Refactor AstraDB imports in test_astra_component

* fix: Add AstraVectorizeComponent to AstraDB tests.

* fix: Refactor custom component error message for setting parameter or attribute.

* test(astra): Refactor AstraDB imports in test_astra_component (#3413)

* test(astra): Refactor AstraDB imports in test_astra_component

* fix: Add AstraVectorizeComponent to AstraDB tests.

* chore: Refactor joining methods list in _set_parameter_or_attribute function.

* refactor: Refactor error message string formatting in Component class.
2024-08-21 12:34:15 +00:00
Gabriel Luiz Freitas Almeida
0db81f01f7
feat: update sequential tasks agent starter project (#3449)
* feat: update sequential tasks starter project

* feat: Refactor task agents for Researcher, Editor, and Comedian on Sequential Tasks Agent.

* refactor(langflow): Update Sequential Crew component

* refactor: Add SequentialCrewComponent for better organization.
2024-08-21 05:24:01 -07:00
ming
ae99e6927e
fix: sqlite3 lockout timeout (#3463)
sqlite3 lockout timeout
2024-08-21 12:11:19 +00:00
Gabriel Luiz Freitas Almeida
188708281a
test(astra): Refactor AstraDB imports in test_astra_component (#3413)
* test(astra): Refactor AstraDB imports in test_astra_component

* fix: Add AstraVectorizeComponent to AstraDB tests.
2024-08-20 12:49:12 -07:00
Uladzislau Kaminski
1a9363999c
feat: nltk text splitter support (#3403)
* feat: nltk text splitter support

* feat: add doc link to nltk text splitter

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-20 18:52:16 +00:00
Gabriel Luiz Freitas Almeida
ef08300054
feat: Add Sequential Task Agent Component. (#3444)
Adds a new component
2024-08-20 06:20:49 -07:00
Gabriel Luiz Freitas Almeida
037c0902d5
fix: update type extraction to extract inner types correctly (#3446)
* refactor: Improve post-processing of return type in type extraction.

* feat: Add support for Union[int, Sequence[str]] in post_process_type.

* refactor(langflow): Simplify return type extraction in CustomComponent.

* Refactor: Remove 'Sequence' and 'list' type options in starter projects.

* test: fix assertion

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-20 12:48:18 +00:00
goliath-yamon
de96aee509
fix: correct indentation issue in PythonCodeStructuredTool and correct type for int and float inputs when updating custom component (#3323)
* enhancement: Update PythonCodeStructuredTool to create inputs automatically and accept global variables

* [autofix.ci] apply automated fixes

* feat: Create a tool to search using SearXNG

* [autofix.ci] apply automated fixes

* refactor: reorganize imports and type annotations in PythonCodeStructuredTool.py for clarity and consistency

* refactor: clean up imports and enhance type annotations in SearXNGTool.py for improved readability and type safety

* refactor: Improved PythonCodeStructuredTool to allow arguments to have any types

* refactor: Formatted and refactored SearXNGTool

* refactor: Allowed RunnableExecutor to stream output and changed its build method to asynchronous.

* fix: correct indentation issue in PythonCodeStructuredTool

* fix: correct type for int and float inputs when updating custom component

* [autofix.ci] apply automated fixes

* fix: change Tool to StructuredTool due to arguments in SearXNGTool

* refactor(endpoints.py): remove duplicate imports of loguru and sqlmodel to improve code readability and maintainability

---------

Co-authored-by: Haseong Kim <dynaferkim@gmail.com>
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-08-20 11:27:41 +00:00
Gabriel Luiz Freitas Almeida
0e1155bb43
test: Add client fixture override for runnable vertices manager unit test. (#3430) 2024-08-20 04:00:38 -07:00
Gabriel Luiz Freitas Almeida
b588ac071a
feat: add endpoint to get starter projects (#3370)
* feat(api): Add endpoint to get list of starter projects with error handling.

* feat: Add test for getting starter projects with valid API key.

* [autofix.ci] apply automated fixes

* refactor(langflow): Update function name from get_all_graphs_dump to get_starter_projects_dump.

* bug: fixes route collision

* bug: fixes serialization

* chore: move endpoint to new file

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-19 15:32:17 -07:00
Eric Hare
8accf4c64c
feat: Add Unstructured Component to Document Loaders (#3308)
* FEAT: Add Unstructured component

* Update Unstructured.py

* [autofix.ci] apply automated fixes

* Switch to FileInput

* Ensure we import the unstructured component

* Small updates to unstructured comp

* Update Unstructured.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-19 15:31:46 -07:00
Sai Kolasani
a2406fac72
feat: Add Perplexity Models Component (#3351) 2024-08-19 21:28:28 +00:00
Cezar Vasconcelos
5181fd880e
fix: remove json_mode and output_schema (#3385)
* refactor(AIMLModel): remove json_mode and output_schema

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-19 14:01:18 -07:00
Cristhian Zanforlin Lousa
595746e797
fix: Fix api_key missing error when adding a flow in ComposIO + tests (#3432)
* 🐛 (ComposioAPI.py): Fix issue where build_config was not being updated correctly when api_key is not empty

* 🐛 (GenericNode/index.tsx): Fix potential null pointer exception by adding non-null assertion operator to info property access
 (generalBugs-shard-11.spec.ts): Add end-to-end tests to ensure users can use ComposIO without api_key error and connect tools successfully
2024-08-19 19:45:09 +00:00
Gabriel Luiz Freitas Almeida
75dbb68dfc
feat: add ComponentTool to support converting Component to Tool (#3412)
* feat: Add ComponentTool to convert a Component to a Tool

* test(component): add unit test for ComponentTool with ChatInput input.

* feat: Add method to convert Component to ComponentTool.

* feat: Add unit test for ChatInput to Tool conversion.

* chore: add comment

* test: fix assertion

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-19 10:05:59 -07:00
Gabriel Luiz Freitas Almeida
149c96d26c
feat: add function to create input schema from component inputs (#3411)
* feat: Add function to create input schema from list of input types.

* feat: Add unit tests for creating input schemas.

* refactor(io): Improve input schema creation logic.

* refactor(schema): Simplify eval call in create_input_schema function.

* fix: Change ValueError to TypeError in create_input_schema to reflect correct exception.

* refactor: refactor create_input_schema to accept a list of input instances.
2024-08-19 09:36:05 -07:00
David Oplatka
b0619f59ff
fix: adds credentials fields in Vectara RAG component (#3396)
* Fix Component

* Final Edits

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-16 20:06:16 +00:00
Gabriel Luiz Freitas Almeida
d313137f8c
feat: add starter project graphs (#3369)
* feat: Add basic prompting graph function.

* feat: Add blog writer starter project function.

* feat(langflow): Add document QA starter project.

* feat: Add memory chatbot graph function to create chatbot with memory component.

* feat: Add hierarchical tasks agent graph to handle sequential tasks.

* feat: Add a function to create a sequential tasks agent with specific tasks.

* feat: Add vector_store_rag module with ingestion and RAG graphs.

* Refactor: Update the hierarchical task agent to use builder methods for agents and models.

* feat: Refactor sequential tasks agent to utilize build_model and build_output methods.

* refactor: Rename functions in blog_writer, document_qa, and vector_store_rag to end with "_graph".

* feat: Add new graphs to starter projects __init__.py.

* feat: Add complex agent graph setup with prompts, tools, and agents.

* refactor: Add complex agent graph to starter projects.

* feat: Add starter project graphs and dump retrieval functions.

* test: Refactor test_directory_without_mocks method with temporary directory for testing purposes.
2024-08-16 12:47:19 -07:00
Gabriel Luiz Freitas Almeida
212a566dfc
fix: Handle KeyError in template parameter mapping and suggest closest match if not found (#3366) 2024-08-16 12:42:36 -07:00
Gabriel Luiz Freitas Almeida
16afd44295
fix: makes outputs be correctly retrieved from edge (#3392)
* feat: Add optional target handle name in get_result method.

* fix: Improve logic to consider target handle name in ComponentVertex.

Fixes #3380
2024-08-16 19:11:59 +00:00
Gabriel Luiz Freitas Almeida
c00e687ec1
feat: add auto_save option to Settings and CLI (#3386)
* feat: Add auto save feature in Langflow run function.

* feat: Add auto_save field to ConfigResponse model.

* refactor: Move logger import to the top in __main__.py and update auto save option help message.

* refactor: Update variable names for auto save to auto saving.
2024-08-16 18:39:19 +00:00
Gabriel Luiz Freitas Almeida
14ca9c9f9d
fix: Sort first layer in graph initialization. (#3383) 2024-08-16 18:11:39 +00:00
Gabriel Luiz Freitas Almeida
e4e1a747f8
test: Fix assertion in test_get_vertices function. (#3387)
* test: Fix assertion in test_get_vertices function.

* test: fix set

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-16 10:49:02 -07:00
Gabriel Luiz Freitas Almeida
c4d2dc56c7
fix(edge): Handle invalid input types when creating TargetHandle (#3368)
* fix(edge): Handle invalid input types when creating TargetHandle

* test(edge): add test for raising error on invalid target handle

* fix: mypy error union-attr

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-16 07:52:43 -07:00
Gabriel Luiz Freitas Almeida
8de100eae3
feat: add description on graph (#3371)
* feat: Add optional description attribute to Graph class and handle description in serialization.

* refactor: Remove 'type' field from NodeData class.

* refactor: Set default graph name if not provided.

* fix: mypy error typeddict-item

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-16 14:50:58 +00:00
Gabriel Luiz Freitas Almeida
640f1becf3
build(langchain-core): Update langchain-core to version 0.2.32. (#3372) 2024-08-16 06:46:21 -07:00
Gabriel Luiz Freitas Almeida
2baee5fef1
feat: get result from output if possible (#3338)
* refactor: Extract method to set params from normal edge in Vertex class.

* feat: Add method to retrieve value from template dict in Vertex class.

* feat: Add handling for cycle and contract edge targets in ComponentVertex build method.

* refactor: Update result retrieval logic in ComponentVertex class.

* refactor: Add condition to check flow_id before creating log transactions.

* refactor: Add missing `Edge` import and cast `cast` in types.py for better typing.
2024-08-15 16:44:06 +00:00
Gabriel Luiz Freitas Almeida
cdab352bc8
feat: Add timeout parameter to HTTP request in StoreService. (#3362) 2024-08-15 06:50:11 -07:00
Gabriel Luiz Freitas Almeida
bb923cf9e1
feat: update output attribute handling (#3329)
* refactor: improve function structure in _build_results

* fix: remove function call that overrides Component.outputs

* refactor: Add handling for outputs in __getattr__ method.
2024-08-15 13:00:09 +00:00
Ítalo Johnny
93537933c3
fix: handle case where tweak values are nested dicts (#3349) 2024-08-15 11:36:30 +00:00
Gabriel Luiz Freitas Almeida
664da106d0
build: lock langchain-core to version 0.2.30. (#3348) 2024-08-14 13:17:31 -07:00