Skip to content

Commit

Permalink
docs: simplification of two agent d&d simulation (langchain-ai#3550)
Browse files Browse the repository at this point in the history
Simplifies the [Two Agent
D&D](https://python.langchain.com/en/latest/use_cases/agent_simulations/two_player_dnd.html)
example with a cleaner, simpler interface that is extensible for
multiple agents.

`DialogueAgent`:
- `send()`: applies the chatmodel to the message history and returns the
message string
- `receive(name, message)`: adds the `message` spoken by `name` to
message history

The `DialogueSimulator` class takes a list of agents. At each step, it
performs the following:
1. Select the next speaker
2. Calls the next speaker to send a message 
3. Broadcasts the message to all other agents
4. Update the step counter.
The selection of the next speaker can be implemented as any function,
but in this case we simply loop through the agents.
  • Loading branch information
mbchang authored and yanghua committed May 9, 2023
1 parent 75bc849 commit c539de3
Showing 1 changed file with 137 additions and 319 deletions.

0 comments on commit c539de3

Please sign in to comment.