🙌 OpenHands: AI-Driven Development
feat: Support seed parameter (#7441)
மனோஜ்குமார் பழனிச்சாமி2518901e6e4e
diff --git a/README.md b/README.mdindex 282f0712e5..df88aa233a 100644--- a/README.md+++ b/README.md@@ -48,6 +48,7 @@ docker pull docker.all-hands.dev/all-hands-ai/runtime:0.29-nikolaikdocker run -it --rm --pull=always \-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.29-nikolaik \-e LOG_ALL_EVENTS=true \+ -e LLM_SEED=42 \-v /var/run/docker.sock:/var/run/docker.sock \-v ~/.openhands-state:/.openhands-state \-p 3000:3000 \diff --git a/openhands/core/config/llm_config.py b/openhands/core/config/llm_config.pyindex 060592e725..ae6742cacd 100644--- a/openhands/core/config/llm_config.py+++ b/openhands/core/config/llm_config.py@@ -43,6 +43,7 @@ class LLMConfig(BaseModel):custom_tokenizer: A custom tokenizer to use for token counting.native_tool_calling: Whether to use native tool calling if supported by the model. Can be True, False, or not set.reasoning_effort: The effort to put into reasoning. This is a string that can be one of 'low', 'medium', 'high', or 'none'. Exclusive for o1 models.+ seed: The seed to use for the LLM."""model: str = Field(default='claude-3-7-sonnet-20250219')@@ -82,6 +83,7 @@ class LLMConfig(BaseModel):custom_tokenizer: str | None = Field(default=None)native_tool_calling: bool | None = Field(default=None)reasoning_effort: str | None = Field(default='high')+ seed: int | None = Field(default=None)model_config = {'extra': 'forbid'}diff --git a/openhands/llm/async_llm.py b/openhands/llm/async_llm.pyindex 805240c2b1..a9a9224a9b 100644--- a/openhands/llm/async_llm.py+++ b/openhands/llm/async_llm.py@@ -34,6 +34,7 @@ class AsyncLLM(LLM):temperature=self.config.temperature,top_p=self.config.top_p,drop_params=self.config.drop_params,+ seed=self.config.seed,)async_completion_unwrapped = self._async_completiondiff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex bfc0a22fea..98a736da89 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -165,6 +165,7 @@ class LLM(RetryMixin, DebugMixin):timeout=self.config.timeout,top_p=self.config.top_p,drop_params=self.config.drop_params,+ seed=self.config.seed,**kwargs,)