diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 80a51c480b..6617f05302 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -10,7 +10,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import pytest import litellm -from litellm import embedding, completion, completion_cost, Timeout +from litellm import embedding, completion, completion_cost, Timeout, acompletion from litellm import RateLimitError # litellm.num_retries = 3 @@ -859,6 +859,28 @@ def test_completion_azure_key_completion_arg(): # test_completion_azure_key_completion_arg() +def test_acompletion_params(): + import inspect + from litellm.types.completion import CompletionRequest + + acompletion_params_odict = inspect.signature(acompletion).parameters + acompletion_params = {name: param.annotation for name, param in acompletion_params_odict.items()} + completion_params = {field_name: field_type for field_name, field_type in CompletionRequest.__annotations__.items()} + + # remove kwargs + acompletion_params.pop("kwargs", None) + + keys_acompletion = set(acompletion_params.keys()) + keys_completion = set(completion_params.keys()) + + # Assert that the parameters are the same + if keys_acompletion != keys_completion: + pytest.fail("The parameters of the acompletion function and the CompletionRequest class are not the same.") + + +# test_acompletion_params() + + async def test_re_use_azure_async_client(): try: print("azure gpt-3.5 ASYNC with clie nttest\n\n") diff --git a/litellm/utils.py b/litellm/utils.py index 4520bee621..6223e7646a 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -14,6 +14,7 @@ import subprocess, os import litellm, openai import itertools import random, uuid, requests +from functools import wraps import datetime, time import tiktoken import uuid @@ -1934,6 +1935,7 @@ def client(original_function): # [Non-Blocking Error] pass + @wraps(original_function) def wrapper(*args, **kwargs): start_time = datetime.datetime.now() result = None @@ -2128,6 +2130,7 @@ def client(original_function): e.message += f"\n Check the log in your dashboard - {liteDebuggerClient.dashboard_url}" raise e + @wraps(original_function) async def wrapper_async(*args, **kwargs): start_time = datetime.datetime.now() result = None