Files
2026-06-02 06:14:15 +00:00

36 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LLM Interactive ChooseYourOwnAdventure Game
This repository contains a minimal example of a **humanintheloop** interactive story powered by LangGraph and OpenAI. The game works as follows:
1. The user supplies a *theme*.
2. The LLM generates a short opening scene and three numbered options.
3. The graph pauses (`interrupt`) and the user selects an option via a console menu.
4. The LLM receives the choice and writes a short ending.
The implementation demonstrates:
- State management with `TypedDict`.
- Interrupts and resuming with `langgraph`.
- Simple parsing of LLM output.
- Console interaction using `questionary`.
## Requirements
```bash
pip install -r requirements.txt
```
You must have an OpenAI API key available in the environment variable `OPENAI_API_KEY`.
## Running the Game
```bash
python game.py
```
You will be prompted for a theme. After the LLM generates the scene, you will see a menu of three options. Pick one and the story will continue to an ending.
## Files
- `game.py` Main application.
- `requirements.txt` Python dependencies.
- `README.md` This documentation.