No project description provided
Project description
箱庭 (Hakoniwa)
"Hakoniwa" which is a miniature garden in Japanese is a simulation framework letting LLM based entities play around inside. This framework aims to provide the way to experiment how the LLM behaves in the specific domain defined as a simple state machine which has states and actions respectively. The framework is designed to be able to be used for the following purposes:
- To experiment how the LLM behaves in the specific enviroment.
- To collect the behavior data resembling the human behavior in the real world.
Usage
Define the state machine
First of all, we can define the state machine where each agent play around inside. The state machine is defined as a YAML file. The following is the example of the state machine definition.
states:
state0:
name: In the house
choices:
- action: Go outside
next: state1
- action: Stay inside
next: state0
state1:
name: Outside
choices:
- action: Go to the supermarket
next: state2
- action: Go back home
next: state0
state2:
name: In the supermarket
choices:
- action: Go back home
next: state0
entities:
- name: A living thing
type: openai
initial_state: state0
The state machine consists of the following two parts.
states
: The list of states in the state machine.choices
is the list of actions which the agent can take from the state.entities
: The list of entities which play around inside the state machine.
The CLI script, hakoniwa
is usable to run the simulation with the state machine definition.
$ poetry run hakoniwa -f env.yaml
Please make sure to set the OPENAI_APIKEY
if you set the OpenAI entity in the environment.
You will see what it does in the environment.
INFO:hakoniwa.environment:A living thing,{'action': 'Stay inside', 'next': 'state0'}
INFO:hakoniwa.environment:A living thing,{'action': 'Go outside', 'next': 'state1'}
INFO:hakoniwa.environment:A living thing,{'action': 'Go to the supermarket', 'next': 'state2'}
Dependencies
Install Poetry and run the following command to install dependencies.
$ poetry install
Development
We can run the unit test with pytest.
$ make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hakoniwa-0.1.2.tar.gz
.
File metadata
- Download URL: hakoniwa-0.1.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.13 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e46e4a4d0d5ca55fc17d98eb1582d828d7299080224a29de56fd9c3be46b26e |
|
MD5 | 5bbd86f8eb348585a57992c02cd960aa |
|
BLAKE2b-256 | 1030b4fc3acf3c64f1a0e4f7bc4e35f36b2ccfd582b21f939b15842144d92efe |
File details
Details for the file hakoniwa-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: hakoniwa-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.13 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc5603f49840cef9a2bb88413cef472bd1aff5a8c0f259aa645264713868113c |
|
MD5 | 081a25c9301c929c50f0e7d69e946d21 |
|
BLAKE2b-256 | c52d02ec4b8325e5cae78cc907dcc3adc3720f7c52fe37d4e9d108459374be6d |