Files
Open-Assistant/backend
Andreas Köpf 14fa08e2e7 Message tree state machine (#555)
* add query_incomplete_rankings()

* Add SQL queries for TreeManager task selection

* first working version of TreeManager.next_task()

* remove old generate_task(), add mandatory_labels to text_labels task

* Add ConversationMessage list to Ranking tasks

* add more sophisticated sql queries to find extendible trees

* add TreeManager.query_extendible_parents()

* fix task validation, seed data insertion (reviewed)

* provide user for task selection in text-frontend

* enter 'growing' state

* enter 'aborted_low_grade' state

* enter 'ranking' state

* check tree 'growing' state upon relpy insertion

* exclude user from labeling their own messages (added DEBUG_ALLOW_SELF_LABELING setting)

* add DEBUG_ALLOW_SELF_LABELING to docker-compose.yaml

* fix ranking submission

* add query_tree_ranking_results()

* add ranked_message_ids to RankingReactionPayload

* fix reply_messages instead of prompt_messages

* incorment 'ranking_count' of ranked replies

* added logic to check_condition_for_scoring_state

* changes to msg_tree_state_machine

* pre-commit changes

* enter 'ready_for_scoring' state

* re-add HF embedding call (lost during merge)

* use prepare_conversation() helper for seed-data creation

* Partially add user specified task selection

Co-authored-by: Daniel Hug <danielpatrickhug@gmail.com>
2023-01-11 10:54:03 +01:00
..
2023-01-11 10:54:03 +01:00
2023-01-05 16:18:04 +01:00
2022-12-19 18:00:09 +01:00
2023-01-11 10:54:03 +01:00

Open-Assistant REST Backend

Backend Development Setup

In root directory, run docker compose up backend-dev --build --attach-dependencies to start a database. The default settings are already configured to connect to the database at localhost:5432.

Python 3.10 is required. It is recommended to use pyenv which will recognise the .python-version in the project root directory.

Make sure you have all requirements installed. You can do this by running pip install -r requirements.txt inside the backend folder and pip install -e . inside the oasst-shared folder. Then, run the backend using the run-local.sh script inside the scripts folder. This will start the backend server at http://localhost:8080.

REST Server Configuration

Please either use environment variables or create a .env file in the backend root directory (in which this readme file is located) to specify the DATABASE_URI.

Example contents of a .env file for the backend:

DATABASE_URI="postgresql://<username>:<password>@<host>/<database_name>"
BACKEND_CORS_ORIGINS=["http://localhost", "http://localhost:4200", "http://localhost:3000", "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000", "https://localhost:8080", "http://dev.oasst.laion.ai", "https://stag.oasst.laion.ai", "https://oasst.laion.ai"]
REDIS_HOST=localhost
REDIS_PORT=6379

Running the REST Server locally for development

Have a look into the main README.md file for more information on how to set up the backend for development. Use the scripts within the scripts/backend-development folder to run the BE API locally.

Alembic

To create an Alembic database migration script after sql-models were modified run alembic revision --autogenerate -m "..." ("..." is what you did) in the /backend directory. Then edit the newly created file. See here for more information.