mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
fix(llm): support draft editor retries by adding correct_num to LLMConfig (#11530)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Justin Coffi <jcoffi+github@gmail.com>
This commit is contained in:
@@ -95,6 +95,8 @@ class LLMConfig(BaseModel):
|
||||
description='Safety settings for models that support them (like Mistral AI and Gemini)',
|
||||
)
|
||||
for_routing: bool = Field(default=False)
|
||||
# The number of correction attempts for the LLM draft editor
|
||||
correct_num: int = Field(default=5)
|
||||
completion_kwargs: dict[str, Any] | None = Field(
|
||||
default=None,
|
||||
description='Custom kwargs to pass to litellm.completion',
|
||||
|
||||
@@ -400,8 +400,8 @@ class FileEditRuntimeMixin(FileEditRuntimeInterface):
|
||||
ret_obs.llm_metrics = self.draft_editor_llm.metrics
|
||||
return ret_obs
|
||||
|
||||
def check_retry_num(self, retry_num):
|
||||
correct_num = self.draft_editor_llm.config.correct_num # type: ignore[attr-defined]
|
||||
def check_retry_num(self, retry_num: int) -> bool:
|
||||
correct_num = self.draft_editor_llm.config.correct_num
|
||||
return correct_num < retry_num
|
||||
|
||||
def correct_edit(
|
||||
|
||||
Reference in New Issue
Block a user