Skip to content
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: Enhance backend with context management, error handling, and refactored code #4286

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Commits on Oct 25, 2024

  1. Configuration menu
    Copy the full SHA
    b4064ab View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2f3bb69 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6e913cd View commit details
    Browse the repository at this point in the history
  4. Add agent components for action routing, decision-making, execution, …

    …and context management
    
    - Introduced `AgentActionRouter` to route agent flow based on action type.
    - Added `DecideActionComponent` for determining actions from context and prompts.
    - Implemented `ExecuteActionComponent` to execute actions using available tools.
    - Created `GenerateThoughtComponent` for generating thoughts based on context.
    - Developed `ProvideFinalAnswerComponent` to generate final answers from context.
    - Built `AgentContextBuilder` for constructing `AgentContext` instances.
    - Added `ObserveResultComponent` to process and observe action results.
    - Implemented `CheckTerminationComponent` to determine if the agent should continue or terminate.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8459565 View commit details
    Browse the repository at this point in the history
  5. Add AgentContext class for managing agent state and context serializa…

    …tion
    
    - Introduced `AgentContext` class in `context.py` to handle agent state, including tools, language model, and context history.
    - Implemented serialization methods for converting agent context to JSON-compatible format.
    - Added validation for language model instances to ensure compatibility.
    - Provided methods for updating and retrieving full context, including context history management.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a5e3d44 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    927b359 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3ee2686 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d43751b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    86fc405 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    25ccac1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3e9332d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e312f13 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    818443c View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    7405501 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    45bb9f3 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    8efafc7 View commit details
    Browse the repository at this point in the history
  17. Add context management methods to custom component class

    - Introduced a `_ctx` attribute to store context data.
    - Added `ctx` property to access the graph's context, raising an error if the graph is not built.
    - Implemented `add_to_ctx` method to add key-value pairs to the context with an optional overwrite flag.
    - Implemented `update_ctx` method to update the context with a dictionary of values, ensuring the graph is built and the input is a dictionary.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    431bbe6 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    5d8a529 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    3c3355b View commit details
    Browse the repository at this point in the history
  20. Convert get_response method to asynchronous and update graph proces…

    …sing to use async iteration.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0bf83c2 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    b92300b View commit details
    Browse the repository at this point in the history
  22. Refactor Agent Flow JSON: Simplify input types and update agent compo…

    …nent structure
    
    - Removed "BaseTool" from input types for "ToolCallingAgent" to streamline tool handling.
    - Updated agent component to a more modular structure with new prompts and input configurations.
    - Replaced deprecated methods and fields with updated implementations for improved functionality.
    - Adjusted metadata and configuration settings for better clarity and usability.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4861084 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    7143208 View commit details
    Browse the repository at this point in the history
  24. Add Agent import to init, improve error handling, and clean up imports

    - Added `Agent` import to `__init__.py` for better module accessibility.
    - Improved error handling in `aiml_embeddings.py` by raising a `ValueError` when the expected embedding count is not met.
    - Cleaned up redundant imports in `test_cycles.py` to enhance code readability.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c556074 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    438ac6b View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    5024e6b View commit details
    Browse the repository at this point in the history
  27. remove agent flow

    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d5f03a2 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    c48aea4 View commit details
    Browse the repository at this point in the history
  29. Refactor graph tests to include new components and update iteration l…

    …ogic
    
    - Replaced complex agent flow with a simplified guessing game using OpenAI components and conditional routing.
    - Introduced `TextInputComponent` and updated `ChatInput` initialization.
    - Added new test `test_conditional_router_max_iterations` to validate conditional routing with max iterations.
    - Updated graph cyclicity assertions and snapshot checks for improved test coverage.
    - Removed deprecated agent components and related logic.
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cda8540 View commit details
    Browse the repository at this point in the history
  30. Refactor conditional router to return message consistently and use it…

    …erate_and_stop_once method
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    70fa7f5 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    4ad2e26 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    8f40330 View commit details
    Browse the repository at this point in the history
  33. Remove unnecessary @override decorator and add # noqa: ARG002 com…

    …ments for unused arguments
    ogabrielluiz committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ee72767 View commit details
    Browse the repository at this point in the history