You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.
Describe the bug
使用LLM进行语句标注时,如果采用XML标签,则会引起日志报错。
To Reproduce
Steps to reproduce the behavior:
-- coding: utf-8 --
"""A simple example for conversation between user and assistant agent."""
import agentscope
from agentscope.agents import DialogAgent
from agentscope.agents.user_agent import UserAgent
from agentscope.pipelines.functional import sequentialpipeline
from agentscope.message import Msg
from prompt import Prompts
import json
survivors = agentscope.init(
model_configs="./configs/model_configs.json",
agent_configs="./configs/agent_configs.json",
)
with open("./configs/basic_tags.json", "r", encoding='utf-8') as f:
json_data = json.load(f)
tags_json_str = json.dumps(json_data['tags'])
require_str = json_data['require']
# Init use agents
user_agent = UserAgent()
# start the conversation between user and assistant
x = None
while x is None or x.content != "exit":
x = user_agent()
x = Prompts.annotate_task.format_map(
{
"tags": tags_json_str,
"require": require_str,
"info": x.content,
}
)
x = Msg("annotator", x, role="user")
x = survivors[0](x)
print(x.content)
AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.
Describe the bug
使用LLM进行语句标注时,如果采用XML标签,则会引起日志报错。
To Reproduce
Steps to reproduce the behavior:
-- coding: utf-8 --
"""A simple example for conversation between user and assistant agent."""
import agentscope
from agentscope.agents import DialogAgent
from agentscope.agents.user_agent import UserAgent
from agentscope.pipelines.functional import sequentialpipeline
from agentscope.message import Msg
from prompt import Prompts
import json
def main() -> None:
"""A basic conversation demo"""
if name == "main":
main()
Expected behavior
对以下内容进行标注:
患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于*****医院,诊断“双肾结石”,具体治疗不详。2月余前因“反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行
左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水,左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5gq8hivgtt经验性抗感染及止血、补液等支持治疗。1 月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予以亚胺培南西司他丁针0.5g静脉滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗,血糖控制欠佳。
Error messages
Detailed error messages.
Environment (please complete the following information):
2024-05-28 13:43:05.489 | INFO | agentscope.utils.monitor:register:417 - Register metric [gpt-4o.total_tokens] to SqliteMonitor with unit [token] and quota [None]
User input: 患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于医院,诊断“双肾结石”,具体治疗不详。2月余前因“反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水,左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5gq8hivgtt经验性抗感染及止血、补液等支持治
疗。1月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导
下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予以亚胺培南西司他丁针0.5g静脉滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗,血糖控制欠佳。
User: 患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于医院,诊断“双肾结石”,具体治疗不详。2月余前因“反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行
左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水,左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5gq8hivgtt经验性抗感染及止血、补液等支持治疗。1 月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予以亚胺培南西司他丁针0.5g静脉滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗,血糖控制欠佳。
--- Logging error in Loguru Handler #1 ---
Record was: {'elapsed': datetime.timedelta(seconds=35, microseconds=484413), 'exception': None, 'extra': {}, 'file': (name='logging_utils.py', path='C:\Users\pc\Documents\workspace\agentscope\src\agentscope\utils\logging_utils.py'), 'function': '_chat', 'level': (name='CHAT_LOG', no=21, icon=' '), 'line': 117, 'message': 'Annotator: 患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于*****医院,诊断“双肾结石”,具体治疗不详。2月余前因“反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水, 左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5g q8h ivgtt经验性抗感染及止血、补液等支持治疗。1月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患 者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予亚胺培南西司他丁针0.5g静脉 滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗,血糖控制欠佳。', 'module': 'logging_utils', 'name': 'agentscope.utils.logging_utils', 'process': (id=13680, name='MainProcess'), 'thread': (id=21564, name='MainThread'), 'time': datetime(2024, 5, 28, 13, 43, 35, 656450, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '中国标准时间'))}
Traceback (most recent call last):
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_handler.py", line 135, in emit
_, precomputed_format = self.memoize_dynamic_format(dynamic_format, ansi_level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_handler.py", line 12, in prepare_colored_format
colored = Colorizer.prepare_format(format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_colorizer.py", line 358, in prepare_format
tokens, messages_color_tokens = Colorizer._parse_without_formatting(string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_colorizer.py", line 450, in _parse_without_formatting
parser.feed(literal_text, raw=recursive)
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_colorizer.py", line 253, in feed
raise ValueError(
ValueError: Tag "" does not correspond to any known ansi directive, make sure you did not misspelled it (or prepend '' to escape it)
--- End of logging error ---
--- Logging error in Loguru Handler #2 ---
Record was: {'elapsed': datetime.timedelta(seconds=35, microseconds=484413), 'exception': None, 'extra': {}, 'file': (name='logging_utils.py', path='C:\Users\pc\Documents\workspace\agentscope\src\agentscope\utils\logging_utils.py'), 'function': '_chat', 'level': (name='CHAT_LOG', no=21, icon=' '), 'line': 117, 'message': 'Annotator: 患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于*****医院,诊断“双肾结石”,具体治疗不详。2月余前因“反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水, 左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5g q8h ivgtt经验性抗感染及止血、补液等支持治疗。1月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患 者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予亚胺培南西司他丁针0.5g静脉 滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗,血糖控制欠佳。', 'module': 'logging_utils', 'name': 'agentscope.utils.logging_utils', 'process': (id=13680, name='MainProcess'), 'thread': (id=21564, name='MainThread'), 'time': datetime(2024, 5, 28, 13, 43, 35, 656450, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '中国标准时间'))}
Traceback (most recent call last):
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_handler.py", line 131, in emit
precomputed_format = self.memoize_dynamic_format(dynamic_format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_handler.py", line 17, in prepare_stripped_format
colored = Colorizer.prepare_format(format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_colorizer.py", line 358, in prepare_format
parser.feed(literal_text, raw=recursive)
File "C:\Users\pc\AppData\Roaming\Python\Python312\site-packages\loguru_colorizer.py", line 253, in feed
raise ValueError(
ValueError: Tag "" does not correspond to any known ansi directive, make sure you did not misspelled it (or prepend '' to escape it)
--- End of logging error ---
患者10月余前因“双肾结石8月余,左肾造瘘术后25天”就诊于*****医院,诊断“双肾结石”,具体治疗不详。2月余前因“ 反复畏寒发热、腰痛1个半月”入住我院,于2015-05-25行左肾穿刺造瘘术+右输尿管dj管置入术,术中见:左肾重度积水,左肾萎缩,置管后引出脓性尿液。术后予以哌拉西林他唑巴坦4.5g q8h ivgtt经验性抗感染及止血、补液等支持治疗。1月余前再次入院,并于2015-06-17行左输尿管镜取石术,术后予抗感染及止血、补液等支持治疗。2周余前,患者因“右腰胀痛伴发热1周余”入住我院,并于2015-07-15行b超引导下右肾肾穿刺造瘘术,术中见右肾结石,穿刺后见浑浊尿液流出,导丝引导下放置8f造瘘管一根。术后予亚胺培南西司他丁针0.5g静脉滴注q8h抗感染及止血补液等对症治疗。患者术后恢复可,2周 内右腰部胀痛,无畏寒发热,无恶心呕吐等不适,今来我院继续治疗,拟“肾结石”收住入院。自病以来,神清,精神可,胃纳差,睡眠一般,小便由引流管引出,稍有便秘,体重10月内降低10斤。自诉发现糖尿病1年,注射胰岛素治疗半年后饮食治疗 ,血糖控制欠佳。
The text was updated successfully, but these errors were encountered: