File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1917,7 +1917,7 @@ def create_completion(
1917
1917
completion_or_chunks = self ._create_completion (
1918
1918
prompt = prompt ,
1919
1919
suffix = suffix ,
1920
- max_tokens = max_tokens ,
1920
+ max_tokens = - 1 if max_tokens is None else max_tokens ,
1921
1921
temperature = temperature ,
1922
1922
top_p = top_p ,
1923
1923
min_p = min_p ,
@@ -1951,7 +1951,7 @@ def __call__(
1951
1951
self ,
1952
1952
prompt : str ,
1953
1953
suffix : Optional [str ] = None ,
1954
- max_tokens : int = 128 ,
1954
+ max_tokens : Optional [ int ] = 16 ,
1955
1955
temperature : float = 0.8 ,
1956
1956
top_p : float = 0.95 ,
1957
1957
min_p : float = 0.05 ,
Original file line number Diff line number Diff line change @@ -110,7 +110,9 @@ class CreateCompletionRequest(BaseModel):
110
110
default = None ,
111
111
description = "A suffix to append to the generated text. If None, no suffix is appended. Useful for chatbots." ,
112
112
)
113
- max_tokens : int = max_tokens_field
113
+ max_tokens : Optional [int ] = Field (
114
+ default = 16 , ge = 0 , description = "The maximum number of tokens to generate."
115
+ )
114
116
temperature : float = temperature_field
115
117
top_p : float = top_p_field
116
118
min_p : float = min_p_field
You can’t perform that action at this time.
0 commit comments