mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(feat) add moderation on router
This commit is contained in:
parent
e590f47a44
commit
693efc8e84
4 changed files with 145 additions and 6 deletions
|
@ -991,3 +991,23 @@ def test_router_timeout():
|
|||
print(e)
|
||||
print(vars(e))
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_router_amoderation():
|
||||
model_list = [
|
||||
{
|
||||
"model_name": "openai-moderations",
|
||||
"litellm_params": {
|
||||
"model": "text-moderation-stable",
|
||||
"api_key": os.getenv("OPENAI_API_KEY", None),
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
router = Router(model_list=model_list)
|
||||
result = await router.amoderation(
|
||||
model="openai-moderations", input="this is valid good text"
|
||||
)
|
||||
|
||||
print("moderation result", result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue