Commit Graph
44 Commits
Author SHA1 Message Date
c6fbf5543b 599 add row versioning to backend tables (#710)
* fix: isolation level and nested db.commit() with retry wrappers on concurrent update errors

* refactor: incorporated review comments

changes decorator methods to managed_tx_method and async_managed_tx_method
new enum CommitMode
removed commented commit() from the previous commits

* fix: merge pre-commit errors

* fix: merge pre-commit changes

* fix: conflict in existing OasstErrorCode

* refactor: Added a refresh just to be sure that the select command is triggered on the mapped object

* fix: added refresh for async decorator

Co-authored-by: James Melvin <melvin@gameface.ai>
2023-01-16 08:43:07 +01:00
Andreas Köpf de28d67031 infer role from task in store_text_reply() 2023-01-16 00:19:30 +01:00
Andreas KöpfandGitHub b5bb5bb7c0 Add leaderboard stats, periodic updates via fastapi-utils (#724)
* add leaderboard stats, periodic update via fastapi-utils

* count label tasks for assistant and prompter replies

* Daily stats update every 15 mins, simplify leaderboard endpoint

* add indices for some created_date columns

* make user stats update intervals configurable

* make sure intervals are positive
2023-01-15 12:04:19 +01:00
a902c600fa Store Message Toxicity in database (#553)
* [NEW] MessageToxicity table

* [NEW] Alembic message Toxicity

* [NEW] Model name enum

* [NEW] Refactor Enum HF

* [NEW] Settings: DEBUT_SKIP_TOXICITY_CALCULATION

* [NEW] Store toxicity values

* [FIX] Merge conflict

* [FIX] Documentation

* [NEW] save_toxicity: function

* [FIX] Formatted string

* [NEW] DEBUG_SKIP_TOXICITY_CALCULATION=True

* [FIX] HfClassificationModel

* [FIX] Alembic merge heads

* [NEW] Refactor save_toxicity

* [NEW] Separating score/label

* [NEW] Store score and label

* [FIX] Cleaning Alembic

* [NEW] Clean HF names

* [NEW] Not type hinting

* [NEW] Update alembic versions

* [NEW] Revert the changes

* [NEW] Type hinting label & score

* Updated down_revision in migration script

Co-authored-by: Andreas Köpf <andreas.koepf@xamla.com>
2023-01-14 12:22:55 +00:00
Andreas Koepf 448d17dd61 Set some message trees into ranking state after seed-data insertion 2023-01-13 13:57:55 +00:00
Andreas Köpf f32ec78988 Returning from /api/v1/frontend_users/{auth_method}/{username}
fixes #615
2023-01-11 14:46:29 +01:00
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
Nil-Andreu 412736f52c [NEW] insert_message_embedding: documentation 2023-01-08 20:59:46 +01:00
Nil-Andreu 225a136ad1 [NEW] Refactor name of message_embedding object 2023-01-08 20:58:19 +01:00
Nil-Andreu 19eee6be58 [NEW] Removing embedding param in function Store Text Reply 2023-01-08 20:54:30 +01:00
Nil-Andreu fe4d265d12 [NEW] Solving merge conflicts 2023-01-08 20:48:13 +01:00
Andreas KöpfandGitHub 8906854dbf Extract UserRepository and TaskRepository from PromptRepository
* 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
2023-01-08 19:08:47 +01:00
jojopirker a677e40cff insert embedding now to new table 2023-01-08 16:46:53 +01:00
jojopirker 11d55d572a message embeddings in Messages table 2023-01-08 12:28:38 +01:00
Oliver StanleyandGitHub 69bc799cd9 344: Create tasks for text labels (#381)
* 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
2023-01-06 18:39:04 +01:00
yeungadrianandGitHub 4715a53637 #47- Create API endpoints that return leaderboards (#250)
* 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
2023-01-02 22:38:54 +01:00
Jack MichaudandGitHub c7ac01718c refactor: move OasstError into oasst_shared.exceptions (#289)
* refactor: move OasstError into oasst_shared.exceptions

* fix: update OasstError import

* fix: linter errors
2023-01-02 22:03:53 +01:00
Gareth Davidson 7000e10bc0 apply pre-commit rules 2023-01-02 00:01:45 +00:00
Andreas Köpf 7b29582cbb add to protocol.Message 2022-12-31 19:23:54 +01:00
Igor MiagkovandAndreas Köpf ef3a35ff9c fixes 2022-12-31 10:31:31 +01:00
Igor MiagkovandAndreas Köpf f126b21bb3 adjust names and types to new naming 2022-12-31 10:31:31 +01:00
Igor MiagkovandAndreas Köpf 475f48b195 stats api method 2022-12-31 10:31:31 +01:00
Igor MiagkovandAndreas Köpf 8e1d80956a split message api endpoints 2022-12-31 10:31:31 +01:00
Igor MiagkovandAndreas Köpf 13d01b5a2f management api 2022-12-31 10:31:31 +01:00
Andreas KöpfandAndreas Köpf 534c99610b missing 'user' -> 'prompter' replacement 2022-12-31 00:18:55 +01:00
Andreas KöpfandAndreas Köpf ee14554e1b role='user' -> role='prompter' 2022-12-31 00:18:55 +01:00
Andreas KöpfandAndreas Köpf 26ae43e945 additional forgotten renamings 2022-12-31 00:18:55 +01:00
Andreas KöpfandAndreas Köpf 8b225430a4 BREAKING-CHANGES: Renaming several models/database objects + API protocol
person -> user
work_package -> task
post -> message
thread -> message_tree
2022-12-31 00:18:55 +01:00
alexandrelefournerandAndreas Köpf 35e0c32a08 Updating work_package to task 2022-12-31 00:18:55 +01:00
alexandrelefournerandAndreas Köpf d118f4e332 Renaming thread to message_tree 2022-12-31 00:18:55 +01:00
alexandrelefournerandAndreas Köpf 7743459220 Renaming post to message 2022-12-31 00:18:55 +01:00
alexandrelefournerandAndreas Köpf 9a1a4876f0 Rename of person to user 2022-12-31 00:18:55 +01:00
Yannic KilcherandGitHub 540f2d58c3 Merge pull request #155 from mjagkow/feature-collective-tasks
Added support for collective tasks
2022-12-29 21:18:14 +01:00
Igor MiagkovandAndreas Köpf acfcd7b8d2 Fixed warning: SAWarning: Coercing Subquery object into a select() for use in IN() 2022-12-29 18:59:44 +01:00
Igor Miagkov efafc0173a added support for collective tasks 2022-12-29 21:32:17 +04:00
Igor MiagkovandAndreas Köpf 4ead078f89 Added readable exception if no posts were found for task 2022-12-29 17:16:44 +01:00
Andreas Köpf 11f249101f Merge branch '55_backend_HTTP_error_feedback' into main 2022-12-29 00:06:22 +01:00
Igor MiagkovandAndreas Köpf c4d5b58922 Updated prompt registry for random tasks sampling 2022-12-28 22:23:16 +01:00
Andreas Köpf 0c3103838b add OasstErrorCode IntEnum, use http.HTTPStatus enum 2022-12-28 19:25:39 +01:00
Andreas Köpf dda668bcd5 Add OasstError exception class and exception filter 2022-12-28 14:10:15 +01:00
Andreas KöpfandAndreas Köpf f74fe68f87 add journal table and JournalWriter helper class 2022-12-27 22:37:48 +01:00
Yannic Kilcher a37bf6bf41 added text labels to the API 2022-12-25 17:08:57 +01:00
Andreas Köpf 8a48722e72 first api-interaction, fix auth_method unique-index 2022-12-22 18:41:50 +01:00
Yannic Kilcher b34ef75423 started re-working python code 2022-12-19 18:00:09 +01:00