feat: incomplete working pipeline
ref: all
This commit is contained in:
@@ -31,9 +31,6 @@ class BDICoreAgent(BDIAgent):
|
||||
self.add_behaviour(BeliefSetterBehaviour())
|
||||
self.add_behaviour(ReceiveLLMResponseBehaviour())
|
||||
|
||||
await self._send_to_llm("Hi pepper, how are you?")
|
||||
# This is the example message currently sent to the llm at the start of the Program
|
||||
|
||||
self.logger.info("BDICoreAgent setup complete")
|
||||
|
||||
def add_custom_actions(self, actions) -> None:
|
||||
@@ -50,10 +47,10 @@ class BDICoreAgent(BDIAgent):
|
||||
message_text = agentspeak.grounded(term.args[0], intention.scope)
|
||||
self.logger.info("Reply action sending: %s", message_text)
|
||||
|
||||
self._send_to_llm(message_text)
|
||||
self._send_to_llm(str(message_text))
|
||||
yield
|
||||
|
||||
async def _send_to_llm(self, text: str):
|
||||
def _send_to_llm(self, text: str):
|
||||
"""
|
||||
Sends a text query to the LLM Agent asynchronously.
|
||||
"""
|
||||
@@ -66,6 +63,6 @@ class BDICoreAgent(BDIAgent):
|
||||
)
|
||||
|
||||
await self.send(msg)
|
||||
self.agent.logger.debug("Message sent to LLM: %s", text)
|
||||
self.agent.logger.info("Message sent to LLM: %s", text)
|
||||
|
||||
self.add_behaviour(SendBehaviour())
|
||||
@@ -61,10 +61,6 @@ class BeliefSetterBehaviour(CyclicBehaviour):
|
||||
self.agent.bdi.set_belief(belief, *arguments)
|
||||
|
||||
# Special case: if there's a new user message, flag that we haven't responded yet
|
||||
if belief == "user_said":
|
||||
try:
|
||||
self.agent.bdi.remove_belief("responded")
|
||||
except BeliefNotInitiated:
|
||||
pass
|
||||
if belief == "user_said": self.agent.bdi.set_belief("new_message")
|
||||
|
||||
self.logger.info("Set belief %s with arguments %s", belief, arguments)
|
||||
|
||||
@@ -41,8 +41,7 @@ class BeliefFromText(CyclicBehaviour):
|
||||
if msg:
|
||||
sender = msg.sender.node
|
||||
match sender:
|
||||
# TODO: Change to Transcriber agent name once implemented
|
||||
case settings.agent_settings.test_agent_name:
|
||||
case settings.agent_settings.transcription_agent_name:
|
||||
self.logger.info("Received text from transcriber.")
|
||||
await self._process_transcription_demo(msg.body)
|
||||
case _:
|
||||
@@ -84,10 +83,9 @@ class BeliefFromText(CyclicBehaviour):
|
||||
'user_said' is relevant, so this function simply makes a dict with key: "user_said",
|
||||
value: txt and passes this to the Belief Collector agent.
|
||||
"""
|
||||
belief = {"user_said": [txt]}
|
||||
belief = {"beliefs": {"user_said": [txt]}, "type": "belief_extraction_text"}
|
||||
payload = json.dumps(belief)
|
||||
# TODO: Change to belief collector
|
||||
belief_msg = Message(to=settings.agent_settings.bdi_core_agent_name
|
||||
belief_msg = Message(to=settings.agent_settings.belief_collector_agent_name
|
||||
+ '@' + settings.agent_settings.host,
|
||||
body=payload)
|
||||
belief_msg.thread = "beliefs"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
+user_said(Message) : not responded <-
|
||||
+responded;
|
||||
+new_message : user_said(Message) <-
|
||||
-new_message;
|
||||
.reply(Message).
|
||||
|
||||
@@ -104,14 +104,8 @@ class ContinuousBeliefCollector(CyclicBehaviour):
|
||||
|
||||
to_jid = f"{settings.agent_settings.bdi_core_agent_name}@{settings.agent_settings.host}"
|
||||
|
||||
packet = {
|
||||
"type": "belief_packet",
|
||||
"origin": origin,
|
||||
"beliefs": beliefs,
|
||||
}
|
||||
|
||||
msg = Message(to=to_jid)
|
||||
msg.body = json.dumps(packet)
|
||||
msg = Message(to=to_jid, sender=self.agent.jid, thread="beliefs")
|
||||
msg.body = json.dumps(beliefs)
|
||||
|
||||
|
||||
await self.send(msg)
|
||||
|
||||
@@ -86,6 +86,7 @@ class MLXWhisperSpeechRecognizer(SpeechRecognizer):
|
||||
return mlx_whisper.transcribe(audio,
|
||||
path_or_hf_repo=self.model_name,
|
||||
decode_options=self._get_decode_options(audio))["text"]
|
||||
return mlx_whisper.transcribe(audio, path_or_hf_repo=self.model_name)["text"].strip()
|
||||
|
||||
|
||||
class OpenAIWhisperSpeechRecognizer(SpeechRecognizer):
|
||||
|
||||
@@ -45,7 +45,10 @@ class TranscriptionAgent(Agent):
|
||||
|
||||
async def _share_transcription(self, transcription: str):
|
||||
"""Share a transcription to the other agents that depend on it."""
|
||||
receiver_jids = [] # Set message receivers here
|
||||
receiver_jids = [
|
||||
settings.agent_settings.text_belief_extractor_agent_name
|
||||
+ '@' + settings.agent_settings.host,
|
||||
] # Set message receivers here
|
||||
|
||||
for receiver_jid in receiver_jids:
|
||||
message = Message(to=receiver_jid, body=transcription)
|
||||
|
||||
Reference in New Issue
Block a user