File size: 692 Bytes
bf3049a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

import unittest
from agent import build_graph
from langchain_core.messages import HumanMessage


class BaseLangGraphTest(unittest.TestCase):
    """Default to a weak but higher rate model for testing agentic tool usage."""
    system_prompt = None

    @classmethod
    def setUpClass(cls):
        cls.graph = build_graph(test_mode=True, system_prompt=cls.system_prompt)

    def run_agent(self, query: str) -> str:
        messages = [HumanMessage(content=query)]
        result = self.graph.invoke({"messages": messages})
        return result["messages"][-1].content.strip().lower()