Commit graph

5,328 commits

Author SHA1 Message Date
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
Gabriel Luiz Freitas Almeida
a90cb1249b
fix: do not mark self.stop caller (#3335)
* refactor: Refactor mark_branch method in Graph class.

* fix: do not mark caller vertex
2024-08-14 18:45:40 +00:00
Gabriel Luiz Freitas Almeida
7ce6a9ee03
feat: Add maximum iterations limit in Graph start method. (#3336)
* feat: Add maximum iterations limit in Graph start method.

* feat: Add OutputConfigDict and StartConfigDict to schema.py.

* feat: Add ability to apply configuration before starting graph.

* feat: Add max_iterations parameter to async_start method and update schema imports.
2024-08-14 11:06:25 -07:00
Gabriel Luiz Freitas Almeida
1d8a24eb86
refactor: rename ContractEdge to CycleEdge (#3334)
* refactor: Add CycleEdge class and make necessary adjustments in base.py files.

* refactor: Change ContractEdge to CycleEdge for consistency in vertex class properties.

* [autofix.ci] apply automated fixes

* refactor: Update type hints in types.py and base.py.

* [autofix.ci] apply automated fixes

* refactor(base.py): Update imports in base.py.

* [autofix.ci] apply automated fixes

* refactor: Changed ContractEdge to CycleEdge for building and getting edges.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-14 17:39:16 +00:00
Gabriel Luiz Freitas Almeida
8d83c3a8bf
feat: Add method to set specific parameters on output object. (#3328) 2024-08-14 17:29:11 +00:00
Gabriel Luiz Freitas Almeida
33e72f162f
refactor: Prevent infinite loop in get_successors function. (#3332)
* refactor: Prevent infinite loop in get_successors function.

* feat(base): improve get_all_successors method to handle cyclic graphs and flat parameter efficiently
2024-08-14 10:04:51 -07:00
Gabriel Luiz Freitas Almeida
15dc4347e0
refactor: Simplify __repr__ method in Edge and ContractEdge classes. (#3333) 2024-08-14 16:54:10 +00:00
Gabriel Luiz Freitas Almeida
77b071155c
feat: add functions to detect cycles in Graph (#3327)
* feat: Add functions to detect cycles in directed graphs.

* test: Add new test cases for cycle detection in graph utils.

* test: temporarily disable test

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-14 16:14:56 +00:00
Gabriel Luiz Freitas Almeida
9035f1194f
ci: Update pytest configuration and add pytest-flakefinder. (#3330) 2024-08-14 14:29:03 +00:00
ytkimirti
ce17bd4e71
feat: Add support for metadata filtering and namespaces for the Upstash Vector component (#3254)
* feat: add metadata filtering and namespace support for the upstash vector component

* docs: add upstash vector to the vectorstores doc

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-14 07:18:45 -07:00
Edwin Jose
ac4442d221
feat: Google Drive Search Component (#3319)
* feat: Google Drive Search Component

feat: Google Drive Search Component
Ability to search Google Drive and get back the relevant Doc id or Doc urls

* Updated Google Drive Search.py
2024-08-14 07:11:58 -07:00
Ítalo Johnny
4f5dca89f3
test: adds new tests for new variable service (#3306)
* test: adds new tests for new method

* test: remove unused variable
2024-08-13 18:01:10 +00:00
Ítalo Johnny
952ba5eef1
feat: centralize global variable management (#3284)
* test: add tests for global variable endpoints

* test: add unit tests variable service

* fix: anticipate checks to prevent the code from breaking

* feat: add a new method to interface

* feat: add method to update fields in variable service

* feat: replace variable api code

* fix: mypy error

* fix: mypy error

* feat(variable): Allow deleting variables by name or ID in DatabaseVariableService.

* refactor(api): Simplify delete method in variable router.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-08-13 13:32:57 +00:00
Gabriel Luiz Freitas Almeida
46f705461e
chore: update lock files with new versions (#3300)
* chore: update lock files with new versions

* build(uvicorn): Update uvicorn to v0.30.6 and its hash values.
2024-08-13 11:16:40 +00:00
Gabriel Luiz Freitas Almeida
c5d9cbae49
feat: add dynamic state model creation and update (#3271)
* feat: add initial implementation of dynamic state model creation and output getter in graph state module

* feat: implement _reset_all_output_values method to initialize component outputs in custom_component class

* feat: add state model management with lazy initialization and dynamic instance getter in custom_component class

* feat: Refactor Component class to use public method get_output_by_method

Refactor the Component class in the custom_component module to change the visibility of the method `_get_output_by_method` to public by renaming it to `get_output_by_method`. This change improves the accessibility and clarity of the method for external use.

* feat: add output setter utility to manage output values in state model properties

* feat: implement validation for methods' classes in output getter/setter utilities in state model to ensure proper structure

* feat: add state model creation from graph in state_model.py

* feat: enhance Graph class with lazy loading for state model creation from graph

* feat: add unit tests for state model creation and validation in test_state_model.py

* feat: add unit tests for state model creation and validation in test_state_model.py

* feat: add functional test for graph state update and validation in test_graph_state_model.py

* fix: update _instance_getter function to accept a parameter in component.py for state model instance retrieval

* refactor: rename test to clarify purpose in test_state_model.py for functional state update validation

* chore: import Finish constant in test_graph_state_model.py for improved clarity and usage in state model tests

* refactor: add optional validation in output getter/setter methods for improved method integrity in state model handling

* refactor: enhance state model creation with optional validation and error handling for output methods in model.py

* refactor: serialize and deserialize GraphStateModel in test_graph_state_model.py

* refactor: improve error message and add verbose mode for graph start in test_state_model.py

* refactor: remove verbose flag from graph.start in TestCreateStateModel for consistency in test_state_model.py

* refactor: disable validation when creating GraphStateModel in state_model.py for improved flexibility

* refactor: add validation documentation for method attributes in model.py to enhance code clarity and usability

* refactor: expand docstring for build_output_getter in model.py to clarify usage and validation details

* refactor: add detailed docstring for build_output_setter in model.py to improve clarity on functionality and usage scenarios

* refactor: add comprehensive docstring for create_state_model in model.py to clarify functionality and usage examples

* refactor: enhance docstring for create_state_model_from_graph in state_model.py to clarify functionality and provide examples

* test: add JSON schema validation in graph state model tests for improved structure and correctness verification

* refactor: Improve graph_state_model.json_schema unit test readability and structure.
2024-08-12 17:53:57 -07:00
Sai Kolasani
2ffd723065
Update Ollama Model + Links (#3294)
wip

Co-authored-by: Sai Kolasani <sai.kolasani@datastax.com>
2024-08-13 00:45:31 +00:00
Carlos Coelho
dc419d11fd
fix: Corrected URI handling in SQLDatabaseComponent (#3291) 2024-08-12 15:45:13 -07:00
Ítalo Johnny
7a93a708ee
fix: message sorting in playground (#3293) 2024-08-12 22:09:08 +00:00
dependabot[bot]
a00bbe0a84
build(deps): bump aiohttp from 3.10.1 to 3.10.2 in /src/backend/base (#3269)
Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.10.1 to 3.10.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/aiohttp/compare/v3.10.1...v3.10.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 19:53:07 +00:00
William Espegren
e09f157af6
fix: update parameters in spider components (#3280)
* fix: make spider tool work

* upgrade spider-client

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-12 19:45:20 +00:00
Gabriel Luiz Freitas Almeida
775d659380
fix: correct vertex build delete function (#3289)
* refactor: Rearrange imports for clarity and consistency.

* fix: delete now executes the sql statement correctly
2024-08-12 12:21:27 -07:00
Edwin Jose
9d8009f2f5
feat: Gmail Loader component created (#3241)
* feat: Gmail Loader component created

* [autofix.ci] apply automated fixes

* Updated Gmail.py

ran make format and ran make lint

* [autofix.ci] apply automated fixes

* Update Gmail.py

Errors Resolved.

Suggestion from @ogabrielluiz added.

Note this is a ChatLoader, since GmailLoader uses the BaseChatloader as base class.

But this would be a highly useful feature. if required i could rewrite the component as document loader. but either way this would be an amazing feature.

Planning to publish gmails tools also in next steps mostly.

* solved lint issues in Gmail.py

Key Changes:
1.	Added Optional to the import statement.
2.	Updated the type hint of label_ids to Optional[List[str]] to allow it to be None or a list of strings.

* remove commented

* remove commented

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
2024-08-12 11:57:03 -07:00
Mike Manh
583bc74019
fix(get-python-api-code):fixing errors in a file uploading flow, as in issue #2799 (#2815)
fixing errors in a file uploading flow, as in issue #2799

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-08-09 22:53:39 +00:00
Gabriel Luiz Freitas Almeida
9da2c34551
fix: update type to silence warning and memory chatbot json (#3265)
* fix: update value type in DefaultPromptField from str to Any for increased flexibility in input handling

* fix: replace _instantiate_input with instantiate_input for consistency in input instantiation across the codebase

* chore: update test durations

* update memory chatbot
2024-08-09 16:01:25 +00:00
Gabriel Luiz Freitas Almeida
0eb694f1d7
refactor: Reorganize imports and enhance type checks in PythonCodeStructuredTool.py (#3266)
refactor: Reorganize imports and enhance type checks in PythonCodeStructuredTool.py for better clarity and robustness
2024-08-09 16:00:10 +00:00
goliath-yamon
5ce8cbda9b
Refactored and improved PythonCodeStructuredTool, SearXNGTool, and RunnableExecutor (#3239)
* 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.

---------

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-09 08:30:23 -07:00
Gabriel Luiz Freitas Almeida
b0f80e4638
feat: add log_builds parameter to build_flow for optional vertex build logging (#3262) 2024-08-09 14:46:15 +00:00
Gabriel Luiz Freitas Almeida
d0484ba412
fix: enhance error handling in build_flow and add error handling for Flow build (#3259)
* feat: add error handling for Flow build

The code changes in `buildUtils.ts` add error handling for the Flow build process. It includes a new case for handling errors in the switch statement, which displays the error message and triggers the `onBuildError` function. This change ensures that errors during the Flow build are properly handled and the build process is stopped.

* feat: enhance error handling in build_flow to capture and report HTTP exceptions in the flow building process
2024-08-09 14:15:35 +00:00
Gabriel Luiz Freitas Almeida
645c723d21
feat: start using dev mode flag and add exception filter in logger (#3260)
* refactor: reorganize logger module and add setup.py for logging configuration

* refactor: update logger import path to align with recent module restructuring

* refactor: add logging configuration parameter to Graph initialization for improved logging setup flexibility

* feat: create logging init module for improved logger configuration and management

* refactor: update Settings class to include development mode flag and associated validator for enhanced configuration management

* refactor: enhance logger.py with DEV mode handling and TypedDict for log configuration settings

* feat: add settings module with DEV mode flag and helper functions for setting development state

* refactor: update flow assertions in tests to check for Data object type instead of Flow object type

* feat: add deepcopy method to Graph class to copy start and end components, ensuring proper graph cloning functionality

* feat: implement deepcopy method in Component class for proper cloning of inputs and configuration attributes

* feat: enhance attribute access in Component class to support backwards-compatible private attributes retrieval

* feat: improve test assertion for list_flows in custom component to display types of returned objects for better debugging

* feat: refactor imports in constants.py and remove redundant Data class definition for cleaner code structure

* feat: refactor imports in logger.py to include NotRequired from typing_extensions for better type hinting support
2024-08-09 13:59:49 +00:00
Gabriel Luiz Freitas Almeida
56ecb18ef5
feat: Improve caching logic and add disk caching option (#3246)
* feat: add diskcache package version 5.6.3 to poetry.lock and pyproject.toml for improved caching functionality

* refactor: simplify CacheMiss import in cache service files for better clarity and maintainability

* feat: Add AsyncDiskCache class for disk-based caching

* feat: Add disk caching option in CacheServiceFactory with AsyncDiskCache

* feat: Restrict cache_type to specific literals: async, redis, memory, disk for enhanced type safety and clarity

* feat: Change get_requester_result to async await for proper async handling in Vertex class

* fix: Update outputs dictionary in ResultData class to use key-value pairs for better readability and maintainability

* fix: Improve caching logic in Graph class by ensuring vertex builds properly handle exceptions and cache updates more reliably

* feat: Add teardown method to AsyncDiskCache for clearing cache directory during cleanup process

* fix: Correct variable name in Graph class to ensure proper handling of vertex results in caching logic

* feat: Clear AsyncDiskCache on initialization to align behavior with in-memory cache until frontend handling is implemented
2024-08-09 12:42:21 +00:00
Gabriel Luiz Freitas Almeida
edb3c9e4d2
fix: change sync_get_file_content_dicts to use get_file_content_dicts (#3250)
feat: refactor sync_get_file_content_dicts to use get_file_content_dicts

Refactor the `sync_get_file_content_dicts` method in the `Message` class to use the `get_file_content_dicts` method instead. This change improves the code by using a more descriptive and accurate method name.
2024-08-08 22:23:02 +00:00
vinicius Mello
d606a4dac3
feat: add huggingface endpoint retry (#3236)
* feat: added retry when calling huggingface endpoint

* chore: added default value to retry input

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-08 20:41:42 +00:00
Gabriel Luiz Freitas Almeida
e42b6bdb94
fix: change ValueError into Warning to allow disconnected flows to run and other small fixes (#3249)
* fix: add task to end all traces on asyncio.CancelledError in build_flow function for better cleanup handling

* fix: replace ValueError with warnings in Graph class when vertices exist without edges for better logging and handling

* chore: add type annotations to test_vector_store_rag_add function

* feat: Fix assertion in test_create_flows to check for substring in name field

The assertion in the test_create_flows function was modified to check if the name field contains the substring "Flow 1" instead of an exact match. This change allows for more flexibility in the test and ensures that the test passes even if there are additional characters in the name field.
2024-08-08 20:21:21 +00:00
Edwin Jose
3e6c863a8b
feat: create google drive ingest component (#3129)
* feat: create google drive ingest component

It adds the basic implementation of the Google Drive Loader.

* feat: create google drive ingest component

Created a basic Google Drive loader component

* Updated the Icon

* updated the formatting

ran make format to update the formatting

* Addressed comments
2024-08-08 18:53:21 +00:00
William Espegren
7a36cc9ebf
feat: add Spider Web Scraper & Crawler (#2439)
* spider files

* rebuild required

* add spider-client here

* Feat: Spider Web Crawler & Scraper

* Feat: spider integration

* new input not working

* [autofix.ci] apply automated fixes

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

* fix: add outputs and configure build method

* style: run ruff

* Refactor SpiderTool to use 'crawl' instead of 'build' for generating Markdown content

* chore: add type ignore

* chore: new lock

* chore: Update mem0ai dependency to version 0.0.5

---------

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-08 05:53:05 -07:00
Gabriel Luiz Freitas Almeida
a2c98b90c1
chore: bump version to 1.0.15 and update langflow-base version to 0.0.93 (#3233)
* bump: update langflow-base version to 0.0.93 in pyproject.toml

* chore: bump version to 1.0.15 in pyproject.toml
2024-08-07 14:39:29 -07:00
Cezar Vasconcelos
fcd8d379a6
feat: add LLM output for the AI ML component to use ChatOpenAI base model (#3230)
* fix: add LLM output for the AI ML component, using ChatOpenAI base model from langchain

* [autofix.ci] apply automated fixes

* fix: docs

* fix: unused variables

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-07 20:32:49 +00:00
Gabriel Luiz Freitas Almeida
72463d9b5d
refactor: update graph visualization and add ASCII representation (#3219)
* chore: Update dependencies in poetry files, adding grandalf 0.8.0 and upgrading several other packages to latest versions

* refactor: Add ASCII graph drawing functionality using grandalf library

* refactor: Improve Graph representation format and add ASCII visualization method to enhance readability and usability
2024-08-07 19:45:10 +00:00