Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions portkey_ai/api_resources/apis/complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions tests/test_complete_top_p_annotation.py
Original file line number Diff line number Diff line change
@@ -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