mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-22 03:31:02 +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
|
||||
|
||||
# Try to parse as JSON
|
||||
try:
|
||||
final_answer = json.loads(json_text)
|
||||
except json.JSONDecodeError:
|
||||
# Not valid JSON, treat as regular text
|
||||
final_answer = json_text
|
||||
# try:
|
||||
# final_answer = json.loads(json_text)
|
||||
# except json.JSONDecodeError:
|
||||
# # Not valid JSON, treat as regular text
|
||||
# final_answer = json_text
|
||||
final_answer = json_text
|
||||
else:
|
||||
# Regular text answer
|
||||
while i < len(lines):
|
||||
|
|
@ -263,6 +264,9 @@ class AgentManager:
|
|||
|
||||
if isinstance(resp, str):
|
||||
resp = resp.strip()
|
||||
else:
|
||||
resp = str(resp)
|
||||
resp = resp.strip()
|
||||
|
||||
logger.info(f"resp: {resp}")
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import json
|
|||
import re
|
||||
import sys
|
||||
import functools
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from ... base import AgentService, TextCompletionClientSpec, PromptClientSpec
|
||||
from ... base import GraphRagClientSpec, ToolClientSpec
|
||||
|
|
@ -297,6 +301,5 @@ class Processor(AgentService):
|
|||
)
|
||||
|
||||
def run():
|
||||
|
||||
Processor.launch(default_ident, __doc__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue