forked from phoenix/litellm-mirror
Simplify mock_patch_acompletion
This commit is contained in:
parent
6ec058711a
commit
a79fd772f4
1 changed files with 12 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue