Skip to content

Build and run agents you can see, understand and trust.

fix(docs): fix the bug in building tutorial (#937)

DavdGaofa85f38a53e4
diff --git a/docs/tutorial/en/src/task_rag.py b/docs/tutorial/en/src/task_rag.py
index 9d32ecc39..9c61c4117 100644
--- a/docs/tutorial/en/src/task_rag.py
+++ b/docs/tutorial/en/src/task_rag.py
@@ -326,6 +326,10 @@ async def example_generic_manner() -> None:
),
)
+ print("Take a look at the agent's memory:")
+ content = (await agent.memory.get_memory())[1].content
+ print(json.dumps(content, indent=2, ensure_ascii=False))
+
asyncio.run(example_generic_manner())
@@ -408,7 +412,7 @@ async def example_multimodal_rag() -> None:
# Let's see the last message from the agent
print("\nThe image is attached in the agent's memory:")
- print((await agent.memory.get_memory())[-4])
+ print((await agent.memory.get_memory())[1])
asyncio.run(example_multimodal_rag())
diff --git a/docs/tutorial/zh_CN/src/task_rag.py b/docs/tutorial/zh_CN/src/task_rag.py
index 6ab667b40..8df617d67 100644
--- a/docs/tutorial/zh_CN/src/task_rag.py
+++ b/docs/tutorial/zh_CN/src/task_rag.py
@@ -313,7 +313,7 @@ async def example_generic_manner() -> None:
)
print("\n查看智能体记忆中检索信息如何插入:")
- content = (await agent.memory.get_memory())[-4].content
+ content = (await agent.memory.get_memory())[1].content
print(json.dumps(content, indent=2, ensure_ascii=False))
@@ -390,7 +390,7 @@ async def example_multimodal_rag() -> None:
# 让我们看看检索到的图片数据是否已经加入了智能体的记忆中
print("\n查看智能体记忆中检索信息如何插入:")
- content = (await agent.memory.get_memory())[-4].content
+ content = (await agent.memory.get_memory())[1].content
print(json.dumps(content, indent=2, ensure_ascii=False))
diff --git a/src/agentscope/_version.py b/src/agentscope/_version.py
index 94590277e..6d54c24c7 100644
--- a/src/agentscope/_version.py
+++ b/src/agentscope/_version.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""The version of agentscope."""
-__version__ = "1.0.7"
+__version__ = "1.0.8dev"
diff --git a/src/agentscope/hooks/_studio_hooks.py b/src/agentscope/hooks/_studio_hooks.py
index 28f6dfcf3..7d17ae1b8 100644
--- a/src/agentscope/hooks/_studio_hooks.py
+++ b/src/agentscope/hooks/_studio_hooks.py
@@ -5,7 +5,7 @@ from typing import Any
import requests
import shortuuid
-from ..agent import AgentBase
+from ..agent import AgentBase, UserAgent
def as_studio_forward_message_pre_print_hook(
@@ -32,8 +32,10 @@ def as_studio_forward_message_pre_print_hook(
json={
"runId": run_id,
"replyId": reply_id,
- "name": reply_id,
- "role": "assistant",
+ "name": getattr(self, "name", msg.name),
+ "role": "user"
+ if isinstance(self, UserAgent)
+ else "assistant",
"msg": message_data,
},
)