Commit Graph

14 Commits

Author SHA1 Message Date
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
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 7f562fbbae add managed_tx_function() decorator and use it for startup db-calls 2023-01-16 09:16:28 +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
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
dhug 3136b2e120 added similarity functions and ran precommit (#633) 2023-01-11 20:53:53 +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
Nil-Andreu 4b4a564a8f [NEW] Camelcase & 2x space 2023-01-09 10:10:19 +01:00
Nil-Andreu b39b86309c [FIX] Import on top 2023-01-09 09:03:02 +01:00
Nil-Andreu e241a8bf28 [NEW] Adding consistency in the URLs 2023-01-08 21:01:15 +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
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