Commit Graph

80 Commits

Author SHA1 Message Date
Andreas Köpf 718faa098e Add combined TreeManager stats endpoint (#816) 2023-01-18 00:54:19 +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
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
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
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 343853fb57 add TreeManagerConfiguration as sub-module to global pydantic settings class 2023-01-13 15:52:09 +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
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 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
Nil-Andreu 4b4a564a8f [NEW] Camelcase & 2x space 2023-01-09 10:10:19 +01:00
Nil-Andreu e241a8bf28 [NEW] Adding consistency in the URLs 2023-01-08 21:01:15 +01:00
Nil-Andreu fe4d265d12 [NEW] Solving merge conflicts 2023-01-08 20:48:13 +01:00
Andreas Köpf 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
Nil-Andreu 34e7d1db8a [NEW] Except OasstError 2023-01-08 14:36:38 +01:00
jojopirker 11d55d572a message embeddings in Messages table 2023-01-08 12:28:38 +01:00
kostiak d183c343a9 Temporary fix for #506 to get the frontend working (#508) 2023-01-07 23:55:44 +01:00
Andreas Köpf d910c310c0 fix text_frontend 204 & creation of labeling tasks (#487) 2023-01-07 21:58:29 +01:00
Andreas Köpf 5e01f421aa add 'help_text' to valid_lables response 2023-01-07 21:48:11 +01:00
jojopirker 5fb0121668 #438 Frontend type (#483)
* add dev setup to readme & alembic description

* frontend_type for api_client

* readme update & missing file

* pre-commit
2023-01-07 21:33:57 +01:00
Oliver Stanley 45f2f3a60e Validate text labels in text frontend (#495)
* Validate text labels in text frontend

* Correct task type
2023-01-07 21:30:18 +01:00
Andreas Köpf 5b2cb5dd29 add api/v1/text_labels/valid_labels backend endpoint (#498)
Provides the set of valid text_lables with descriptions via a REST endpoint.
2023-01-07 21:28:24 +01:00
Daniel Hug f75a07301b Conversation messages refactor add msg ids (#500)
* 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
2023-01-07 19:16:32 +01:00
Andreas Köpf 96d6717be4 Fetch conversation for seed data tasks, minor model fixes (#485)
* Fetch conversation for seed data, fix models, remove redundant payload type checks
2023-01-07 15:59:54 +01:00
Oliver Stanley 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
Yannic Kilcher 48fc4efa35 Merge pull request #419 from Vechtomov/generate-task-refactoring
Simplified random task generation
2023-01-05 22:06:21 +01:00
Vechtomov df0c48c4fa clean up 2023-01-05 22:59:12 +03:00
Vechtomov aafe93ff82 simplified random task generation 2023-01-05 22:50:51 +03:00
Nil Andreu ee50b573e1 Detoxify Rest API Client (#404)
* [NEW] utils: Endpoint Toxic Roberta

* [NEW] Constants API URL

* [NEW] Git ignore venv

* [NEW] Lint

* [NEW] Backend default args

* [NEW] HUGGINGFACE_API_ERROR

* [NEW] Requests package

* [NEW] Get Toxicity Endpoint

* [NEW] Schema:  ToxicityClassification

[NEW] Constants module

[FIX] Module

* [FIX] Test Key HF

* [NEW] settings: HUGGING_FACE_API_KEY

* [NEW] Remove requests

* [NEW] HuggingFace client

* [NEW] Cleaning code
2023-01-05 16:18:04 +01:00
Yannic Kilcher 2df4e7a735 Merge pull request #295 from croumegous/fastapi-response-model
chore: add fastapi response model to every endpoints, add openapi documentation for API response
2023-01-02 23:17:48 +01:00
croumegous fc7f8cbc1f chore: add fastapi response model to every endpoints, add openapi documentation for API response 2023-01-02 22:55:08 +01:00
yeungadrian 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 Michaud 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
kiritowu 4796146aa7 Fix getting api_key using dependencies 2023-01-03 01:17:36 +08:00
kiritowu aa6d5786c6 Add rate limiter for task request 2023-01-03 00:28:05 +08:00
Gareth Davidson 7000e10bc0 apply pre-commit rules 2023-01-02 00:01:45 +00:00
Jack Michaud ea40a22049 fix: nack and ack should return empty responses 2023-01-01 18:58:01 +01:00
Jack Michaud e15e208b20 fix: add response_model to tasks_interaction
This is required for output validation and for the mock server.
2023-01-01 18:58:01 +01:00
Andreas Köpf 7b29582cbb add to protocol.Message 2022-12-31 19:23:54 +01:00