mezoAgent 0.8.2__py3-none-any.whl → 0.8.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mezoAgent-0.8.2.dist-info → mezoAgent-0.8.3.dist-info}/METADATA +1 -1
- {mezoAgent-0.8.2.dist-info → mezoAgent-0.8.3.dist-info}/RECORD +5 -5
- mezo_agent/safe_mode_btc_tool.py +21 -16
- {mezoAgent-0.8.2.dist-info → mezoAgent-0.8.3.dist-info}/WHEEL +0 -0
- {mezoAgent-0.8.2.dist-info → mezoAgent-0.8.3.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ mezo_agent/characters.py,sha256=wub7y9BrAAdAKWwcNAdgrvhRi2zHMaZNzTr2y3qtbsw,515
|
|
3
3
|
mezo_agent/chat.py,sha256=ZtNurUDV7UzJjbFyU96DNGy37hO3gl0osn19mRu7ER8,859
|
4
4
|
mezo_agent/config.py,sha256=6xFgk80eiBLTasKGW73Ne8hNhMtx8BbQ_Ef79YOyDlc,3233
|
5
5
|
mezo_agent/parsing.py,sha256=PeR1R6gqzM9VXt7OdWANDoL7GbzMMRjKLzuP10uugEs,5101
|
6
|
-
mezo_agent/safe_mode_btc_tool.py,sha256=
|
6
|
+
mezo_agent/safe_mode_btc_tool.py,sha256=lqMjzcrU1kehB91gU7oJHX3MxWnH1bAoIFPx5NWASnk,3602
|
7
7
|
mezo_agent/swap_musd_btc.py,sha256=Co-XcfK73spm94VC6qzGY0VYoGwsMDKKHM8ToGh2JxU,4289
|
8
8
|
mezo_agent/token_balance_tool.py,sha256=zOjDJdfYT6LuQzPuAxxNeee1srsepevE71fqboiDSWI,1422
|
9
9
|
mezo_agent/token_price_tool.py,sha256=vD-ukq0D_4zmjIy9bZ9qL44nGctf-hWzkQuTd-0wy2U,930
|
@@ -13,7 +13,7 @@ mezo_agent/twitter_client.py,sha256=Va8ZQaK5lZjJUq3-bhIJWnDmX4Mmt4kWRW3aKSGbLq8,
|
|
13
13
|
mezo_agent/twitter_manager.py,sha256=KvxiMOhBmQbLuLoVrAQ77DpAnFIdiDSztsKbZ_3-ar4,2363
|
14
14
|
mezo_agent/utils.py,sha256=hsGtL_iXvUVGnY5aHPQ0v6Jejxd4P4qw0yOtS1omToU,1397
|
15
15
|
mezo_agent/data/new_router.json,sha256=A8U-NVfe1F-hDyR90_SuH8jDAxmzyyHWdJW62j9TZsc,26756
|
16
|
-
mezoAgent-0.8.
|
17
|
-
mezoAgent-0.8.
|
18
|
-
mezoAgent-0.8.
|
19
|
-
mezoAgent-0.8.
|
16
|
+
mezoAgent-0.8.3.dist-info/METADATA,sha256=TSlWeFI6Umzez4U-jq-noFYP93xQCZm6RAHioLSor3w,266
|
17
|
+
mezoAgent-0.8.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
18
|
+
mezoAgent-0.8.3.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
|
19
|
+
mezoAgent-0.8.3.dist-info/RECORD,,
|
mezo_agent/safe_mode_btc_tool.py
CHANGED
@@ -1,19 +1,24 @@
|
|
1
|
-
from langchain.tools import tool
|
2
1
|
from web3.exceptions import Web3Exception
|
3
2
|
import json
|
4
3
|
from mezo_agent.config import web3_instance, sender_address, account
|
5
4
|
from mezo_agent.parsing import extract_transaction_details
|
6
5
|
from langchain_openai import ChatOpenAI
|
7
6
|
from .config import OPENAI_API_KEY
|
7
|
+
from langchain.tools import tool
|
8
8
|
|
9
9
|
@tool
|
10
|
-
def mezo_agent_safe_mode_btc_transaction(prompt: str
|
10
|
+
def mezo_agent_safe_mode_btc_transaction(prompt: str) -> str:
|
11
11
|
"""
|
12
12
|
Sends BTC on Mezo Matsnet with a Human-in-the-Loop confirmation step.
|
13
|
+
|
13
14
|
1) Parses user prompt for transaction details.
|
14
15
|
2) Calls LLM to provide a verbose explanation of the transaction data.
|
15
16
|
3) Shows both raw data and LLM explanation to the user.
|
16
|
-
4)
|
17
|
+
4) ALWAYS prompts the user for confirmation before broadcasting.
|
18
|
+
|
19
|
+
NOTE: Because this function is decorated with @tool, it can only take a
|
20
|
+
single string argument (prompt). The confirm_before_sending parameter
|
21
|
+
has been removed to avoid LangChain's TypeError.
|
17
22
|
"""
|
18
23
|
|
19
24
|
# 1) Parse transaction details
|
@@ -42,10 +47,10 @@ def mezo_agent_safe_mode_btc_transaction(prompt: str, confirm_before_sending: bo
|
|
42
47
|
"gas": gas_limit,
|
43
48
|
"gasPrice": gas_price,
|
44
49
|
"nonce": nonce,
|
45
|
-
"chainId": 31611, # Mezo Testnet
|
50
|
+
"chainId": 31611, # Mezo Testnet chain ID
|
46
51
|
}
|
47
52
|
|
48
|
-
# 4) Generate
|
53
|
+
# 4) Generate LLM Explanation
|
49
54
|
analysis_prompt = f"""
|
50
55
|
You are given the following transaction data on Mezo Matsnet:
|
51
56
|
- Recipient: {recipient}
|
@@ -66,19 +71,18 @@ Use a concise and helpful tone.
|
|
66
71
|
analysis_response = llm.invoke(analysis_prompt)
|
67
72
|
explanation_text = analysis_response.content if analysis_response else "❌ LLM explanation unavailable."
|
68
73
|
|
69
|
-
# 5)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
print("----------------------------")
|
74
|
+
# 5) ALWAYS confirm with the user before sending
|
75
|
+
print("\n--- BTC Transaction Data ---")
|
76
|
+
print(json.dumps(tx_data, indent=2))
|
77
|
+
print("----------------------------")
|
74
78
|
|
75
|
-
|
76
|
-
|
77
|
-
|
79
|
+
print("\n--- LLM Analysis ---")
|
80
|
+
print(explanation_text)
|
81
|
+
print("--------------------")
|
78
82
|
|
79
|
-
|
80
|
-
|
81
|
-
|
83
|
+
choice = input("Do you want to proceed with this BTC transaction? [y/n]: ").strip().lower()
|
84
|
+
if choice != 'y':
|
85
|
+
return "❌ Transaction aborted by user."
|
82
86
|
|
83
87
|
# 6) Sign & send
|
84
88
|
try:
|
@@ -87,3 +91,4 @@ Use a concise and helpful tone.
|
|
87
91
|
return f"✅ BTC transaction successful! Hash: {tx_hash.hex()}"
|
88
92
|
except Web3Exception as e:
|
89
93
|
return f"❌ Transaction failed: {str(e)}"
|
94
|
+
|
File without changes
|
File without changes
|