-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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: Add SimpleAgentComponent and related pytests #4318
Conversation
new component: simple ai agent py tests for tool calling agent as well as for simple ai agent
update _config Changes and code oprimised
Error or inputType as None Solved
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.
Amazing work!
added pytest mark as api required
added system prompt
Thank you @italojohnny |
chat memory added
commit e965fd3 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 17:16:08 2024 -0400 fix: broken docker test (#4337) * Fix broken docker test Fixes #4336 Update the Docker test workflow to use the `get_version` function from `langflow.utils.version`. * Modify the `Test image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. * Modify the `Test backend image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/langflow-ai/langflow/issues/4336?shareId=XXXX-XXXX-XXXX-XXXX). * version.version not util.version commit 3279b8a Author: Lucas Oliveira <[email protected]> Date: Thu Oct 31 16:39:58 2024 -0300 fix: add collapsible function to templates and fix design bugs (#4305) * Updated colors * Fixed design for small screens * Change border radius * Changed size of text on templates description * Fix shine effect on small screens * Fixed icons on starter templates * Updated mono font to JetBrains * Updated icon hit area for X * Added gradient wrapper and x-gradient * Changed colors and font weights for nav component * Added zoom on hover of gradient * Fixed input size * Fixed all templates to show everything * Hide scrollbar * Change text size of card * Removed title of the categories * Removed unused currentTab from templatecategory * Updated position of search icon * Updated style of inputs * Updated search clear button * Fixed bug on small screens * Added no results query * Fixed background on get started cards * Added focus ring on nav component * Added tab index to search and sidebar buttons * Added keyboard navigation to templates * Updated templatesModal to use ShadCN Sidebar * Implemented collapsible sidebar * Fix collapsible to work on mobile but be overlaying content * Added noise to styleUtils * Updated padding and sizes for mobile * Updated text size * Updated font family to inter * Made get started components fetch title and description from the flow * Updated description on get started component * Updated naming of sidebar * Updated description of start from scratch * Updated color of selected sidebar item * Changed text color for sidebar not active items * changed description sizes * changed to line clamp * Reduced gap between icon and category text * Fixed no results state * Fixed X icon only appearing on hover * Fix auto focus issue * fixed hover color of primary button * Fixed gradients to use stops if it exists and stop using random gradient * removed random gradient * Fixed design of cards in templates * Updated nav to go through tests * Fixed focus on input * [autofix.ci] apply automated fixes * New color * fix testes * Fixed starter projects test * ✨ (starter-projects.spec.ts): add Page import to test function parameters for better code readability and maintainability 📝 (starter-projects.spec.ts): refactor test to include a function for waiting for template visibility, improving code readability and reducing duplication --------- Co-authored-by: Cristhian Zanforlin Lousa <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> commit a03da10 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 14:57:07 2024 -0400 fix: langfuse upgrade and crew result usage (#4342) * lanfuse upgrade and crew result usage * ✅ (Dynamic Agent.spec.ts): Enable tests for checking the presence of required environment variables before running the test suite. ✨ (Hierarchical Agent.spec.ts): Add integration test for Hierarchical Tasks Agent to ensure proper functionality and behavior ✨ (Sequential Task Agent.spec.ts): Add integration test for Sequential Tasks Agent to ensure proper functionality and behavior --------- Co-authored-by: cristhianzl <[email protected]>
adding # noqa: to solve CI Error
removed unused params that were causing the issue
@Cristhianzl @italojohnny Any suggestion on why the FrontEnd Test Group 4 always fails in this PR? |
changed simple agent to agent
Found the Error: The simplified Agent is having the name just Agent and the starter template simple Agent Flow is based of the tool calling agent. We might need to update the started template so solve this issue |
update Agent Flow.json
Updated the Agent Flow.json to use the Agent component instead of the tool calling agent, still the test fails. |
The issue occurs because the button for inspecting component code is overlaying the element the test is trying to click. This likely started happening after the recent frontend layout updates. The solution mainly attempts to resolve the problem by adjusting the zoom level.
* simple ai agent new component: simple ai agent py tests for tool calling agent as well as for simple ai agent * Update simple_agent.py update _config Changes and code oprimised * Update simple_agent.py Error or inputType as None Solved * [autofix.ci] apply automated fixes * fix: INP001 ruff error * Update test_tool_calling_agent.py added pytest mark as api required * Update simple_agent.py added system prompt * [autofix.ci] apply automated fixes * updates in the input field orders * [autofix.ci] apply automated fixes * Update simple_agent.py chat memory added * [autofix.ci] apply automated fixes * lint Errors Solved * Squashed commit of the following: commit e965fd3 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 17:16:08 2024 -0400 fix: broken docker test (#4337) * Fix broken docker test Fixes #4336 Update the Docker test workflow to use the `get_version` function from `langflow.utils.version`. * Modify the `Test image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. * Modify the `Test backend image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/langflow-ai/langflow/issues/4336?shareId=XXXX-XXXX-XXXX-XXXX). * version.version not util.version commit 3279b8a Author: Lucas Oliveira <[email protected]> Date: Thu Oct 31 16:39:58 2024 -0300 fix: add collapsible function to templates and fix design bugs (#4305) * Updated colors * Fixed design for small screens * Change border radius * Changed size of text on templates description * Fix shine effect on small screens * Fixed icons on starter templates * Updated mono font to JetBrains * Updated icon hit area for X * Added gradient wrapper and x-gradient * Changed colors and font weights for nav component * Added zoom on hover of gradient * Fixed input size * Fixed all templates to show everything * Hide scrollbar * Change text size of card * Removed title of the categories * Removed unused currentTab from templatecategory * Updated position of search icon * Updated style of inputs * Updated search clear button * Fixed bug on small screens * Added no results query * Fixed background on get started cards * Added focus ring on nav component * Added tab index to search and sidebar buttons * Added keyboard navigation to templates * Updated templatesModal to use ShadCN Sidebar * Implemented collapsible sidebar * Fix collapsible to work on mobile but be overlaying content * Added noise to styleUtils * Updated padding and sizes for mobile * Updated text size * Updated font family to inter * Made get started components fetch title and description from the flow * Updated description on get started component * Updated naming of sidebar * Updated description of start from scratch * Updated color of selected sidebar item * Changed text color for sidebar not active items * changed description sizes * changed to line clamp * Reduced gap between icon and category text * Fixed no results state * Fixed X icon only appearing on hover * Fix auto focus issue * fixed hover color of primary button * Fixed gradients to use stops if it exists and stop using random gradient * removed random gradient * Fixed design of cards in templates * Updated nav to go through tests * Fixed focus on input * [autofix.ci] apply automated fixes * New color * fix testes * Fixed starter projects test * ✨ (starter-projects.spec.ts): add Page import to test function parameters for better code readability and maintainability 📝 (starter-projects.spec.ts): refactor test to include a function for waiting for template visibility, improving code readability and reducing duplication --------- Co-authored-by: Cristhian Zanforlin Lousa <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> commit a03da10 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 14:57:07 2024 -0400 fix: langfuse upgrade and crew result usage (#4342) * lanfuse upgrade and crew result usage * ✅ (Dynamic Agent.spec.ts): Enable tests for checking the presence of required environment variables before running the test suite. ✨ (Hierarchical Agent.spec.ts): Add integration test for Hierarchical Tasks Agent to ensure proper functionality and behavior ✨ (Sequential Task Agent.spec.ts): Add integration test for Sequential Tasks Agent to ensure proper functionality and behavior --------- Co-authored-by: cristhianzl <[email protected]> * [autofix.ci] apply automated fixes * Update worker.py adding # noqa: to solve CI Error * [autofix.ci] apply automated fixes * Update worker.py removed unused params that were causing the issue --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: italojohnny <[email protected]>
* simple ai agent new component: simple ai agent py tests for tool calling agent as well as for simple ai agent * Update simple_agent.py update _config Changes and code oprimised * Update simple_agent.py Error or inputType as None Solved * [autofix.ci] apply automated fixes * fix: INP001 ruff error * Update test_tool_calling_agent.py added pytest mark as api required * Update simple_agent.py added system prompt * [autofix.ci] apply automated fixes * updates in the input field orders * [autofix.ci] apply automated fixes * Update simple_agent.py chat memory added * [autofix.ci] apply automated fixes * lint Errors Solved * Squashed commit of the following: commit e965fd3 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 17:16:08 2024 -0400 fix: broken docker test (langflow-ai#4337) * Fix broken docker test Fixes langflow-ai#4336 Update the Docker test workflow to use the `get_version` function from `langflow.utils.version`. * Modify the `Test image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. * Modify the `Test backend image` step in `.github/workflows/docker_test.yml` to use the `get_version` function instead of directly importing `__version__`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/langflow-ai/langflow/issues/4336?shareId=XXXX-XXXX-XXXX-XXXX). * version.version not util.version commit 3279b8a Author: Lucas Oliveira <[email protected]> Date: Thu Oct 31 16:39:58 2024 -0300 fix: add collapsible function to templates and fix design bugs (langflow-ai#4305) * Updated colors * Fixed design for small screens * Change border radius * Changed size of text on templates description * Fix shine effect on small screens * Fixed icons on starter templates * Updated mono font to JetBrains * Updated icon hit area for X * Added gradient wrapper and x-gradient * Changed colors and font weights for nav component * Added zoom on hover of gradient * Fixed input size * Fixed all templates to show everything * Hide scrollbar * Change text size of card * Removed title of the categories * Removed unused currentTab from templatecategory * Updated position of search icon * Updated style of inputs * Updated search clear button * Fixed bug on small screens * Added no results query * Fixed background on get started cards * Added focus ring on nav component * Added tab index to search and sidebar buttons * Added keyboard navigation to templates * Updated templatesModal to use ShadCN Sidebar * Implemented collapsible sidebar * Fix collapsible to work on mobile but be overlaying content * Added noise to styleUtils * Updated padding and sizes for mobile * Updated text size * Updated font family to inter * Made get started components fetch title and description from the flow * Updated description on get started component * Updated naming of sidebar * Updated description of start from scratch * Updated color of selected sidebar item * Changed text color for sidebar not active items * changed description sizes * changed to line clamp * Reduced gap between icon and category text * Fixed no results state * Fixed X icon only appearing on hover * Fix auto focus issue * fixed hover color of primary button * Fixed gradients to use stops if it exists and stop using random gradient * removed random gradient * Fixed design of cards in templates * Updated nav to go through tests * Fixed focus on input * [autofix.ci] apply automated fixes * New color * fix testes * Fixed starter projects test * ✨ (starter-projects.spec.ts): add Page import to test function parameters for better code readability and maintainability 📝 (starter-projects.spec.ts): refactor test to include a function for waiting for template visibility, improving code readability and reducing duplication --------- Co-authored-by: Cristhian Zanforlin Lousa <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> commit a03da10 Author: Sebastián Estévez <[email protected]> Date: Thu Oct 31 14:57:07 2024 -0400 fix: langfuse upgrade and crew result usage (langflow-ai#4342) * lanfuse upgrade and crew result usage * ✅ (Dynamic Agent.spec.ts): Enable tests for checking the presence of required environment variables before running the test suite. ✨ (Hierarchical Agent.spec.ts): Add integration test for Hierarchical Tasks Agent to ensure proper functionality and behavior ✨ (Sequential Task Agent.spec.ts): Add integration test for Sequential Tasks Agent to ensure proper functionality and behavior --------- Co-authored-by: cristhianzl <[email protected]> * [autofix.ci] apply automated fixes * Update worker.py adding # noqa: to solve CI Error * [autofix.ci] apply automated fixes * Update worker.py removed unused params that were causing the issue --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: italojohnny <[email protected]>
Introduce the
SimpleAgentComponent
, a new agent component that extendsToolCallingAgentComponent
. This component allows the agent to utilize various tools and supports both OpenAI and Azure OpenAI language models. It includes configurations for selecting the language model type and manages input types dynamically based on the selected model.Screen.Recording.2024-10-29.at.1.52.46.PM.mov
Changes
SimpleAgentComponent
class insrc/backend/base/langflow/components/agents/simple_agent.py
get_llm
,_build_llm_model
)build_config
Motivation and Context
This addition enhances the agent framework by providing a straightforward agent capable of leveraging different language models and tools. It offers greater flexibility and extensibility for building complex workflows within the Langflow application.
Future Updates:
Autogenerated: PR Message
This pull request introduces a new
SimpleAgentComponent
class, adds unit tests for this component, and modifies existing tests for theToolCallingAgentComponent
. The key changes include the creation of theSimpleAgentComponent
class, the addition of unit tests for both theSimpleAgentComponent
andToolCallingAgentComponent
, and the integration of various input and output components.New Components:
src/backend/base/langflow/components/agents/simple_agent.py
: AddedSimpleAgentComponent
class that extendsToolCallingAgentComponent
to handle different language models and tools. ([src/backend/base/langflow/components/agents/simple_agent.pyR1-R132](https://github.com/langflow-ai/langflow/pull/4318/files#diff-6bcaea75d1cdcae8ab5798ab147a2956ebbf234384835993ce0a3a3a67abe42cR1-R132)
)Unit Tests:
src/backend/tests/unit/components/agents/test_simple_agent.py
: Added unit test forSimpleAgentComponent
to verify its functionality using a calculator tool. ([src/backend/tests/unit/components/agents/test_simple_agent.pyR1-R31](https://github.com/langflow-ai/langflow/pull/4318/files#diff-f2758044606f96f1378563cfaab80149810adf5f7b8b5b780b63f93d4cb8063eR1-R31)
)src/backend/tests/unit/components/agents/test_tool_calling_agent.py
: Added unit test forToolCallingAgentComponent
to ensure it can correctly use a calculator tool and produce expected outputs. ([src/backend/tests/unit/components/agents/test_tool_calling_agent.pyR1-R32](https://github.com/langflow-ai/langflow/pull/4318/files#diff-cb1e0fb42766434760104f00ff364c54550e4c9d2df99d66cd58fa3e06c401a4R1-R32)
)