|
| 1 | +# project-polybius |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +project-polybius is a text based game that uses Large Language Models to generate new experiences for the player. |
| 6 | +This repo provides the code to deploy it on cloud and a client to interact with the deployed system. |
| 7 | + |
| 8 | + |
| 9 | +## Instructions |
| 10 | + |
| 11 | +### Running the services |
| 12 | +I have tested this code on google cloud platform's kubernetes engine (GKE) because it uses GCP's Vertex AI APIs for text generation, but technically it can run on any cloud or locally provided that an appropriate `generate_text()` function (imported in `llm-handler.py`) is implemented in its corresponding api_helper file. |
| 13 | + |
| 14 | +After starting a kubernetes cluster, clone the repo: |
| 15 | +``` |
| 16 | +git clone https://github.com/nikhilbarhate99/project-polybius.git |
| 17 | +cd project-polybius |
| 18 | +``` |
| 19 | +Install minio on kubernetes cluster using helm (make sure helm is installed before) |
| 20 | +``` |
| 21 | +helm repo add bitnami https://charts.bitnami.com/bitnami |
| 22 | +helm install -f ./minio/minio-config.yaml -n minio-ns --create-namespace minio-proj bitnami/minio |
| 23 | +``` |
| 24 | +Deploy the system on the cluster, this will start running all the pods, services, deployments required for the game. |
| 25 | +``` |
| 26 | +./deploy-cloud.sh |
| 27 | +``` |
| 28 | +Run the following command to expose the rest service using: |
| 29 | +``` |
| 30 | +kubectl apply -f expose-rest.yaml |
| 31 | +``` |
| 32 | +After a while, the kubernetes cluster will assign an external IP to the `expose-rest-svc` service. |
| 33 | +You can check this by running: |
| 34 | +``` |
| 35 | +kubectl get all |
| 36 | +``` |
| 37 | +**Important:** Now copy that external IP to the `REST_HOST` variable in the `global_variables.py` file. |
| 38 | +This allows the client to find the rest service. |
| 39 | + |
| 40 | +### Running the client |
| 41 | +finally, once all the servcies are running on the cluster, we can install all the requirements in a virtual env and use the client to play the game: |
| 42 | +``` |
| 43 | +python3 -m venv ./venv |
| 44 | +source venv/bin/activate |
| 45 | +pip3 install -r requirements.txt |
| 46 | +python3 polybius_client.py |
| 47 | +``` |
| 48 | +As long as the cluster is running, multiple clients can play the game and their games will be saved in the Database. |
| 49 | + |
| 50 | +**Note:** To play the game (on client side) four files are required which can be zipped an distributed to users: `polybius_client.py`, `global_variables.py`, `utils.py`, `requirements.txt` |
| 51 | + |
| 52 | +## System |
| 53 | + |
| 54 | +The current architecture is simple as illustrated in the figure |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +## Examples |
| 59 | + |
| 60 | +|  |  | |
| 61 | +| :---:|:---: | |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +## To Do |
| 66 | + |
| 67 | +- [ ] Add Authentication |
| 68 | +- [ ] Better error handling for REST Success/Failures |
| 69 | +- [ ] Change to a JSON DB |
| 70 | +- [ ] Fix UI issues |
| 71 | +- [ ] Use logs service |
| 72 | +- [ ] Add support for different settings/genre for game stories |
| 73 | +- [ ] Implement `generate_text()` function for other LLM APIs e.g. Gemini, GPT4 etc. |
| 74 | + |
0 commit comments