Commit Graph

178 Commits

Author SHA1 Message Date
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 9194e15b80 bugfix in alembic downgrade (frontend_type not frontend_id) 2023-01-08 10:59:12 +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
Ken Tsui 043b5eff5a Add DEBUG_USD_SEED_DATA_PATH in config to make seed data flexible (#395)
* 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
2023-01-07 14:37:30 +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 6c115bced9 reverted merge of 413 2023-01-06 16:12:52 +01:00
Yannic Kilcher f2db4220bb Merge pull request #413 from batuhanerenler/patch-3
Update env.py
2023-01-06 14:59:09 +01:00
shawticus 1309b5b339 lint env 2023-01-05 17:17:59 -08:00
Batuhan Erenler 104aad87d9 Update env.py 2023-01-06 03:19:10 +03:00
Batuhan Erenler c86e486c4d Update env.py 2023-01-06 03:12:55 +03:00
Batuhan Erenler cc82db81f2 Update env.py 2023-01-06 03:02:34 +03:00
Batuhan Erenler 8282015281 Update env.py 2023-01-06 02:22:11 +03:00
Batuhan Erenler 3899249ea8 Update env.py 2023-01-06 02:11:27 +03:00
Batuhan Erenler d405f196fc Update env.py 2023-01-06 02:09:30 +03:00
Batuhan Erenler ce343a5aea Update env.py 2023-01-06 02:06:38 +03: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
Daniel Hug 935e556cf6 Add message tree state model (#414)
* 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
2023-01-05 21:32:47 +01:00
Batuhan Erenler 2c08e46e31 Update env.py
Fixing trim bugs.
2023-01-05 23:05:41 +03: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
Batuhan Erenler 4012f7da05 Update env.py 2023-01-05 22:50:22 +03:00
Batuhan Erenler 6f319651c1 Update env.py
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.
2023-01-05 20:17:37 +03:00
Nil Andreu 739c073328 Session Close when called HuggingFace Client (#411)
* [FIX] Session Close

* [NEW] Async Context Managers of Response

* [NEW] Linting
2023-01-05 17:49:39 +01: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
Graeme Harris c2b6cdb12a Bugfix #173 - Empty task interactions (#373)
* Added pydantic checks for interaction protocols

* Small updated to BE API README for redis and guide to local scripts

* isort linting
2023-01-05 09:19:57 +01:00
Jack Michaud 5bb9a397b4 feat: add OasstErrorResponse to protocols
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.
2023-01-02 19:01:29 -05: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
kiritowu bbf385bc07 Add TOO_MANY_REQUEST to OasstErrorCode 2023-01-03 00:28:05 +08:00
kiritowu 2a2968f6d4 Initialise redis connection for Fastapi limiter 2023-01-03 00:28:05 +08:00
kiritowu af0313ad5d Add fastapi-limiter to requirements.txt 2023-01-03 00:28:05 +08:00
Gareth Davidson 7000e10bc0 apply pre-commit rules 2023-01-02 00:01:45 +00:00
Gareth Davidson c3c7a1701a run prettier with new params 2023-01-01 20:57:35 +00:00
Jack Michaud 29b08875d4 refactor: move print_openapi_schema into main 2023-01-01 18:58:01 +01:00
Jack Michaud ea40a22049 fix: nack and ack should return empty responses 2023-01-01 18:58:01 +01:00
Jack Michaud 604ad2f8e7 style: run pre-commit hooks 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
Jack Michaud b5ebab8839 chore: add print_openapi_schema and start-mock-server.sh script 2023-01-01 18:58:01 +01:00
Andreas Köpf 7b29582cbb add to protocol.Message 2022-12-31 19:23:54 +01:00