Skip to content

Commit 83c25ac

Browse files
authored
fix: remove default max token (#59)
1 parent 77c3566 commit 83c25ac

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/litai/llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def _model_call(
210210
model: SDKLLM,
211211
prompt: str,
212212
system_prompt: Optional[str],
213-
max_completion_tokens: int,
213+
max_completion_tokens: Optional[int],
214214
images: Optional[Union[List[str], str]],
215215
conversation: Optional[str],
216216
metadata: Optional[Dict[str, str]],
@@ -272,7 +272,7 @@ def chat( # noqa: D417
272272
prompt: str,
273273
system_prompt: Optional[str] = None,
274274
model: Optional[str] = None,
275-
max_tokens: int = 500,
275+
max_tokens: Optional[int] = None,
276276
images: Optional[Union[List[str], str]] = None,
277277
conversation: Optional[str] = None,
278278
metadata: Optional[Dict[str, str]] = None,
@@ -287,7 +287,7 @@ def chat( # noqa: D417
287287
prompt (str): The message to send to the LLM.
288288
system_prompt (str): The system prompt to set the context. Defaults to assistant's default system prompt.
289289
model (Optional[str]): The model to override. If provided, this model will be prioritized and used.
290-
max_tokens (int): The maximum number of tokens for the response. Defaults to 500.
290+
max_tokens (int): The maximum number of tokens for the response. Defaults to None.
291291
images (Optional[Union[List[str], str]]): List of local or public image paths to pass to the model.
292292
conversation (Optional[str]): The conversation ID for maintaining context. Defaults to None.
293293
metadata (Optional[dict[str, str]]): Dictionary for storing additional information of the request.

tests/test_llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_llm_chat(mock_llm_class):
124124
mock_llm_instance.chat.assert_called_once_with(
125125
prompt="Hello, who are you?",
126126
system_prompt="You are a helpful assistant.",
127-
max_completion_tokens=500,
127+
max_completion_tokens=None,
128128
images=None,
129129
conversation=None,
130130
metadata={"user_api": "123456"},
@@ -181,7 +181,7 @@ def mock_llm_constructor(name, teamspace="default-teamspace", **kwargs):
181181
mock_override.chat.assert_called_once_with(
182182
prompt="Hello",
183183
system_prompt=None,
184-
max_completion_tokens=500,
184+
max_completion_tokens=None,
185185
images=None,
186186
conversation=None,
187187
metadata=None,
@@ -231,7 +231,7 @@ def mock_llm_constructor(name, teamspace="default-teamspace", **kwargs):
231231
mock_fallback_model.chat.assert_called_with(
232232
prompt="Hello",
233233
system_prompt=None,
234-
max_completion_tokens=500,
234+
max_completion_tokens=None,
235235
images=None,
236236
conversation=None,
237237
metadata=None,

0 commit comments

Comments
 (0)