-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: ReAct #3998
base: main
Are you sure you want to change the base?
Feat: ReAct #3998
Conversation
phact
commented
Oct 3, 2024
- Added an example ReAct test in test_cycles.py
- Made some improvements to the Assistants components (new AssistantManager component that simplifies usage significantly, including dynamic tool usage).
- Added SharedComponentCache and SharedComponentCache service that uses ThreadedInMemoryCache
- Added a new ComponentWithCache to streamline usage of the new cache for things like caching connections / client objects across components. This means all the instances of all the assistants components will use the same OpenAI client.
The `has_cycle_edges` method is added to the `Vertex` class to check if the vertex has any cycle edges. Additionally, the `instantiate_component` method is updated to use the `initialize.loading.instantiate_class` function for custom component instantiation.
- Implement `find_cycle_vertices` function to identify all vertices that are part of cycles in a directed graph. - Utilize depth-first search (DFS) to detect cycles and collect vertices involved in those cycles.
- Introduced `_set_cache_to_vertices_in_cycle` method to enable caching for vertices involved in cycles. - Added `find_cycle_vertices` import to support the new method. - Refactored vertex instantiation into `_instantiate_components_in_vertices` method for better code organization.
Refactor the `_set_cache_to_vertices_in_cycle` method to improve caching logic for vertices involved in cycles. Instead of setting the `cache` attribute to `True`, it is now set to `False` for better clarity and consistency. This change ensures that the cache is properly handled for vertices in cycles.
…and add new test case - Removed the `entry_point` parameter from all test cases for `find_cycle_vertices`. - Added a new parameterized test case `test_handle_two_inputs_in_cycle` to verify handling of cycles with two inputs.
…puts in `base.py`
…ntegration - Introduce `test_updated_graph_with_prompts` to validate graph cyclicity and execution. - Integrate `PromptComponent`, `OpenAIModelComponent`, and `ConditionalRouterComponent` in the test. - Ensure graph execution with a maximum of 20 iterations and cache disabled. - Validate the presence of expected output vertices in the results.
…che in cycle vertices
- Introduced `default_value` to handle cases where edges are cycles and target parameters are present. - Ensured that `default_value` is returned if defined, preventing errors when the component is not built.
…date assertions - Simplified component initialization using method chaining. - Corrected router input and message parameters to use openai_component_1. - Updated assertions to check for correct output IDs.
- Introduced `_cycle_vertices` attribute to store vertices involved in cycles. - Added `cycle_vertices` property to compute and cache cycle vertices. - Updated edge creation logic to use `cycle_vertices` for cycle detection.
- Changed router operator from "equals" to "contains". - Consolidated chat output to a single component. - Updated graph construction to use a single chat output. - Replaced `_snapshot` with `get_snapshot` for graph state capture. - Adjusted assertions to reflect the updated graph structure and outputs.
Merge branch 'assistant-manager' into feat/disablecacheincycle
This pull request is automatically being deployed by Amplify Hosting (learn more). |
src/backend/base/langflow/custom/custom_component/component_with_cache.py
Outdated
Show resolved
Hide resolved
src/backend/base/langflow/services/shared_component_cache/factory.py
Outdated
Show resolved
Hide resolved
src/backend/base/langflow/services/shared_component_cache/service.py
Outdated
Show resolved
Hide resolved
DropdownInput( | ||
display_name="Tool", | ||
name="tool", | ||
options=tool_names, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, the tools would be Components.
What if these tools work as default ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there's a way to do both, pick from the dropdown if the tools are simple and don't have any configuration or add an edge from a component for more complex tools. We would probably also want a way to accept langchain basetool tools for assistants dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also be able to pass more than one tool and let it decide which to use. Is there a multi-select input in langflow?
…ory.py Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
…ice.py Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>