daveshap / ACE_Framework

ACE (Autonomous Cognitive Entities) - 100% local and open source autonomous agents
MIT License
1.46k stars 205 forks source link

Layer Integration #148

Closed dpearson00 closed 10 months ago

dpearson00 commented 11 months ago

Pull Request: Layer Communication Timing Fix and Layer 6 Functionality Enhancement

Summary

This Pull Request addresses an issue with the timing of communication between Layer 1 and Layer 2, which was causing subsequent messages to not be passed to other layers. Additionally, an attempt was made to enhance functionality in Layer 6.

Details

Layer Communication Timing Issue

Layer 6 Functionality Enhancement

Other Minor Changes

Conclusion

This Pull Request provides a temporary fix for the communication timing issue between layers and attempts to enhance functionality in Layer 6. Further improvements and a more permanent solution for the layer communication issue will be explored in future updates.

thehunmonkgroup commented 11 months ago

Getting this error:

helloaf-system_integrity-1                | SystemIntegrity - INFO - [system_integrity (System Integrity)] Beginning work from top layer: layer_1
helloaf-aspirational_layer-1              | Layer1 - INFO - layer_1 (Aspirational) received command to begin work
helloaf-aspirational_layer-1              | Layer1 - ERROR - [layer_1 (Aspirational)] failed [System Integrity] command: method begin_work, error: 'ChatCompletionMessage' object is not subscriptable
helloaf-aspirational_layer-1              | Traceback (most recent call last):
helloaf-aspirational_layer-1              |   File "/app/ace/framework/resource.py", line 355, in system_integrity_run_command
helloaf-aspirational_layer-1              |     method(**kwargs)
helloaf-aspirational_layer-1              |   File "/app/ace/resources/core/hello_layers/layer_1.py", line 58, in begin_work
helloaf-aspirational_layer-1              |     llm_response_content = llm_response["content"].strip()
helloaf-aspirational_layer-1              |                            ~~~~~~~~~~~~^^^^^^^^^^^
helloaf-aspirational_layer-1              | TypeError: 'ChatCompletionMessage' object is not subscriptable

Looks like the openai package upgrade may necessitate some other changes?

thehunmonkgroup commented 11 months ago

Still getting errors:

helloaf-agent_model_layer-1               | Layer3 - INFO - [layer_3 (Agent Model)] received an [event] message from layer: layer_2, bus direction: southbound
helloaf-agent_model_layer-1               | Layer3 - INFO - [layer_3 (Agent Model)] handle event: execute, data: {'resource': {'destination': 'pathway.layer_2.southbound', 'source': 'layer_2'}, 'timestamp': '2024-01-07 14:55:39', 'direction': 'southbound'}
helloaf-agent_model_layer-1               | Layer3 - INFO - [layer_3 (Agent Model)] agent run and publish...
helloaf-agent_model_layer-1               | Exception in callback _task_done(<Task finishe...bscriptable")>) at /usr/local/lib/python3.11/site-packages/aio_pika/tools.py:43
helloaf-agent_model_layer-1               | handle: <Handle _task_done(<Task finishe...bscriptable")>) at /usr/local/lib/python3.11/site-packages/aio_pika/tools.py:43>
helloaf-agent_model_layer-1               | Traceback (most recent call last):
helloaf-agent_model_layer-1               |   File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
helloaf-agent_model_layer-1               |     self._context.run(self._callback, *self._args)
helloaf-agent_model_layer-1               |   File "/usr/local/lib/python3.11/site-packages/aio_pika/tools.py", line 47, in _task_done
helloaf-agent_model_layer-1               |     raise exc
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 475, in southbound_message_handler
helloaf-agent_model_layer-1               |     await self.route_message("southbound", message)
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 459, in route_message
helloaf-agent_model_layer-1               |     return await self.handle_event(event, data)
helloaf-agent_model_layer-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
helloaf-agent_model_layer-1               |   File "/app/ace/resources/core/hello_layers/layer_3.py", line 97, in handle_event
helloaf-agent_model_layer-1               |     self.agent_run_layer()
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 323, in agent_run_layer
helloaf-agent_model_layer-1               |     self.agent_run_and_publish(
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 284, in agent_run_and_publish
helloaf-agent_model_layer-1               |     messages_northbound, messages_southbound = self.process_layer_messages(
helloaf-agent_model_layer-1               |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
helloaf-agent_model_layer-1               |   File "/app/ace/resources/core/hello_layers/layer_3.py", line 81, in process_layer_messages
helloaf-agent_model_layer-1               |     llm_response_content = llm_response["content"].strip()
helloaf-agent_model_layer-1               |                            ~~~~~~~~~~~~^^^^^^^^^^^
helloaf-agent_model_layer-1               | TypeError: 'ChatCompletionMessage' object is not subscriptable
helloaf-agent_model_layer-1               | Task exception was never retrieved
helloaf-agent_model_layer-1               | future: <Task finished name='Task-61' coro=<consumer() done, defined at /usr/local/lib/python3.11/site-packages/aio_pika/queue.py:31> exception=TypeError("'ChatCompletionMessage' object is not subscriptable")>
helloaf-agent_model_layer-1               | Traceback (most recent call last):
helloaf-agent_model_layer-1               |   File "/usr/local/lib/python3.11/site-packages/aio_pika/queue.py", line 37, in consumer
helloaf-agent_model_layer-1               |     return await create_task(callback, message)
helloaf-agent_model_layer-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 475, in southbound_message_handler
helloaf-agent_model_layer-1               |     await self.route_message("southbound", message)
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 459, in route_message
helloaf-agent_model_layer-1               |     return await self.handle_event(event, data)
helloaf-agent_model_layer-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
helloaf-agent_model_layer-1               |   File "/app/ace/resources/core/hello_layers/layer_3.py", line 97, in handle_event
helloaf-agent_model_layer-1               |     self.agent_run_layer()
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 323, in agent_run_layer
helloaf-agent_model_layer-1               |     self.agent_run_and_publish(
helloaf-agent_model_layer-1               |   File "/app/ace/framework/layer.py", line 284, in agent_run_and_publish
helloaf-agent_model_layer-1               |     messages_northbound, messages_southbound = self.process_layer_messages(
helloaf-agent_model_layer-1               |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
helloaf-agent_model_layer-1               |   File "/app/ace/resources/core/hello_layers/layer_3.py", line 81, in process_layer_messages
helloaf-agent_model_layer-1               |     llm_response_content = llm_response["content"].strip()
helloaf-agent_model_layer-1               |                            ~~~~~~~~~~~~^^^^^^^^^^^
helloaf-agent_model_layer-1               | TypeError: 'ChatCompletionMessage' object is not subscriptable