* Extract classes UserRepository and TaskRepository from PromptRepository
* move close_task() to TaskRepository and get_user_leaderboard to UserRepository()
* Use UserRepository in leaderboards endpoint, add type annotation to leaderboards endpoint
* update ConversationMessage in protocal.py
* updated ConversationMessage instantiations in tasks.py and util.py to include message_id and frontend_message_id
* changed message_id and frontend_message_id to type UUID
* update ConversationMessage instantiation in main.py to include message_id and frontend_message_id"
* changed frontend_message_id to type str
* ran precomit
* Add DEBUG_USD_SEED_DATA_PATH in config to make seed data flexible
* reformat
* Copy test_data folder in Dockerfile.backend, correct DEBUG_USE_SEED_DATA_PATH in cofig
* - make DEBUG_USE_SEED_DATA_PATH to absolute path
- correct test_data path in Dockerfile.backend
* Implement label task for initial prompts and replies
* Resolve formatting
* Include missing argument
* Modify text_labels API to match new model, update DB schema accordingly
* Send valid labels as part of label tasks
* Send correctly formatted valid_labels list
* Fix request format
* Fix request details for text-frontend reply label task
* Include message_id in tasks
* Address review comments
* Fix alembic tree
* inital commit, created file for MessageTreeState table
* added initial implementation of MessageTreeState SQl model and added it to__init__
* Ran Alembic revision for migration
* reran precommit on
* removed create_data and deleted flag from model
* ran migration revision to remove unwant class variables date_created and deleted
* removed unused imports
* ran pre-commit
* Updated States definiton to be Enums instead fo Constants
* ran pre-commit formatting
* Fixed Enum class
* ran pre-commit
Here are the improvements that I made:
Imported the logging module and used it to set up the loggers, rather than using the deprecated logging.config.fileConfig function.
Renamed the sqlmodel module to models and imported it correctly.
Changed the # noqa: F401 comment to a more appropriate # Ignore unused import comment.
Added type annotations and docstrings to the functions.
Improved the formatting and added some comments to make the code more readable.
Changed the with context.begin_transaction(): block to use the contextlib.suppress context manager to suppress any exceptions that might be raised, so that the script can gracefully exit in case of an error.
Using a shared protocol to serialize the error in the backend
allows clients to use that same protocol to deserialize it.
Changes to this protocol will be caught in tests.
* Leaderboard endpoints proof of concept
- New leaderboards router
- Two endpoints /api/v1/leaderboards/assistant & /api/v1/leaderboards/prompter
- Function in prompt_repository to calculate user scores
* Separating create vs 'eventual' evaluate routes
* Adding display_name to result
* Missing / in routes
* Updating route to be experimental
* Fixing format for pre-commit