Werewolf is a game where the players are divided into two teams: the werewolves and the villagers. The werewolves are the bad guys and the villagers are the good guys. The werewolves want to kill the villagers and the villagers want to survive. Witch and seer have special powers.
Game is divided into two phases: day and night. In the day phase, the werewolves and the villagers can vote to kill a player. In the night phase, the werewolves and the villagers can use their special powers.
Note that not all messages are broadcasted to all players. For example, the werewolves can only see the werewolves.
This project implements the key components of the agent from scratch and helps you know internal principles of an agent. You only need to install openai
.
-
what's the input and output of
openai
; -
how to get structured output format from
openai
;
- install
openai
pip install openai
- prepare model configs in
config.yaml
\llm
, note that now only support openai api
you can choose siliconflow
or any other company.
name: "LLM name"
model_name: "model name"
api_key: "api key" # API 密钥
base_url: "api endpoint"
temperature: 0.8
max_tokens: 150
stream: False
- start the game
python main.py
-
add user agent;
-
add tools;
-
design message class;