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}"}
|
headers = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
|
example_completion_result = {
|
||||||
@contextlib.contextmanager
|
|
||||||
def mock_patch_acompletion():
|
|
||||||
async def side_effect(*args, **kwargs):
|
|
||||||
return {
|
|
||||||
"choices": [
|
"choices": [
|
||||||
{
|
{
|
||||||
"message": {
|
"message": {
|
||||||
|
@ -52,9 +48,12 @@ def mock_patch_acompletion():
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def mock_patch_acompletion():
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
"litellm.proxy.proxy_server.llm_router.acompletion",
|
"litellm.proxy.proxy_server.llm_router.acompletion",
|
||||||
side_effect=side_effect,
|
return_value=example_completion_result,
|
||||||
):
|
):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue