85 Commits

Author SHA1 Message Date
Yannic Kilcher 48212079f4 unified queueing 2023-02-11 01:31:25 +01:00
Yannic Kilcher 4076afd0d8 added token buffer for catchiing stop sequences 2023-02-09 23:46:44 +01:00
Yannic Kilcher 7c4ff73241 corrected random seed for torch 2023-02-09 09:20:00 +01:00
Yannic Kilcher 27671e3220 HF inference fixes 2023-02-09 00:27:51 +01:00
Yannic Kilcher bab056a73b switched to HF text-generation-inference 2023-02-08 23:52:39 +01:00
Andreas Köpf 8bad8c32cd add porperties to message response model (deleted, synthetic, ...) 2023-02-08 20:24:06 +01:00
Andreas Köpf 363a3a1244 Ignore up/down votes (emojis) for own messages (#1302)
* ignore up/down votes (emojis) for own messages

* add 'user_is_author' bool porperty to protocol.ConversationMessage
2023-02-07 16:40:25 +01:00
Kian-Meng Ang 1e321a6fca Fix typos (#1143)
Found via `codespell -S .mypy_cache,yarn.lock,*.json,*.ipynb -L
rouge,nam,vie`
2023-02-05 20:18:03 +01:00
Oliver Stanley 652b7bff04 857: Implement backend Discord authentication (#943)
* Initial code for backend auth

* Remove outdated check

* Initial separation of AuthenticatedUser

* AuthenticatedUser -> Account

* Rework for Account

* Initial code for Discord OAuth

* Remove now redundant methods

* Remove incorrect response model, add requests dep for backend

* Create Settings fields for Discord values

* Cleanup get account from Discord function

* Cleanup

* Cleanup

* Generate alembic upgrade script

* Remove unused error codes

* Update alembic script to correct down revision

* Use aiohttp over requests

* Update alembic script to latest down revision
2023-02-02 19:33:21 +01:00
Alex Ott dfd2c35276 Feat/task handler (#1056)
* move task logic to task handlers

* rename command

* remove test code

* rename classes and add missing handler creations

* switch task back to random and fetch log_channel_id from db
2023-02-02 17:28:00 +01:00
Andreas Köpf 2db3450e9a add trollboards 2023-02-02 16:10:38 +01:00
Andreas Köpf 5f7013fb81 add '_' prefix to special emoji codes, fix skip rankings 2023-02-02 00:51:20 +01:00
Andreas Köpf 779f522385 Skip tasks permanently based on special skip emoji codes (#1064)
* add skip emojis

* extend tree_manager queries to exclude tasks based on skip-emojis

* remove unrelated columns

* change skip_reason max_length to 512

* update down_revision to 55361f323d12
2023-02-02 00:07:08 +01:00
Andreas Köpf bbf038677c Add terms of service acceptance date to user table (#1046)
* add tos_acceptance_date column to user

* send 451 UNAVAILABLE_FOR_LEGAL_REASONS status

* add create user REST endpoint

* adapt text-frontend to ToS requirements

* set DEBUG_IGNORE_TOS_ACCEPTANCE default to True (temporary change)

* update down revision to f60958968ff8
2023-02-01 23:53:21 +01:00
Andreas Köpf af0ae71bbe Add message to prompt-labeling task (#1035)
* add full message to prompt-labeling & always require full prompt labeling

* always sending conversation, also for initial prompt labeling

* update type annotation
2023-01-31 14:42:04 +00:00
Andreas Köpf b6bdb84019 Add endpoint to query nearby leaderboard rows (#1038)
* add is_current_user bool

* add user leaderboard surrounding window function
2023-01-31 15:05:05 +01:00
James Melvin Ebenezer 063157355c 906: update user streaks (#1016)
* fix: update user streaks
* Moved  streak_last_day_date & streak_days from UserStats to User
* Updated Alembic version
* update last_activity after tm.handle_interaction()
* periodically executed function in main.py to update the user_streak every 4hrs

* fix:removed log messages

* fix: pre commit issues

* refactor: incorporated review comments

* fix: removed the managed -scope.

* refactor: managed_tx to Outer REST Db Ops in /interaction API

* fix: pre-commit changes

* fix: added streak and last_activity_date to protocol.FrontEndUser

* fix: pre-commit fixes after merge

* fix: added streak info to user_stat_repository, leaderboard and review comments

* fix: proper 4h delay and simpler startup_time initialisation

---------

Co-authored-by: James Melvin <melvin@gameface.ai>
2023-01-31 12:27:45 +01:00
Andreas Köpf a5bc9bf492 Add dupe checks to store_text_reply() & store_text_labels() in PromptRepository (#1018)
* add dupe checks to store_text_reply() & store_text_labels

* remove test export file

* add user_id to protocol.ConversationMessage

* add show_on_leaderboard ot protocol.FrontEndUser
2023-01-30 20:53:59 +01:00
Andreas Köpf cef20beee6 'Language Mismatch' -> 'Wrong Language' 2023-01-30 00:28:38 +01:00
Andreas Köpf 0601d874e8 add lang_mismatch label to prompt/reply acceptance check (#984)
* add lang_mismatch label to acceptance check

* make acceptance formula clearer

* make lang_mismatch flag, remove helpful from prompter labels
2023-01-29 17:34:37 +01:00
Andreas Köpf eb4c41e3c6 send full conversation (including last-message) in label tasks 2023-01-28 20:23:39 +01:00
dhug 49b5999ce6 Duplicate message reply filter (#958)
* added changes for user specific message dumplication filter, added error codes, and settings variable as described in Draft PR #926, ran precommit

* removed debug statements

* add missing await to async_managed_tx_method

* add 2nd missing await to async_managed_tx_method

* added changes for user specific message dumplication filter, added error codes, and settings variable as described in Draft PR #926, ran precommit

* removed debug statements

* assert task user matches prompt_repository user

* removed assert statments

* moved duplicate_message_filter and message_length check into store_text_reply

* removed old checks in tree_manager
2023-01-27 21:52:19 +00:00
Andreas Köpf 3a32a10b23 add reply_message to LabelConversationReplyTask & LabelConversationReplyPayload 2023-01-27 22:30:27 +01:00
Yannic Kilcher 83dc00b638 Merge branch 'main' of github.com:LAION-AI/Open-Assistant 2023-01-27 15:23:25 +01:00
Yannic Kilcher a0f4449e9f added seed to parameters 2023-01-27 15:23:19 +01:00
Andreas Köpf da1c81d2c9 Add LabelDescription list to labeling tasks, make +1/-1 emojis exclusive (#947)
* add LabelDescription list to labeling tasks

* make +1 & -1 emoji exclusive (only one of both or none)

* add red_flag emoji to message when reported

* fix task's valid labels

* fix typo
2023-01-27 00:54:29 +01:00
Yannic Kilcher f1edcc8a28 added streaming worker 2023-01-26 16:41:57 +01:00
Andreas Köpf c2fa476904 Add user emoji augmentation for message queries (#937)
* add disposition to text labeling tasks

* add emoji stats to ConversationMessage

* add user emoji augmentation for message queries

* add auth_method,username to message queries (query emoji status)

* add auth_method+username for single message

* fix param name typo

* only join rows when message.emojis != JSON.NULL

* formatting

* make sure emojis and user_emojis default to {}, []

* remove init_user(), use fresh empty default collections
2023-01-26 14:29:54 +00:00
Andreas Köpf 4d7be8ebb9 wait for pending message reviews before entering ranking state 2023-01-25 18:18:21 +01:00
Andreas Köpf 558b207013 Add /messages/{message_id}/emoji endpoint to toggle, add, remove message emojis (#925)
* add endpoint to set message emojis

* make refresh result optional in db utils
2023-01-25 09:31:20 +01:00
Yannic Kilcher 1709dc0324 Initial implementation of the inference system (#869)
* very primitive implementation of inference

* re-worked with security in mind

* removed polling from clients

* switched workers to websockets

* implemented back and forth chats
2023-01-21 22:38:18 +01:00
Ori Yonay cec49614c2 added message size limit of 2000 characters (issue 822) (#880)
* added message size limit (issue 822)
2023-01-21 22:37:42 +01:00
Andreas Köpf 94e5d50537 add users/cursor keyset_pagination endpoint (#866)
* add users/cursor endpoint

* add messages/cursor endpoint

* add user/{user_id}/messages/cursor, frontend_user/{auth_method}/{username}/messages/cursor

* user regex to parse cursor value
2023-01-21 00:29:53 +01:00
Andreas Köpf 2d21b65ed0 Add lang-tag based task selection (lang-separation) (#863)
* lang based task selection

* use BCP 47 instead of ISO 639-1

* add Field(None, nullable=True)

* update migration script down_revision
2023-01-20 19:58:33 +01:00
Andreas Köpf 038d1cc004 last_uddated for user_stats, swtich to timestamptz 2023-01-19 22:07:08 +01:00
Andreas Köpf 547e355e27 add update_leaderboard..(), admin/purge/{user-id}/messages, ban param for purge_user() 2023-01-19 15:10:22 +01:00
Andreas Köpf 335af5d641 add admin purge user function (#834)
* add admin purge user function

* improve comments

* minor naming changes

* ensuer user is enabled for tasks api requests

* add preview with stats to /admin/purge_user/{id} endpoint

* add update_children_counts()
2023-01-19 12:33:55 +01:00
Andreas Köpf ead51ff423 770 tree manager allow to specify desired task_type no prompter ranking (#775)
* only ranking assistant replies by default

* add tasks/availability endpoint allow to specify desired task

* move rank_prompter_replies option to TreeManagerConfiguration

* fix type annotation

* remove desired_task_type from _random_task_selection()

* fix typo

* Convert query_tree_size to sqlachemy, return 'full' text-labeling tasks if they were explicitly requested
2023-01-16 20:05:40 +01:00
James Melvin Ebenezer 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
Yannic Kilcher cc03376d86 added root tokens and endpoint for adding api keys (#742)
* added root tokens and endpoint for adding api keys

* Change down revision to current alembic head

* removed added_by_root_token

* refactored description

* fixed jinja errors

Co-authored-by: Andreas Köpf <andreas.koepf@provisio.com>
2023-01-15 21:24:25 +00:00
Andreas Köpf e58ffd64fa add /api/v1/users/{user_id}/stats endpoint (#744)
* add /api/v1/users/{user_id}/stats endpoint

* return 0 stats and add /api/v1/users/{user_id}/stats/{time_frame}

* use utcnow() as modified date for 0 stats
2023-01-15 20:24:15 +00:00
Andreas Köpf 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
Andreas Köpf 8b8326e22f add /by_display_name user query & created_date to FrontEndUser model 2023-01-14 11:03:25 +01:00
Andreas Köpf 945c645818 returning list[FrontEndUser] from api/v1/frontend_users/ endpoint 2023-01-12 22:58:43 +01:00
Andreas Köpf 025d20e638 shuffle ranking options, add simple mode for text-labels 2023-01-11 23:47:56 +01:00
Andreas Köpf f32ec78988 Returning from /api/v1/frontend_users/{auth_method}/{username}
fixes #615
2023-01-11 14:46:29 +01:00
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
Oliver Stanley e5abb2dc85 536: Add endpoint to resolve frontend user by auth method and username (#539)
* Add endpoint to resolve frontend user by auth method and username

* Require client ID for frontend user lookup

* Remove unnecessary if check

* Fix PromptRepository -> UserRepository

* Convert to protocol User

* Move User prep

* Address review comments

* 404 -> HTTP_404_NOT_FOUND
2023-01-10 18:20:56 +01:00
Yannic Kilcher ec0f9bb536 Merge pull request #535 from olliestanley/525-refine-hate-speech
525: Refine label for hate_speech
2023-01-08 16:04:42 +01:00