_serialize_multipartform() — anthropic-sdk-python Function Reference
Architecture documentation for the _serialize_multipartform() function in _base_client.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 0a2c9ce8_a659_23ba_622c_074027fb8d75["_serialize_multipartform()"] 842ce0be_ea56_b939_960f_13eb61230daf["BaseClient"] 0a2c9ce8_a659_23ba_622c_074027fb8d75 -->|defined in| 842ce0be_ea56_b939_960f_13eb61230daf c1255cc8_bc9d_85e2_d7e7_d99e63ebb389["_build_request()"] c1255cc8_bc9d_85e2_d7e7_d99e63ebb389 -->|calls| 0a2c9ce8_a659_23ba_622c_074027fb8d75 a4465198_32b8_125c_a12b_a1f3510b8955["stringify_items()"] 0a2c9ce8_a659_23ba_622c_074027fb8d75 -->|calls| a4465198_32b8_125c_a12b_a1f3510b8955 afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7["get()"] 0a2c9ce8_a659_23ba_622c_074027fb8d75 -->|calls| afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7 style 0a2c9ce8_a659_23ba_622c_074027fb8d75 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_base_client.py lines 594–622
def _serialize_multipartform(self, data: Mapping[object, object]) -> dict[str, object]:
items = self.qs.stringify_items(
# TODO: type ignore is required as stringify_items is well typed but we can't be
# well typed without heavy validation.
data, # type: ignore
array_format="brackets",
)
serialized: dict[str, object] = {}
for key, value in items:
existing = serialized.get(key)
if not existing:
serialized[key] = value
continue
# If a value has already been set for this key then that
# means we're sending data like `array[]=[1, 2, 3]` and we
# need to tell httpx that we want to send multiple values with
# the same key which is done by using a list or a tuple.
#
# Note: 2d arrays should never result in the same key at both
# levels so it's safe to assume that if the value is a list,
# it was because we changed it to be a list.
if is_list(existing):
existing.append(value)
else:
serialized[key] = [existing, value]
return serialized
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does _serialize_multipartform() do?
_serialize_multipartform() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is _serialize_multipartform() defined?
_serialize_multipartform() is defined in src/anthropic/_base_client.py at line 594.
What does _serialize_multipartform() call?
_serialize_multipartform() calls 2 function(s): get, stringify_items.
What calls _serialize_multipartform()?
_serialize_multipartform() is called by 1 function(s): _build_request.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free