Add llm disable stop word env var (#10274)

Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
This commit is contained in:
Jesse
2025-08-12 23:52:11 -04:00
committed by GitHub
parent 50aa014876
commit 4e3a862571
2 changed files with 6 additions and 2 deletions

View File

@@ -80,6 +80,7 @@ class LLMConfig(BaseModel):
# Note: this setting is actually global, unlike drop_params
modify_params: bool = Field(default=True)
disable_vision: bool | None = Field(default=None)
disable_stop_word: bool | None = Field(default=False)
caching_prompt: bool = Field(default=True)
log_completions: bool = Field(default=False)
log_completions_folder: str = Field(default=os.path.join(LOG_DIR, 'completions'))

View File

@@ -305,8 +305,11 @@ class LLM(RetryMixin, DebugMixin):
)
kwargs['messages'] = messages
# add stop words if the model supports it
if self.config.model not in MODELS_WITHOUT_STOP_WORDS:
# add stop words if the model supports it and stop words are not disabled
if (
self.config.model not in MODELS_WITHOUT_STOP_WORDS
and not self.config.disable_stop_word
):
kwargs['stop'] = STOP_WORDS
mock_fncall_tools = kwargs.pop('tools')