-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo.py
66 lines (47 loc) · 2.01 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from web3_copilot.agent import Web3CopilotAgent
agent = Web3CopilotAgent()
def web3_copilot_chat(message):
response = agent.interact(message)
print("---begin agent response---")
print(response.try_best_message.unwrap_or("no agent message").message)
print("---end agent response---")
def demo_doc_retrieval():
print("------------------BEGIN: Doc Retrieval Skill Demo------------------")
project_questions = {
"uniswap": [
"What is Uniswap?",
"What is soft governance in Uniswap?"
],
"avalanche": [
"How is Avalanche different from Ethereum?",
"What is the X-Chain and how is it different from the C-Chain?"
],
"cosmos": [
"Why would one use the Cosmos SDK?",
"How do I setup the keyring for my Cosmos Node?"
],
"polygon": [
"Is Polygon a layer 2 blockchain or a layer 1 blockchains?",
"What are Polygon supernets?"
]
}
for project in project_questions:
print(f"------------------Sending questions about {project}------------------")
for question in project_questions[project]:
print(f"PROMPT: {question}\n")
web3_copilot_chat(question)
print(f"------------------Done with {project} questions------------------\n")
print("------------------END: Doc Retrieval Skill Demo------------------\n")
def demo_txn_debugger():
print("------------------BEGIN: Transaction Debugger Skill Demo------------------")
prompts = [
"Why did my txn fail - 0xf6870204a21b88e47e5bc788852905669c61419d676a9a18bfa5a96e9928f70c?",
"What's happening in this tx - 0xf6870204a21b88e47e5bc788852905669c61419d676a9a18bfa5a96e9928f70c?"
]
for prompt in prompts:
print(f"PROMPT: {prompt}\n")
web3_copilot_chat(prompt)
print("------------------END: Transaction Debugger Skill Demo------------------\n")
demo_doc_retrieval()
demo_txn_debugger()
# print(f"\n{agent.render()}")