feat: support Claude 4 Interleaved thinking (beta) (#164)

This commit is contained in:
heisenbergye
2025-07-21 16:44:21 +08:00
committed by GitHub
parent 76a3614f17
commit 3f1b56a526
5 changed files with 115 additions and 3 deletions

View File

@@ -567,6 +567,10 @@ class BedrockModel(BaseChatModel):
assert "function" in chat_request.tool_choice
tool_config["toolChoice"] = {"tool": {"name": chat_request.tool_choice["function"].get("name", "")}}
args["toolConfig"] = tool_config
# add Additional fields to enable extend thinking
if chat_request.extra_body:
# reasoning_config will not be used
args["additionalModelRequestFields"] = chat_request.extra_body
return args
def _create_response(

View File

@@ -107,6 +107,7 @@ class ChatRequest(BaseModel):
tools: list[Tool] | None = None
tool_choice: str | object = "auto"
stop: list[str] | str | None = None
extra_body: dict | None = None
class Usage(BaseModel):