From 5673461981adfc8f887be7fb3537faa714fac2f8 Mon Sep 17 00:00:00 2001 From: David Vilela Date: Wed, 29 May 2024 16:57:15 +0200 Subject: [PATCH] fix: more hacks --- packages/packages.json | 2 +- packages/valory/customs/prediction_langchain/component.yaml | 2 +- .../customs/prediction_langchain/prediction_langchain.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index f2ace161..47a469ef 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -22,7 +22,7 @@ "custom/napthaai/prediction_request_reasoning_claude/0.1.0": "bafybeihtx2cejxoy42jwk2i5m4evfzz537aic5njuawxnzdzwlo63kdduq", "custom/napthaai/prediction_request_rag_claude/0.1.0": "bafybeickr32t7nmapuoymjyo3cf5rr2v2zapksxcivuqsgjr2gn6zo6y7y", "custom/napthaai/prediction_request_rag_cohere/0.1.0": "bafybeihh26kwgqkzojd4zastto5mgod7o7esll4f4icurvwumvwuzmosrm", - "custom/valory/prediction_langchain/0.1.0": "bafybeiaep6frkvxxbhfc4f7fy3q4zi5hhks72xelkpkuqdes3rjwjyrlve", + "custom/valory/prediction_langchain/0.1.0": "bafybeihhii7veepp6ovkmqjnkp6euhkwm52obabgdltdj34ikisfd7yvqi", "protocol/valory/acn_data_share/0.1.0": "bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq", "protocol/valory/websocket_client/0.1.0": "bafybeifjk254sy65rna2k32kynzenutujwqndap2r222afvr3zezi27mx4", "contract/valory/agent_mech/0.1.0": "bafybeiah6b5epo2hlvzg5rr2cydgpp2waausoyrpnoarf7oa7bw33rex34", diff --git a/packages/valory/customs/prediction_langchain/component.yaml b/packages/valory/customs/prediction_langchain/component.yaml index ee01dafe..119011d7 100644 --- a/packages/valory/customs/prediction_langchain/component.yaml +++ b/packages/valory/customs/prediction_langchain/component.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeid2llyk4lr55nmq3aubhnjy4pwskzb3dmvcn5z57geyy3lmua6fue - prediction_langchain.py: bafybeidrcoltwi7vb2hitknmoh36ct5d4jdro7w26xcpmwjemznu7r63ja + prediction_langchain.py: bafybeibg6giebyxjpqch2jvtvrwufp3n75n55xmqjgu3rlc4rfopnfcxlm fingerprint_ignore_patterns: [] entry_point: prediction_langchain.py callable: run diff --git a/packages/valory/customs/prediction_langchain/prediction_langchain.py b/packages/valory/customs/prediction_langchain/prediction_langchain.py index 41e12b96..c0c6c799 100644 --- a/packages/valory/customs/prediction_langchain/prediction_langchain.py +++ b/packages/valory/customs/prediction_langchain/prediction_langchain.py @@ -252,8 +252,11 @@ def run_langgraph(topic: str, timeframe: str, question: str) -> Tuple[str, str]: event_list = [e for e in events] # Response is the last message from the last event + last_event = event_list[-1] + last_sender = list(last_event.keys())[0] + last_message = last_event[last_sender]["messages"][-1] response = ( - event_list[-1]["researcher"]["messages"][-1] + last_message .content.replace("FINAL ANSWER:", "") .replace("FINAL ANSWER", "") .strip()