From ed567a7bb7a9c5019be46fa3e55e52a215a9fd9f Mon Sep 17 00:00:00 2001 From: Pham Tu Date: Tue, 29 Apr 2025 11:10:38 +0700 Subject: [PATCH] add token efficient tools support for claude 3.7 --- openhands/llm/llm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openhands/llm/llm.py b/openhands/llm/llm.py index b63a3d895248..7642c7c2fe97 100644 --- a/openhands/llm/llm.py +++ b/openhands/llm/llm.py @@ -171,6 +171,10 @@ def __init__( kwargs['max_tokens'] = self.config.max_output_tokens kwargs.pop('max_completion_tokens') + # Token efficient tools for claude-3-7-sonnet-20250219: https://docs.anthropic.com/en/docs/build-with-claude/tool-use/token-efficient-tool-use + if self.config.model == 'claude-3-7-sonnet-20250219': + kwargs['anthropic-beta'] = 'token-efficient-tools-2025-02-19' + self._completion = partial( litellm_completion, model=self.config.model,