Content-Length: 259836 | pFad | http://github.com/stacklok/codegate/commit/02d218b547c301a8833ae77507f87c8f6419e9b9

0C Fix Anthropic serialization bug. (#1338) · stacklok/codegate@02d218b · GitHub
Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

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

Lines changed: 1 addition & 1 deletion
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/stacklok/codegate/commit/02d218b547c301a8833ae77507f87c8f6419e9b9

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy