mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Add llm disable stop word env var (#10274)
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
This commit is contained in:
@@ -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'))
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user