Commit Graph

246 Commits

Author SHA1 Message Date
Andreas Köpf 7e8d4f5a6e fix only_active condition of tree_message_count_stats() 2023-01-18 22:02:35 +01:00
MattAlexMiracle 530194de08 Fix to ranking algorithm (#826)
* fixed ranking

* fix index error

Co-authored-by: Alexander Mattick <alex.mattick@fau.de>
2023-01-18 21:27:16 +01:00
Vechtomov 9b98056001 change leaderboard ordering (#825) 2023-01-18 21:17:16 +01:00
Andreas Köpf 718faa098e Add combined TreeManager stats endpoint (#816) 2023-01-18 00:54:19 +01:00
Andreas Köpf acaa56ebb0 fix ranking assert for 1st level children 2023-01-18 00:49:28 +01:00
dhug 6b82b2cd13 Add api auth to user stat repo (#805)
* added api_auth to user_stats_repository

* pre_commit changes

* Remove call with dev uuid

Co-authored-by: Andreas Köpf <andreas.koepf@xamla.com>
2023-01-17 20:07:39 +00:00
Andreas Koepf 0f896d910e make sure we enter READY_FOR_EXPORT after ranking 2023-01-17 17:50:17 +00:00
Andreas Köpf 9b6dc6bae2 fix join types in TreeManager 2023-01-17 11:01:36 +01:00
Andreas Köpf 2ee01d1224 fix query in TreeManager.query_extendible_parents() 2023-01-17 10:45:52 +01:00
Andreas Köpf d85cec3d2f extensible -> extendible 2023-01-17 10:21:57 +01:00
Andreas Köpf 6e4d8097b6 fix availability for label_prompter_reply 2023-01-17 10:15:30 +01:00
Andreas Köpf 988913943f use '.value' of str-enums in db queries 2023-01-17 09:54:20 +01:00
dhug 8b30c7b68e add changes for auto_main, tree_manager, and utils/ranking (#786)
* add changes for auto_main, tree_manager, and utils/ranking

* pre-commit changes

Co-authored-by: Alexander Mattick <alex.mattick@fau.de>
2023-01-17 08:27:21 +01:00
Andreas Köpf 2d4e39cf5d use sqlalchemy for query_reviews_for_message() in TreeManager 2023-01-16 20:31:29 +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
Andreas Köpf 7f562fbbae add managed_tx_function() decorator and use it for startup db-calls 2023-01-16 09:16:28 +01:00
Andreas Köpf a42f2cd3ed add new debug option 'DEBUG_DATABASE_ECHO' (default False) 2023-01-16 08:46:45 +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 72a58ca2d3 add 'cache_ok = True' to PayloadJSONBType type decorator 2023-01-16 08:37:24 +01:00
Keith Stevens 5e814eaa4c Merge pull request #732 from LAION-AI/673-admin-page-pagination
Supporting user pagination on the web admin view
2023-01-16 08:39:15 +09:00
Andreas Köpf bf80820d34 fix realistic seed data (remove 'Assistant: ' prefixes) 2023-01-16 00:26:27 +01:00
Andreas Köpf de28d67031 infer role from task in store_text_reply() 2023-01-16 00:19:30 +01:00
Yannic Kilcher c0cb15bbb0 fixing text frontend and startup creation 2023-01-16 00:11:20 +01:00
Yannic Kilcher 5d441b1570 prepared playbook for prod 2023-01-15 23:30:16 +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 cd49080c63 add response_model param to leaderboards endpoint 2023-01-15 16:28:46 +01: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
Keith Stevens 35e92dbd15 Supporting user pagination on the web admin view 2023-01-15 15:26:12 +09:00
Keith Stevens 69be679fe1 Merge pull request #701 from LAION-AI/673-enhanced-admin-routing
673 enhanced admin management
2023-01-15 08:34:09 +09:00
Andrew Maguire 0f607c7a28 export and auto-commit docs/docs/api/openapi.json as part of test-api-contract workflow (#719)
- copies that openapi.json file to docs/docs/api/openapi.json as part of start-mock-server.sh.
- adds a step to the end of the test-api-contract workflow that just auto-commits changes to the docs/docs/api/openapi.json file.
- excludes docs/docs/api/openapi.json from pre-commit since its already been formatted by jq.
2023-01-14 22:40:33 +00:00
kayjay 5cd9c630fc Small typo fix + Consistent Docstrings (#698)
* Small typo fix + Consistent Docstrings

Also removed a redundant comment.

* undo comment removal

* Fixed indentation from previous commit
2023-01-14 17:24:02 +01:00
Andreas Köpf 6547058778 add rank to message table and fix message_toxicity migration 2023-01-14 15:12:10 +01:00
Nil Andreu 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 Köpf 8b8326e22f add /by_display_name user query & created_date to FrontEndUser model 2023-01-14 11:03:25 +01:00
Keith Stevens f9c8d1dd81 Combining the admin API routes with the backends user routes 2023-01-14 16:55:14 +09:00
Andreas Koepf d0ef7c4bbc add missing doc-strings for tree-manager mandatory labels settings 2023-01-13 16:04:06 +00:00
Andreas Koepf 343853fb57 add TreeManagerConfiguration as sub-module to global pydantic settings class 2023-01-13 15:52:09 +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 945c645818 returning list[FrontEndUser] from api/v1/frontend_users/ endpoint 2023-01-12 22:58:43 +01:00
Vechtomov 0d646e72f3 537: Endpoint to list frontend users (#554)
* added frontend users endpoint

* fix comparison

* added api_client_id filtration

* allow untrusted api-clients

* review fixes

Co-authored-by: Andreas Köpf <andreas.koepf@provisio.com>
2023-01-12 22:45:11 +01:00
Andreas Köpf f264b43cde fix user's notes column server_default value 2023-01-12 21:43:33 +01:00
Oliver Stanley 050d4902f3 538: Add endpoints to manage users (#601)
* Add endpoints for getting, updating, deleting users by global user ID

* Resolve formatting

* Include alembic revision script

* Updated down_revision to current alembic head

Co-authored-by: Andreas Köpf <andreas.koepf@xamla.com>
2023-01-12 21:30:07 +01:00
Andreas Köpf 7b78430569 remove accepted_messages ref 2023-01-12 01:23:05 +01:00
Andreas Köpf b659e1cf01 remove accepted_messages from message_tree_state 2023-01-12 01:21:32 +01:00
Andreas Köpf 025d20e638 shuffle ranking options, add simple mode for text-labels 2023-01-11 23:47:56 +01:00
dhug 3136b2e120 added similarity functions and ran precommit (#633) 2023-01-11 20:53:53 +01:00
dhug 9421488619 Add realistic seed data json and update seed_data to properly label task payloads (#613)
* modifies seed_data script to properly label taks types as prompteror assistant

* added realistic data json

* pre-commit changes

* update realistic_seed_data.json 5000 messages -> 450 messages

* pre-commit changes

* modifies seed_data script to properly label taks types as prompteror assistant

* added realistic data json

* pre-commit changes

* update realistic_seed_data.json 5000 messages -> 450 messages

* pre-commit changes

* changed DEBUG_USE_SEED_DATA_PATH to realistic_seed_data, merged with main, ran pre-commit

* Delete 2023_01_10_2052-06cc56417e69_.py

Co-authored-by: Andreas Köpf <andreas.koepf@provisio.com>
2023-01-11 18:48:14 +01:00
Andrew Maguire b1fbd0fa96 Devcontainer backend dev (#608)
add backend-dev devcontainer and extract openapi.json to docs/
2023-01-11 17:09:02 +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