mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Azure completion_tokens fix (take two) (#6975)
This commit is contained in:
parent
7ea418d020
commit
8b234ae57c
@ -137,6 +137,7 @@ class LLM(RetryMixin, DebugMixin):
|
||||
# set up the completion function
|
||||
kwargs: dict[str, Any] = {
|
||||
'temperature': self.config.temperature,
|
||||
'max_completion_tokens': self.config.max_output_tokens,
|
||||
}
|
||||
if (
|
||||
self.config.model.lower() in REASONING_EFFORT_SUPPORTED_MODELS
|
||||
@ -146,6 +147,10 @@ class LLM(RetryMixin, DebugMixin):
|
||||
kwargs.pop(
|
||||
'temperature'
|
||||
) # temperature is not supported for reasoning models
|
||||
# Azure issue: https://github.com/All-Hands-AI/OpenHands/issues/6777
|
||||
if self.config.model.startswith('azure'):
|
||||
kwargs['max_tokens'] = self.config.max_output_tokens
|
||||
kwargs.pop('max_completion_tokens')
|
||||
|
||||
self._completion = partial(
|
||||
litellm_completion,
|
||||
@ -156,7 +161,6 @@ 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_completion_tokens=self.config.max_output_tokens,
|
||||
timeout=self.config.timeout,
|
||||
top_p=self.config.top_p,
|
||||
drop_params=self.config.drop_params,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user