diff options
| author | batsumaru <> | 2026-09-11 15:42:11 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-09-11 15:42:11 +0900 |
| commit | c90a0f8ae6ad5d6e07927cd0dc53b345a77494ae (patch) | |
| tree | e7ee1ba30acebdae659b62e193df95e7d7509058 /client.py | |
| parent | 1048bc145cd0341fcbdd269f3275079bc40ede70 (diff) | |
Added tool calling base
Diffstat (limited to 'client.py')
| -rw-r--r-- | client.py | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -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}") |
