Skip to content

Commit 02d218b

Browse files
authored
Fix Anthropic serialization bug. (#1338)
Excluding defaults caused `tool_choice` to become an empty dictionary in case `{"type": "auto"}` was explicitly provider by the client. Also, we were using the wrong method.
1 parent 84a675c commit 02d218b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codegate/types/anthropic/_generators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async def acompletion(request, api_key, base_url):
117117
"accept": "application/json",
118118
"content-type": "application/json",
119119
}
120-
payload = request.json(exclude_defaults=True)
120+
payload = request.model_dump_json(exclude_none=True, exclude_unset=True)
121121

122122
if os.getenv("CODEGATE_DEBUG_ANTHROPIC") is not None:
123123
print(payload)

0 commit comments

Comments
 (0)