mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-12 12:03:06 +08:00
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>
This commit is contained in:
co-authored by
Andreas Köpf
parent
dbf8f77072
commit
a902c600fa
@@ -4,7 +4,7 @@ from fastapi import APIRouter, Depends
|
||||
from oasst_backend.api import deps
|
||||
from oasst_backend.models import ApiClient
|
||||
from oasst_backend.schemas.hugging_face import ToxicityClassification
|
||||
from oasst_backend.utils.hugging_face import HfUrl, HuggingFaceAPI
|
||||
from oasst_backend.utils.hugging_face import HfClassificationModel, HfUrl, HuggingFaceAPI
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -25,7 +25,8 @@ async def get_text_toxicity(
|
||||
ToxicityClassification: the score of toxicity of the message.
|
||||
"""
|
||||
|
||||
api_url: str = HfUrl.HUGGINGFACE_TOXIC_ROBERTA.value
|
||||
api_url: str = HfUrl.HUGGINGFACE_TOXIC_CLASSIFICATION.value + "/" + HfClassificationModel.TOXIC_ROBERTA.value
|
||||
|
||||
hugging_face_api = HuggingFaceAPI(api_url)
|
||||
response = await hugging_face_api.post(msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user