|
@@ -4,6 +4,8 @@ from pydantic import BaseModel,Field
|
|
|
import json
|
|
import json
|
|
|
from agent.core.config import get_config_path
|
|
from agent.core.config import get_config_path
|
|
|
from agent.logger import logger
|
|
from agent.logger import logger
|
|
|
|
|
+import uuid
|
|
|
|
|
+from datetime import datetime
|
|
|
|
|
|
|
|
config = get_config_path()
|
|
config = get_config_path()
|
|
|
TOP_K = config['app']['top_k']
|
|
TOP_K = config['app']['top_k']
|
|
@@ -85,14 +87,17 @@ async def reflect_check(context: str, labels: list):
|
|
|
3.不以企业整体行业属性替代对贷款具体内容的判断
|
|
3.不以企业整体行业属性替代对贷款具体内容的判断
|
|
|
4.所有判断应服务于产业打标的可用性与可解释性
|
|
4.所有判断应服务于产业打标的可用性与可解释性
|
|
|
"""
|
|
"""
|
|
|
|
|
+ uid = uuid.uuid4().hex
|
|
|
|
|
+ l1 = datetime.now().isoformat()
|
|
|
|
|
+ logger.info(f"Starting reflection check with uuid {uid}. timestamp: {l1}")
|
|
|
response = await agent.ainvoke({
|
|
response = await agent.ainvoke({
|
|
|
"messages": [{"role":"system","content": prompt}]
|
|
"messages": [{"role":"system","content": prompt}]
|
|
|
},context = {})
|
|
},context = {})
|
|
|
result = response["structured_response"]
|
|
result = response["structured_response"]
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
result = [r.dict() for r in result.labels]
|
|
result = [r.dict() for r in result.labels]
|
|
|
result = json.dumps(result, ensure_ascii=False)
|
|
result = json.dumps(result, ensure_ascii=False)
|
|
|
|
|
+ l2 = datetime.now().isoformat()
|
|
|
|
|
+ logger.info(f"Reflection check completed with uuid {uid}. timestamp: {l2}, consuming {(datetime.fromisoformat(l2) - datetime.fromisoformat(l1)).total_seconds()} seconds.")
|
|
|
logger.info(f"{context} LLM result: {result}")
|
|
logger.info(f"{context} LLM result: {result}")
|
|
|
|
|
|
|
|
return result
|
|
return result
|