oTree Forum >

Python package to use LLMs as oTree participants

#1 by JoachimGassen

Hi all:

We, Victor Maas from the University of Amsterdam, and Fikir Edossa as well as Joachim Gassen from Humboldt-Universität zu Berlin and the Open Science Data Center of TRR 266 Accounting for Transparency are releasing ‘botex’, a Python package that should make it (relatively) straight-forward to use Chat GPT and even local LLM models as participants in #oTree experiments.

With this in-development package, you can use any experiment that (solely) builds on oTree’s standard features and run a session with any mix of human and AI participants. The AI participants will scrape their assigned participant pages, infer the experimental tasks from the webpage content and provide responses just like human participants that will be stored by oTree. In addition, the LLMs will provide rationales for every answer. These data, along with the full prompting history, allow you to assess the ‘thought process’ that underlies the LLM responses and, besides being informative about LLM ‘behavior‘ can hopefully helpful to test and develop your experimental designs.

Curious? Then we have a few links for you:

- If you want to try how it ‘feels’ to participate in an experiment along with an LLM, you can participate here (https://exp.trr266.de/test/mftrust/) in a live experiment. You will be paired with an LLM. And you can even win a prize! The points that you earn during the experiment will determine your chances to (anonymously) win a 100 € Amazon Voucher.

- If you want to understand how the sausage is being made, check out this GitHub Repo (https://github.com/trr266/botex_examples). It takes you behind the scenes of the above experiment to explain step-by-step how to use botex for your own oTree experiments.

- The repo for the botex package itself is https://github.com/joachim-gassen/botex.

Needless to say, we are very curious to hear what you say. So, please feel free to reach out and share your views.

Thank you to the whole oTree community for making oTree such a wonderful piece of software,

Joachim (and Fikir and Victor)

#2 by Chris_oTree

Nice!

#3 by Chris_oTree

I just took a look at the code... very good to see that you implemented it using oTree's official public APIs. Definitely makes it look stable and professionally developed.

#4 by JoachimGassen

Thanks! The API is super helpful. BTW: If you plan to extend it we would have a thing to add to the wishlist: It would be nice if one could trigger a data export (like by the web frontend) by a call. I see that in many setups people could simply query the database directly but this is yet another configuration that people need to set up.

#5 by Victor

Hi Joachim, it works great. I was a bit clunky dealing with the virtual environment variables and running the Python scripts, but I had no real issues.

Write a reply

Set forum username