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

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy