mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-17 11:25:12 +02:00
Feature/agent manager (#146)
* Agent schema * Agent working through client * Add agent-manager-react command line * test-agent test script * Add tg-invoke-agent CLI
This commit is contained in:
parent
5140f8834d
commit
36cdeab588
19 changed files with 968 additions and 3 deletions
44
tests/test-agent
Executable file
44
tests/test-agent
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import textwrap
|
||||
from trustgraph.clients.agent_client import AgentClient
|
||||
|
||||
def wrap(text, width=75):
|
||||
|
||||
if text is None: text = "n/a"
|
||||
|
||||
out = textwrap.wrap(
|
||||
text, width=width
|
||||
)
|
||||
return "\n".join(out)
|
||||
|
||||
def output(text, prefix="> ", width=78):
|
||||
|
||||
out = textwrap.indent(
|
||||
text, prefix=prefix
|
||||
)
|
||||
print(out)
|
||||
|
||||
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."
|
||||
|
||||
output(wrap(q), "\U00002753 ")
|
||||
print()
|
||||
|
||||
def think(x):
|
||||
output(wrap(x), "\U0001f914 ")
|
||||
print()
|
||||
|
||||
def observe(x):
|
||||
output(wrap(x), "\U0001f4a1 ")
|
||||
print()
|
||||
|
||||
resp = p.request(
|
||||
question=q, think=think, observe=observe,
|
||||
)
|
||||
|
||||
output(resp, "\U0001f4ac ")
|
||||
print()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue