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

Refactor timers and input queues #27

Closed
wants to merge 74 commits into from

Conversation

efunneko
Copy link
Collaborator

@efunneko efunneko commented Aug 5, 2024

This change is a fairly significant refactoring, while still being backwards compatible.

The main purpose of the refactoring was to provide a central timer service for components

It comprises:

  1. Add a central timer manager so that components can request individual timers (and as many as they like)
  2. Change the input queues for components to take an Event type rather than a Message type. The Event, at this moment, can be either a timeout notification or a message to be processed. The ComponentBase will handle either calling 'invoke' on a Message or 'handle_timer_event' if the Event is a timeout. Note that other event types could be added in future.
  3. Change the aggregate component to use the central timer manager
  4. Changed message_filter component to discard messages in the invoke handler
  5. Cleaned up some application shutdown code to not get stuck waiting for threads
  6. Some small test changes to adapt

efunneko and others added 30 commits April 27, 2024 14:48
* Add ability to stream partial LLM responses to a named flow
* Add a configurable message that is sent to the slack channel that sent a message to slack_input
* Add the ability to clear the ack message and stream partial results to that ack message
…hHistory

- also started on converting absolute paths for imports to relative ones
The import statement in `main.py` was updated to remove the relative path and use an absolute import for `SolaceAiConnector` from `solace_ai_connector.solace_ai_connector`. This change improves the code organization and ensures proper module resolution.
…ensible. This is part of a cleanup before releasing to Pypi
…do a directory search looking for modules. We are more explicit now

Also promote the gen_docs tool to an installed script so that it can be used for plugins
Adjusted the importing of modules from config files to be more friendly for plugins and added a 'component_package' properly that will be auto-installed if it is specified and the package is not present.
…_kv_store

This commit updates the component_base.py file to include the flow_lock_manager and flow_kv_store attributes. These attributes are necessary for components to access the flow-level lock manager and key-value store. By adding these attributes, components can now utilize the lock manager to synchronize access to shared resources and the key-value store to store and retrieve data across multiple components within the flow. This change improves the flexibility and functionality of the component_base.py file.

Changed the default location of the trust_store for the Solace API to be provided by the certifi module.

Added a configuration item for the ChatModel with History component to be able to limit the size of entries being added to the chat history
This commit updates the trust_store_path for the Solace API in the solace_messaging.py file. The trust_store_path is now provided by the certifi module, which ensures that the default location of the trust store is used. This change improves the security and reliability of the Solace API integration.

```
DATAGO-78654: Add ci
* Cleanup of some lingering prints and add a couple more tests

* Print cleanup

* Exclude coverage.py result from sonarqube

---------

Co-authored-by: Edward Funnekotter <[email protected]>
Co-authored-by: Edward Funnekotter <[email protected]>
efunneko added 22 commits August 4, 2024 13:01
…er than payload to avoid confusion with message payload
@efunneko efunneko requested a review from gregmeldrum August 5, 2024 17:53
@efunneko efunneko self-assigned this Aug 5, 2024
@efunneko efunneko closed this Aug 15, 2024
efunneko added a commit that referenced this pull request Sep 5, 2024
…UUID Invoke Function, Added assembly component (#36)

* Examples Update + Code Refactor (#25)

* Removed StorageManager

* Added examples for OpenAI, Bedrock, Anthropic, and VertexAI

* Updating old examples (1/2)

* Updating old examples (2/2)

* Added support for temporary queue + UUID queue name (#26)

* Add assembly component and auto-generated documents (#27)

* Added the assembly component

* Auto-generated documents

* Added type check

* Update the cache service expiry logic + Update the assembly component to use cache expiry for timeout

* Moved assembly to the correct place

* Added MoA Example + UUID Invoke Function (#28)

* MoA example: Broadcast to multiple agents

* Added MoA event manager, added uuid invoke_function + test, updated auto-generated docs

* Added assembly layer to MoA example

* Update documentation for new users + Refactored component_input & source_expression (#29)

* Refactored component_input to input_selection

* Updated, added, and enhanced the documentation with new users in mind

* Refactored source_expression function to evaluate_expression (backward compatible)

* Added tips and tricks section + info and examples on custom modules

* tiny format update

* tiny update

* Fixed solace disconnection issues on shutting down (#30)

* Add RAG example for AI connector + delete action for vector index (#31)

* Added a RAG example for AI connector

* Added delete option to vectordb

* Changed id to ids

* chore: Refactor make_history_start_with_user_message method (#32)

Fix the method to not trim the first entry if it is a "system" role

---------

Co-authored-by: Edward Funnekotter <[email protected]>
efunneko added a commit that referenced this pull request Sep 26, 2024
…ved docs and examples and better testing (#39)

* Examples Update + Code Refactor (#25)

* Removed StorageManager

* Added examples for OpenAI, Bedrock, Anthropic, and VertexAI

* Updating old examples (1/2)

* Updating old examples (2/2)

* Added support for temporary queue + UUID queue name (#26)

* Add assembly component and auto-generated documents (#27)

* Added the assembly component

* Auto-generated documents

* Added type check

* Update the cache service expiry logic + Update the assembly component to use cache expiry for timeout

* Moved assembly to the correct place

* Added MoA Example + UUID Invoke Function (#28)

* MoA example: Broadcast to multiple agents

* Added MoA event manager, added uuid invoke_function + test, updated auto-generated docs

* Added assembly layer to MoA example

* Update documentation for new users + Refactored component_input & source_expression (#29)

* Refactored component_input to input_selection

* Updated, added, and enhanced the documentation with new users in mind

* Refactored source_expression function to evaluate_expression (backward compatible)

* Added tips and tricks section + info and examples on custom modules

* tiny format update

* tiny update

* Fixed solace disconnection issues on shutting down (#30)

* Add RAG example for AI connector + delete action for vector index (#31)

* Added a RAG example for AI connector

* Added delete option to vectordb

* Changed id to ids

* chore: Refactor make_history_start_with_user_message method (#32)

Fix the method to not trim the first entry if it is a "system" role

* Keep history depth needs to be a positive integer and test refactor (#33)

* chore: Refactor clear_history_but_keep_depth method to handle negative depth values

* chore: small change to how this is solved

* chore: one more try

* refactor: move utils_for_test_files.py to solace_ai_connector module

* refactor: removed the orginal utils_for_test_files.py

* refactor: update import statements in test files

* refactor: add sys.path.append("src") to test files

* refactor: standardize import order and sys.path.append in test files

* refactor: a bit more test infrastructure changes

* feat: allow component_module to accept module objects directly

* feat: add types module import to utils.py

* test: add static import and object config test

* refactor: update test_static_import_and_object_config to use create_test_flows

* refactor: Improve test structure and remove duplicate test case

* fix: remove duplicate import of yaml module

* refactor: Modify test config to use dict instead of YAML string

* refactor: convert config_yaml from string to dictionary

* refactor: update static import test to use pass_through component

* test: Add delay component message passing test

* feat: add test for delay component message processing

* feat: Added a new test function (test_one_component) to make it very easy to just run some quick tests on a single input -> expected output tests on a single component

* feat: added input_transforms to the test_one_component so that input transforms can be tested with it

* chore: a bit of cleanup and new tests for test_one_component

* chore: rename test_one_component because it was being picked up as a test by the pytest scanner

* fix: fixed a typo

* Fix for anthropic example (#35)

* Updating version dependency (#37)

* Fixed url and file name in getting started (#38)

* Add guide for RAG (#39)

* Added guide for RAG

* update wording

* Added link to other docs from RAG guide (#40)

* chore: added a timeout setting for running component tests so that you can test situations where you don't expect any output (#34)

* AI-124: Add a feature to provide simple blocking broker request/response ability for components (#42)

* feat: add request_response_controller.py

* feat: implement RequestResponseFlowManager and RequestResponseController classes

* style: format code with black and improve readability

* feat: implement RequestResponseController for flow-based request-response handling

* feat: implement RequestResponseController for handling request-response patterns

* fix: import SolaceAiConnector for type checking

* refactor: restructure Flow class and improve code organization

* feat: implement multiple named RequestResponseControllers per component

* refactor: initialize request-response controllers in ComponentBase

* test: add request_response_controller functionality tests

* feat: finished implementation and added some tests

* refactor: rename RequestResponseController to RequestResponseFlowController

* refactor: rename RequestResponseController to RequestResponseFlowController

* refactor: some name changes

* fix: update test function names for RequestResponseFlowController

* refactor: more name changes

* Ed/req_resp_examples_and_fixes (#41)

* feat: Added a request_response_flow example and fixed a few issues along the way

* feat: Reworked the broker_request_response built-in ability of components to be simpler. Instead of having to have a defined flow and then name that flow, it will automatically create a flow with a single broker_request_response component in it. Now there is a straightforward interating function call to allow components to issue a request and get streaming or non-streaming responses from that flow.

* chore: fix the request_response example and remove the old one

* docs: add broker request-response configuration

* docs: added advanced_component_features.md

* docs: add broker request-response configuration details

* docs: add payload encoding and format to broker config

* docs: add cache service and timer manager to advanced_component_features.md

* docs: add configuration requirement for broker request-response

* docs: update broker request-response section with configuration info

* docs: a bit more detail about do_broker_request_response

* docs: add link to advanced features page in table of contents

* docs: add link to advanced features page

* docs: reorder table of contents in index.md

* docs: add custom components documentation

* docs: Remove advanced component features from table of contents

* docs: clean up a double inclusion of the same section

* docs: small example change

* chore: remove dead code

* chore: add some extra comments to explain some test code

* docs: Update description of STDIN input component

Update the description of the STDIN input component to clarify that it waits for its output message to be acknowledged before prompting for the next input. This change is made in the `stdin_input.py` file.

* chore: add is_broker_request_response_enabled method

* chore: Some changes after review

* feat: AI-129: add ability to specify a default value for a an environment variable in a .yaml config file (#43)

* DATAGO-85484 Bump min python version

---------

Co-authored-by: Cyrus Mobini <[email protected]>
Co-authored-by: Art Morozov <[email protected]>
Co-authored-by: Art Morozov <[email protected]>
cyrus2281 added a commit that referenced this pull request Dec 3, 2024
* Added the assembly component

* Auto-generated documents

* Added type check

* Update the cache service expiry logic + Update the assembly component to use cache expiry for timeout

* Moved assembly to the correct place
cyrus2281 added a commit that referenced this pull request Dec 3, 2024
…ved docs and examples and better testing (#39)

* Examples Update + Code Refactor (#25)

* Removed StorageManager

* Added examples for OpenAI, Bedrock, Anthropic, and VertexAI

* Updating old examples (1/2)

* Updating old examples (2/2)

* Added support for temporary queue + UUID queue name (#26)

* Add assembly component and auto-generated documents (#27)

* Added the assembly component

* Auto-generated documents

* Added type check

* Update the cache service expiry logic + Update the assembly component to use cache expiry for timeout

* Moved assembly to the correct place

* Added MoA Example + UUID Invoke Function (#28)

* MoA example: Broadcast to multiple agents

* Added MoA event manager, added uuid invoke_function + test, updated auto-generated docs

* Added assembly layer to MoA example

* Update documentation for new users + Refactored component_input & source_expression (#29)

* Refactored component_input to input_selection

* Updated, added, and enhanced the documentation with new users in mind

* Refactored source_expression function to evaluate_expression (backward compatible)

* Added tips and tricks section + info and examples on custom modules

* tiny format update

* tiny update

* Fixed solace disconnection issues on shutting down (#30)

* Add RAG example for AI connector + delete action for vector index (#31)

* Added a RAG example for AI connector

* Added delete option to vectordb

* Changed id to ids

* chore: Refactor make_history_start_with_user_message method (#32)

Fix the method to not trim the first entry if it is a "system" role

* Keep history depth needs to be a positive integer and test refactor (#33)

* chore: Refactor clear_history_but_keep_depth method to handle negative depth values

* chore: small change to how this is solved

* chore: one more try

* refactor: move utils_for_test_files.py to solace_ai_connector module

* refactor: removed the orginal utils_for_test_files.py

* refactor: update import statements in test files

* refactor: add sys.path.append("src") to test files

* refactor: standardize import order and sys.path.append in test files

* refactor: a bit more test infrastructure changes

* feat: allow component_module to accept module objects directly

* feat: add types module import to utils.py

* test: add static import and object config test

* refactor: update test_static_import_and_object_config to use create_test_flows

* refactor: Improve test structure and remove duplicate test case

* fix: remove duplicate import of yaml module

* refactor: Modify test config to use dict instead of YAML string

* refactor: convert config_yaml from string to dictionary

* refactor: update static import test to use pass_through component

* test: Add delay component message passing test

* feat: add test for delay component message processing

* feat: Added a new test function (test_one_component) to make it very easy to just run some quick tests on a single input -> expected output tests on a single component

* feat: added input_transforms to the test_one_component so that input transforms can be tested with it

* chore: a bit of cleanup and new tests for test_one_component

* chore: rename test_one_component because it was being picked up as a test by the pytest scanner

* fix: fixed a typo

* Fix for anthropic example (#35)

* Updating version dependency (#37)

* Fixed url and file name in getting started (#38)

* Add guide for RAG (#39)

* Added guide for RAG

* update wording

* Added link to other docs from RAG guide (#40)

* chore: added a timeout setting for running component tests so that you can test situations where you don't expect any output (#34)

* AI-124: Add a feature to provide simple blocking broker request/response ability for components (#42)

* feat: add request_response_controller.py

* feat: implement RequestResponseFlowManager and RequestResponseController classes

* style: format code with black and improve readability

* feat: implement RequestResponseController for flow-based request-response handling

* feat: implement RequestResponseController for handling request-response patterns

* fix: import SolaceAiConnector for type checking

* refactor: restructure Flow class and improve code organization

* feat: implement multiple named RequestResponseControllers per component

* refactor: initialize request-response controllers in ComponentBase

* test: add request_response_controller functionality tests

* feat: finished implementation and added some tests

* refactor: rename RequestResponseController to RequestResponseFlowController

* refactor: rename RequestResponseController to RequestResponseFlowController

* refactor: some name changes

* fix: update test function names for RequestResponseFlowController

* refactor: more name changes

* Ed/req_resp_examples_and_fixes (#41)

* feat: Added a request_response_flow example and fixed a few issues along the way

* feat: Reworked the broker_request_response built-in ability of components to be simpler. Instead of having to have a defined flow and then name that flow, it will automatically create a flow with a single broker_request_response component in it. Now there is a straightforward interating function call to allow components to issue a request and get streaming or non-streaming responses from that flow.

* chore: fix the request_response example and remove the old one

* docs: add broker request-response configuration

* docs: added advanced_component_features.md

* docs: add broker request-response configuration details

* docs: add payload encoding and format to broker config

* docs: add cache service and timer manager to advanced_component_features.md

* docs: add configuration requirement for broker request-response

* docs: update broker request-response section with configuration info

* docs: a bit more detail about do_broker_request_response

* docs: add link to advanced features page in table of contents

* docs: add link to advanced features page

* docs: reorder table of contents in index.md

* docs: add custom components documentation

* docs: Remove advanced component features from table of contents

* docs: clean up a double inclusion of the same section

* docs: small example change

* chore: remove dead code

* chore: add some extra comments to explain some test code

* docs: Update description of STDIN input component

Update the description of the STDIN input component to clarify that it waits for its output message to be acknowledged before prompting for the next input. This change is made in the `stdin_input.py` file.

* chore: add is_broker_request_response_enabled method

* chore: Some changes after review

* feat: AI-129: add ability to specify a default value for a an environment variable in a .yaml config file (#43)

* DATAGO-85484 Bump min python version

---------

Co-authored-by: Cyrus Mobini <[email protected]>
Co-authored-by: Art Morozov <[email protected]>
Co-authored-by: Art Morozov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants