mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-23 20:21:03 +02:00
Agent working
This commit is contained in:
parent
fca082879a
commit
ac383d4452
2 changed files with 13 additions and 6 deletions
|
|
@ -80,11 +80,12 @@ class AgentManager:
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
# Try to parse as JSON
|
# Try to parse as JSON
|
||||||
try:
|
# try:
|
||||||
final_answer = json.loads(json_text)
|
# final_answer = json.loads(json_text)
|
||||||
except json.JSONDecodeError:
|
# except json.JSONDecodeError:
|
||||||
# Not valid JSON, treat as regular text
|
# # Not valid JSON, treat as regular text
|
||||||
final_answer = json_text
|
# final_answer = json_text
|
||||||
|
final_answer = json_text
|
||||||
else:
|
else:
|
||||||
# Regular text answer
|
# Regular text answer
|
||||||
while i < len(lines):
|
while i < len(lines):
|
||||||
|
|
@ -263,6 +264,9 @@ class AgentManager:
|
||||||
|
|
||||||
if isinstance(resp, str):
|
if isinstance(resp, str):
|
||||||
resp = resp.strip()
|
resp = resp.strip()
|
||||||
|
else:
|
||||||
|
resp = str(resp)
|
||||||
|
resp = resp.strip()
|
||||||
|
|
||||||
logger.info(f"resp: {resp}")
|
logger.info(f"resp: {resp}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@ import json
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import functools
|
import functools
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
from ... base import AgentService, TextCompletionClientSpec, PromptClientSpec
|
from ... base import AgentService, TextCompletionClientSpec, PromptClientSpec
|
||||||
from ... base import GraphRagClientSpec, ToolClientSpec
|
from ... base import GraphRagClientSpec, ToolClientSpec
|
||||||
|
|
@ -297,6 +301,5 @@ class Processor(AgentService):
|
||||||
)
|
)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
||||||
Processor.launch(default_ident, __doc__)
|
Processor.launch(default_ident, __doc__)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue