mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
[feat] support o3-mini (#6570)
This commit is contained in:
parent
6d62be518b
commit
622fc5213d
@ -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 ourselves
|
||||
|
||||
@ -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'}
|
||||
|
||||
|
||||
@ -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._completion
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user