From c90a0f8ae6ad5d6e07927cd0dc53b345a77494ae Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Fri, 11 Sep 2026 15:42:11 +0900 Subject: Added tool calling base --- client.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'client.py') diff --git a/client.py b/client.py index c983db1..8d6829d 100644 --- a/client.py +++ b/client.py @@ -1,16 +1,24 @@ from agent import Agent from identity import load_agent_identity, load_user_profile from llm import LLM +from tools import CalculatorTool, HelloTool, ToolRegistry -llm = LLM("http://localhost:8080/v1/chat/completions",) +llm = LLM( + "http://localhost:8080/v1/chat/completions", +) agent_identity = load_agent_identity("agent.toml") user_profile = load_user_profile("user.toml") +tools = ToolRegistry() +tools.register(HelloTool()) +tools.register(CalculatorTool()) + agent = Agent( llm, agent_identity, user_profile, + tools, ) while True: @@ -18,10 +26,6 @@ while True: if user_input.lower() in {"exit", "quit"}: break - - print("Agent: ", end="", flush=True) - - for chunk in agent.chat(user_input): - print(chunk, end="", flush=True) - - print() + + answer = agent.chat(user_input) + print(f"Agent: {answer}") -- cgit v1.3