Simplify mock_patch_acompletion

This commit is contained in:
Marc Abramowitz 2024-05-02 12:47:27 -07:00
parent 6ec058711a
commit a79fd772f4

View file

@ -37,11 +37,7 @@ token = "sk-1234"
headers = {"Authorization": f"Bearer {token}"}
@contextlib.contextmanager
def mock_patch_acompletion():
async def side_effect(*args, **kwargs):
return {
example_completion_result = {
"choices": [
{
"message": {
@ -50,11 +46,14 @@ def mock_patch_acompletion():
}
}
],
}
}
@contextlib.contextmanager
def mock_patch_acompletion():
with mock.patch(
"litellm.proxy.proxy_server.llm_router.acompletion",
side_effect=side_effect,
return_value=example_completion_result,
):
yield