diff --git a/portkey_ai/api_resources/apis/complete.py b/portkey_ai/api_resources/apis/complete.py index 24fa0ef1..80792796 100644 --- a/portkey_ai/api_resources/apis/complete.py +++ b/portkey_ai/api_resources/apis/complete.py @@ -134,7 +134,7 @@ def create( stream: Union[bool, NotGiven] = NOT_GIVEN, temperature: Union[float, NotGiven] = NOT_GIVEN, max_tokens: Union[int, NotGiven] = NOT_GIVEN, - top_p: Union[bool, NotGiven] = NOT_GIVEN, + top_p: Union[float, NotGiven] = NOT_GIVEN, best_of: Union[int, NotGiven] = NOT_GIVEN, echo: Union[bool, NotGiven] = NOT_GIVEN, frequency_penalty: Union[float, NotGiven] = NOT_GIVEN, @@ -317,7 +317,7 @@ async def create( stream: Union[bool, NotGiven] = NOT_GIVEN, temperature: Union[float, NotGiven] = NOT_GIVEN, max_tokens: Union[int, NotGiven] = NOT_GIVEN, - top_p: Union[bool, NotGiven] = NOT_GIVEN, + top_p: Union[float, NotGiven] = NOT_GIVEN, best_of: Union[int, NotGiven] = NOT_GIVEN, echo: Union[bool, NotGiven] = NOT_GIVEN, frequency_penalty: Union[float, NotGiven] = NOT_GIVEN, diff --git a/tests/test_complete_top_p_annotation.py b/tests/test_complete_top_p_annotation.py new file mode 100644 index 00000000..4979d747 --- /dev/null +++ b/tests/test_complete_top_p_annotation.py @@ -0,0 +1,20 @@ +import inspect +import typing + +from portkey_ai import AsyncCompletion, Completion + + +def test_completion_top_p_is_typed_as_float(): + annotation = inspect.signature(Completion.create).parameters["top_p"].annotation + args = typing.get_args(annotation) + assert float in args + assert bool not in args + + +def test_async_completion_top_p_is_typed_as_float(): + annotation = ( + inspect.signature(AsyncCompletion.create).parameters["top_p"].annotation + ) + args = typing.get_args(annotation) + assert float in args + assert bool not in args