feat: LLM agent #12

Merged
2584433 merged 13 commits from feat/llm-agent into dev 2025-10-29 12:58:41 +00:00
2 changed files with 12 additions and 9 deletions
Showing only changes of commit 281bc57b6e - Show all commits

View File

@@ -21,10 +21,10 @@ uv sync
To run a LLM locally download https://lmstudio.ai To run a LLM locally download https://lmstudio.ai
When installing select developer mode, download a model (it will already suggest one) and run it (see developer window, status: running) When installing select developer mode, download a model (it will already suggest one) and run it (see developer window, status: running)
copy the url at the top right and replace LOCAL_LLM_URL with it + v1/chat/completions. copy the url at the top right and replace local_llm_url with it + v1/chat/completions.
This + part might differ based on what model you choose. This + part might differ based on what model you choose.
copy the model name in the module loaded and replace LOCAL_LLM_MODEL. copy the model name in the module loaded and replace local_llm_modelL. In settings.
## Running ## Running

View File

@@ -59,7 +59,7 @@ class BDICoreAgent(BDIAgent):
class SendBehaviour(OneShotBehaviour): class SendBehaviour(OneShotBehaviour):
async def run(self) -> None: async def run(self) -> None:
msg = Message( msg = Message(
to= settings.agent_settings.test_agent_name + '@' + settings.agent_settings.host, to= settings.agent_settings.llm_agent_name + '@' + settings.agent_settings.host,
body= text, body= text,
thread= "llm_request", thread= "llm_request",
) )
@@ -81,13 +81,16 @@ class BDICoreAgent(BDIAgent):
if not msg: if not msg:
return return
sender = msg.sender.node
match sender:
case settings.agent_settings.llm_agent_name:
content = msg.body content = msg.body
self.agent.logger.info("Received LLM response: %s", content) self.agent.logger.info("Received LLM response: %s", content)
#Here the BDI can pass the message back as a response
case _:
self.logger.debug("Not from the llm, discarding message")
pass
# TODO: Convert response into a belief (optional future feature)
# Example:
# self.agent.add_belief("llm_response", content)
# self.agent.logger.debug("Added belief: llm_response(%s)", content)
template = Template() template = Template()
template.thread = "llm_response" template.thread = "llm_response"