π OpenHands: AI-Driven Development
[feat] support o3-mini (#6570)
Xingyao Wang622fc5213d9a
diff --git a/frontend/src/utils/verified-models.ts b/frontend/src/utils/verified-models.tsindex da77b25e1c..29b65b883a 100644--- a/frontend/src/utils/verified-models.ts+++ b/frontend/src/utils/verified-models.ts@@ -1,7 +1,7 @@// Here are the list of verified models and providers that we know work well with OpenHands.export const VERIFIED_PROVIDERS = ["openai", "azure", "anthropic", "deepseek"];export const VERIFIED_MODELS = [- "gpt-4o",+ "o3-mini-2025-01-31","claude-3-5-sonnet-20241022","deepseek-chat",];@@ -16,6 +16,8 @@ export const VERIFIED_OPENAI_MODELS = ["gpt-4-32k","o1-mini","o1-preview",+ "o3-mini",+ "o3-mini-2025-01-31",];// LiteLLM does not return the compatible Anthropic models with the provider, so we list them here to set them ourselvesdiff --git a/openhands/core/config/llm_config.py b/openhands/core/config/llm_config.pyindex 9beb6d6f5f..cb1581634d 100644--- a/openhands/core/config/llm_config.py+++ b/openhands/core/config/llm_config.py@@ -85,7 +85,7 @@ class LLMConfig(BaseModel):log_completions_folder: str = Field(default=os.path.join(LOG_DIR, 'completions'))custom_tokenizer: str | None = Field(default=None)native_tool_calling: bool | None = Field(default=None)- reasoning_effort: str | None = Field(default=None)+ reasoning_effort: str | None = Field(default='high')model_config = {'extra': 'forbid'}diff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex 8c64ed62d5..34124a479d 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -71,6 +71,8 @@ FUNCTION_CALLING_SUPPORTED_MODELS = ['gpt-4o-mini','gpt-4o','o1-2024-12-17',+ 'o3-mini-2025-01-31',+ 'o3-mini',]# visual browsing tool supported models@@ -85,6 +87,9 @@ VISUAL_BROWSING_TOOL_SUPPORTED_MODELS = [REASONING_EFFORT_SUPPORTED_MODELS = ['o1-2024-12-17',+ 'o1',+ 'o3-mini-2025-01-31',+ 'o3-mini',]MODELS_WITHOUT_STOP_WORDS = [@@ -149,6 +154,18 @@ class LLM(RetryMixin, DebugMixin):self.tokenizer = None# set up the completion function+ kwargs: dict[str, Any] = {+ 'temperature': self.config.temperature,+ }+ if (+ self.config.model.lower() in REASONING_EFFORT_SUPPORTED_MODELS+ or self.config.model.split('/')[-1] in REASONING_EFFORT_SUPPORTED_MODELS+ ):+ kwargs['reasoning_effort'] = self.config.reasoning_effort+ kwargs.pop(+ 'temperature'+ ) # temperature is not supported for reasoning models+self._completion = partial(litellm_completion,model=self.config.model,@@ -158,17 +175,11 @@ class LLM(RetryMixin, DebugMixin):base_url=self.config.base_url,api_version=self.config.api_version,custom_llm_provider=self.config.custom_llm_provider,- max_tokens=self.config.max_output_tokens,+ max_completion_tokens=self.config.max_output_tokens,timeout=self.config.timeout,- temperature=self.config.temperature,top_p=self.config.top_p,drop_params=self.config.drop_params,- # add reasoning_effort, only if the model is supported- **(- {'reasoning_effort': self.config.reasoning_effort}- if self.config.model.lower() in REASONING_EFFORT_SUPPORTED_MODELS- else {}- ),+ **kwargs,)self._completion_unwrapped = self._completiondiff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2index 746165cae0..ef073a6a7a 100644--- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2+++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2@@ -61,7 +61,8 @@ RUN if [ -z "${RELEASE_TAG}" ]; then \fi && \wget https://github.com/${RELEASE_ORG}/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \- mv -f ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \+ if [ -d "${OPENVSCODE_SERVER_ROOT}" ]; then rm -rf "${OPENVSCODE_SERVER_ROOT}"; fi && \+ mv ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz && \# Install our custom extension