π OpenHands: AI-Driven Development
Add llm disable stop word env var (#10274)
Jesse4e3a86257101
diff --git a/openhands/core/config/llm_config.py b/openhands/core/config/llm_config.pyindex 2a11d95213..eaa381b835 100644--- a/openhands/core/config/llm_config.py+++ b/openhands/core/config/llm_config.py@@ -80,6 +80,7 @@ class LLMConfig(BaseModel):# Note: this setting is actually global, unlike drop_paramsmodify_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'))diff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex 8901b1665c..08d9308be6 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -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_WORDSmock_fncall_tools = kwargs.pop('tools')