Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment bazel #1

Merged
merged 36 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e6f7dc3
fix cls info
pan-x-c Oct 15, 2024
55fee34
Merge branch 'feature/pxc/env' of https://github.com/pan-x-c/AgentSco…
chenyushuo Oct 15, 2024
fd8c03a
[HOTFIX] Fix typos in the system prompt of router example. (#436)
yizhangliu Oct 15, 2024
6a5e0c3
Add README_JA.md in Japanese. (#455)
eltociear Oct 15, 2024
ce2024e
add bazel
chenyushuo Oct 15, 2024
c18d5ea
fix bazel
chenyushuo Oct 15, 2024
b6ff409
code format fix
chenyushuo Oct 15, 2024
4133037
fix
chenyushuo Oct 16, 2024
07631e3
fix
chenyushuo Oct 16, 2024
26fefc6
fix
chenyushuo Oct 16, 2024
6bf0fb5
fix chatroom example
pan-x-c Oct 16, 2024
d9f8143
fix
pan-x-c Oct 16, 2024
eb2bfc7
add persona config
pan-x-c Oct 16, 2024
9711248
[HOTFIX] Fix the bug in zhipu api with streaming text (#461)
pan-x-c Oct 17, 2024
c23fdf4
fix in chatroom
chenyushuo Oct 17, 2024
fcd7d57
merge
chenyushuo Oct 17, 2024
f5238cb
update in chatroom
chenyushuo Oct 17, 2024
a2f467c
opt retry info
pan-x-c Oct 18, 2024
2dfe7cf
update (#467)
rayrayraykk Oct 21, 2024
1c26592
minor fix on embedding related content (#463)
ZiTao-Li Oct 21, 2024
d29a4ac
quick fix on chatroom
chenyushuo Oct 22, 2024
3a805e9
fix comments
pan-x-c Oct 23, 2024
e2fda5d
fix comments
pan-x-c Oct 23, 2024
c9a07ce
fix comments
pan-x-c Oct 23, 2024
f7b84a3
Merge branch 'main' into feature/pxc/env
pan-x-c Oct 23, 2024
fc98f32
add notes
pan-x-c Oct 23, 2024
a50e58c
fix in chatroom
chenyushuo Oct 23, 2024
4eb9940
fix in chatroom
chenyushuo Oct 23, 2024
7d59469
fix in chatroom
chenyushuo Oct 23, 2024
c6684b1
bug fix in leave chatroom
chenyushuo Oct 23, 2024
dfa5606
bug fix in intro
chenyushuo Oct 23, 2024
84c44de
precommit fix
chenyushuo Oct 23, 2024
b11fa41
Merge pull request #10 from chenyushuo/new_env
pan-x-c Oct 23, 2024
872ffb6
update docs
pan-x-c Oct 23, 2024
630908a
merge
chenyushuo Oct 24, 2024
4091109
code format
chenyushuo Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
run: |
pip install -q -e .[full]
pip install coverage
- name: CPP gRPC Server Tests
if: ${{ matrix.os != 'windows-latest' }}
run: |
redis-server &> redis.log &
AGENTSCOPE_ENABLE_PY_LOGGER=True AGENTSCOPE_USE_CPP_SERVER=YES AGENTSCOPE_NUM_WORKERS=5 python -m unittest tests/rpc_agent_test.py
- name: Run tests with coverage
run: |
coverage run tests/run.py
- name: Generate coverage report
run: |
coverage report -m
- name: CPP gRPC Server Tests
if: ${{ matrix.os != 'windows-latest' }}
run: |
redis-server &> redis.log &
AGENTSCOPE_ENABLE_PY_LOGGER=True AGENTSCOPE_USE_CPP_SERVER=YES AGENTSCOPE_NUM_WORKERS=5 python -m unittest tests/rpc_agent_test.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
English | [**中文**](https://github.com/modelscope/agentscope/blob/main/README_ZH.md)
English | [**中文**](https://github.com/modelscope/agentscope/blob/main/README_ZH.md) | [**日本語**](https://github.com/modelscope/agentscope/blob/main/README_JA.md)

# AgentScope

Expand Down
396 changes: 396 additions & 0 deletions README_JA.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[English](https://github.com/modelscope/agentscope/blob/main/README.md) | 中文
[English](https://github.com/modelscope/agentscope/blob/main/README.md) | 中文 | [日本語](https://github.com/modelscope/agentscope/blob/main/README_JA.md)

# AgentScope

Expand Down
75 changes: 75 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# http_archive(
# name = "build_bazel_rules_swift",
# urls = ["https://github.com/bazelbuild/rules_swift/archive/refs/tags/2.1.1.zip"],
# strip_prefix = "rules_swift-2.1.1",
# )

# 引入 gRPC
http_archive(
name = "com_github_grpc_grpc",
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v1.66.0.zip"], # 替换为最新版本
strip_prefix = "grpc-1.66.0",
)

# 引入 Protocol Buffers
http_archive(
name = "com_google_protobuf",
urls = ["https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.zip"], # 替换为最新版本
strip_prefix = "protobuf-28.2",
)

# http_archive(
# name = "rules_swift",
# urls = ["https://github.com/bazelbuild/rules_swift/archive/refs/tags/2.1.1.zip"],
# strip_prefix = "rules_swift-2.1.1",
# )
# load("@rules_swift//swift:defs.bzl", "swift_repositories")
# swift_repositories()

# 引入 gRPC 相关的构建设定
# load("@grpc//:build_defs.bzl", "grpc_repositories")
# grpc_repositories()

http_archive(
name = "rules_python_internal",
urls = ["https://github.com/bazelbuild/rules_python/archive/refs/tags/0.36.0.zip"],
strip_prefix = "rules_python-0.36.0",
)
load("@rules_python_internal//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
name = "python3_12",
python_version = "3.12",
)

# load("@python3_12//:defs.bzl", "interpreter")

# load("@rules_python//python:pip.bzl", "pip_parse")

# pip_parse(
# python_interpreter_target = interpreter,
# )


http_archive(
name = "pybind11_bazel",
urls = ["https://github.com/pybind/pybind11_bazel/archive/refs/tags/v2.12.0.zip"],
strip_prefix = "pybind11_bazel-2.12.0",
)
http_archive(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11-BUILD.bazel",
urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip"], # 适配你的版本
strip_prefix = "pybind11-2.13.6",
)
# load("@pybind11_bazel//:python_configure.bzl", "python_configure")
# load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")


load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
# load("@com_google_protobuf//:protobuf.bzl", "protobuf_repositories")
# protobuf_repositories()
1 change: 1 addition & 0 deletions docs/sphinx_doc/zh_CN/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ AgentScope 文档
agentscope.service
agentscope.rpc
agentscope.server
agentscope.environment
agentscope.web
agentscope.prompt
agentscope.utils
2 changes: 1 addition & 1 deletion docs/sphinx_doc/zh_CN/source/tutorial/206-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AgentScope内置策略的目标是**使初学者能够顺利调用模型API ,

## 构建提示面临的挑战

在多智能体应用中,LLM通常在对话中扮演不同的角色。当使用模型的Chat API时,时长会面临以下挑战
在多智能体应用中,LLM通常在对话中扮演不同的角色。当使用模型的Chat API时,时常会面临以下挑战

1. 大多数Chat类型的模型API是为聊天机器人场景设计的,`role`字段只支持`"user"``"assistant"`,不支持`name`字段,即API本身不支持角色扮演。

Expand Down
1 change: 0 additions & 1 deletion examples/distributed_simulation/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time
import re
from typing import Optional, Union, Sequence
import concurrent.futures

from loguru import logger

Expand Down
42 changes: 9 additions & 33 deletions examples/environments/chatroom/chatroom_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,57 +59,33 @@ def main(args: argparse.Namespace) -> None:
),
role="system",
)
r = ChatRoom(name="chat", announcement=ann, to_dist=args.use_dist)
r = ChatRoom(
name="chat",
announcement=ann,
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)

# Setup the persona of Alice, Bob and Carol
alice = ChatRoomAgent( # Game Art Designer
name="Alice",
sys_prompt=r"""You are a game art designer named Alice. """
r"""Programmer Bob and game planner Carol are your colleagues, """
r"""and you need to collaborate with them to complete an open """
r"""world game. Please ask appropriate question to planner or """
r"""generate appropriate responses in this work group based on """
r"""the following chat history. When you need to mention someone, """
r"""you can use @ to remind them. You only need to output Alice's """
r"""possible replies, without giving anyone else's replies or """
r"""continuing the conversation. When the discussion is complete, """
r"""you need to reply with a message containing 'Goodbye' to """
r"""indicate exiting the conversation.""",
sys_prompt=r"""You are a game art designer named Alice.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
alice.join(r)

bob = ChatRoomAgent( # Game Programmer
name="Bob",
sys_prompt=r"""You are a game programmer named Bob. """
r"""Art designer Alice and game planner Carol are your colleagues, """
r"""and you need to collaborate with them to complete an open """
r"""world game. Please ask appropriate questions or generate """
r"""appropriate responses in the work group based on the following """
r"""historical records. When you need to mention someone, you can """
r"""use @ to remind them. You only need to output Bob's possible """
r"""replies, without giving anyone else's replies or continuing """
r"""the conversation. When the discussion is complete, you need """
r"""to reply with a message containing 'Goodbye' to indicate """
r"""exiting the conversation.""",
sys_prompt=r"""You are a game programmer named Bob.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
bob.join(r)

carol = ChatRoomAgent( # Game Designer
name="Carol",
sys_prompt=r"""You are a game planner named Carol. """
r"""Programmer Bob and art designer Alice are your colleagues, """
r"""and you need to guide them in developing an open world game. """
r"""Please generate a suitable response in this work group based """
r"""on the following chat history. When you need to mention """
r"""someone, you can use @ to remind them. You only need to output """
r"""Carol's possible replies, without giving anyone else's replies """
r"""or continuing the conversation. When the discussion is """
r"""complete, you need to reply with a message containing """
r"""'Goodbye' to indicate exiting the conversation.""",
sys_prompt=r"""You are a game planner named Carol.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
Expand Down
25 changes: 14 additions & 11 deletions examples/environments/chatroom/chatroom_with_assistant_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def main(args: argparse.Namespace) -> None:

bob = ChatRoomAgentWithAssistant(
name="Bob",
sys_prompt=r"""You are Bob's chat room assistant and he is """
sys_prompt=r"""You are Bob's chat room assistant and Bob is """
r"""currently unable to reply to messages. Please generate a """
r"""suitable response based on the following chat history. """
r"""The content you reply to must be based on the chat history. """
r"""Please refuse to reply to questions that are beyond the scope """
r"""of the chat history.""",
r"""suitable response based on the following chat history without """
r"""reasoning. The content you reply to must be based on the chat """
r"""history. Please refuse to reply to questions that are beyond """
r"""the scope of the chat history.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
timeout=args.timeout,
Expand Down Expand Up @@ -176,18 +176,21 @@ def main(args: argparse.Namespace) -> None:
# Setup the persona of Carol
carol = ChatRoomAgent(
name="Carol",
sys_prompt=r"""You are Carol, and now you need to interview Bob. """
r"""Just ask him where he is from, which school he graduated from, """
r"""his profession, and his hobbies. At the end of the interview, """
r"""please output a reply containing Goodbye to indicate the end """
r"""of the conversation.""",
sys_prompt="""You are Carol, and now you need to interview Bob. """
"""Just ask him where he is from, which school he graduated from, """
"""his profession, and his hobbies. You'd better only ask one """
"""question at a time.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
carol.join(r)

# Start the chat
r.chatting(delay={carol.agent_id: 0, bob.agent_id: 5})
r.chat_freely(
delay=10,
interval=10,
max_round=10,
)


if __name__ == "__main__":
Expand Down
Loading
Loading