feat: Support seed parameter (#7441)

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி 2025-03-24 23:48:00 +05:30 committed by GitHub
parent e639283ac9
commit 2518901e6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,7 @@ docker pull docker.all-hands.dev/all-hands-ai/runtime:0.29-nikolaik
docker 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 \

View File

@ -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'}

View File

@ -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_completion

View File

@ -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,
)