mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix(main.py): fix mock completion response
This commit is contained in:
parent
b4ec16fd5f
commit
885eb4584a
1 changed files with 6 additions and 5 deletions
|
@ -360,7 +360,7 @@ def mock_completion(
|
||||||
model: str,
|
model: str,
|
||||||
messages: List,
|
messages: List,
|
||||||
stream: Optional[bool] = False,
|
stream: Optional[bool] = False,
|
||||||
mock_response: str = "This is a mock request",
|
mock_response: Union[str, Exception] = "This is a mock request",
|
||||||
logging=None,
|
logging=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
@ -388,10 +388,11 @@ def mock_completion(
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
## LOGGING
|
## LOGGING
|
||||||
logging.pre_call(
|
if logging is not None:
|
||||||
input=messages,
|
logging.pre_call(
|
||||||
api_key="mock-key",
|
input=messages,
|
||||||
)
|
api_key="mock-key",
|
||||||
|
)
|
||||||
if isinstance(mock_response, Exception):
|
if isinstance(mock_response, Exception):
|
||||||
raise litellm.APIError(
|
raise litellm.APIError(
|
||||||
status_code=500, # type: ignore
|
status_code=500, # type: ignore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue