Agent infrastructure with client and stub server

This commit is contained in:
Cyber MacGeddon 2024-11-09 18:31:53 +00:00
parent 30bc6f15da
commit dbd20ea901
10 changed files with 288 additions and 5 deletions

21
tests/test-agent Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python3
import json
from trustgraph.clients.agent_client import AgentClient
p = AgentClient(pulsar_host="pulsar://localhost:6650")
q = "How many cats does Mark have? Calculate that number raised to 0.4 power. Is that number lower than the numeric part of the mission identifier of the Space Shuttle Challenger on its last mission? If so, give me an apple pie recipe, otherwise return a poem about cheese."
def think(x):
print(f"think: {x}")
def observe(x):
print(f"observe: {x}")
resp = p.request(
question=q, think=think, observe=observe,
)
print(resp)

View file

@ -5,9 +5,10 @@ from trustgraph.clients.llm_client import LlmClient
llm = LlmClient(pulsar_host="pulsar://localhost:6650")
system = "You are a lovely assistant."
prompt="Write a funny limerick about a llama"
resp = llm.request(prompt)
resp = llm.request(system, prompt)
print(resp)