summaryrefslogtreecommitdiff
path: root/client.py
blob: 0cbd91c651e3ab3007a7e56e6410e8d1f0d47b00 (plain)
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
from agent import Agent
from identity import load_agent_identity, load_user_profile
from llm import LLM
from tools import (
    CalculatorTool,
    FileSystemListTool,
    FileSystemReadTool,
    HelloTool,
    ToolRegistry,
    WeatherTool,
)

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())
tools.register(WeatherTool())
tools.register(FileSystemListTool())
tools.register(FileSystemReadTool())

agent = Agent(
    llm,
    agent_identity,
    user_profile,
    tools,
)

while True:
    user_input = input("You: ")

    if user_input.lower() in {"exit", "quit"}:
        break

    answer = agent.chat(user_input)
    print(f"Agent: {answer}")