-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_brain_update.py
More file actions
40 lines (34 loc) · 1.12 KB
/
test_brain_update.py
File metadata and controls
40 lines (34 loc) · 1.12 KB
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
import os
import sys
# Ensure the parent directory is in the path
sys.path.insert(0, os.path.abspath('.'))
from dotenv import load_dotenv
load_dotenv()
print("API KEY:", bool(os.getenv("GOOGLE_API_KEY")))
import asyncio
from langchain_core.messages import HumanMessage, AIMessage
from agent.state import AgentState
from agent.permanent_knowledge import PERMANENT_KNOWLEDGE
async def run_update():
from agent.graphs.brain import update_node
state = {
"messages": [
HumanMessage(content="What is Devinda's favorite database?", name="User"),
AIMessage(content="Devinda really likes PostgreSQL for relational data.", name="Brain")
],
"temp_knowledge": {},
"permanent_knowledge": PERMANENT_KNOWLEDGE,
"generated_questions": [],
"brain_thought": None,
"mind_action": None
}
try:
print("Testing brain's update_node...")
res = await update_node(state)
print("RESULT:")
print(res)
except Exception as e:
import traceback
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(run_update())