mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(base_llm): filter all _-prefixed class attrs from get_config
The drop_params strip work added `AnthropicConfig._EFFORT_SUPPORTING_MODEL_PATTERNS` as a private class-level lookup tuple. `BaseConfig.get_config()` only filtered the `__`-prefixed names plus `_abc` / `_is_base_class`, so `_EFFORT_SUPPORTING_MODEL_PATTERNS` would have leaked into the request body the same way `REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT` did before the previous commit. Generalize the existing `_abc` / `_is_base_class` carve-outs to skip every `_`-prefixed name. `AmazonConverseConfig.get_config()` overrides the base method, so apply the same change there. Also unblocks future internal helpers from accidentally serialising into the wire body.
This commit is contained in:
parent
09d37db8d9
commit
e780a7c1dc
2 changed files with 10 additions and 4 deletions
|
|
@ -84,12 +84,16 @@ class BaseConfig(ABC):
|
|||
|
||||
@classmethod
|
||||
def get_config(cls):
|
||||
# Subclasses lean on this to surface their public default settings
|
||||
# (e.g. ``max_tokens``) as request params. Anything ``_``-prefixed is
|
||||
# treated as private (lookup tables, ABC machinery, internal flags)
|
||||
# and must not leak into the wire body — a tuple/dict/frozenset class
|
||||
# attribute would otherwise serialise into the request as an extra
|
||||
# top-level key and the provider would 400 it.
|
||||
return {
|
||||
k: v
|
||||
for k, v in cls.__dict__.items()
|
||||
if not k.startswith("__")
|
||||
and not k.startswith("_abc")
|
||||
and not k.startswith("_is_base_class")
|
||||
if not k.startswith("_")
|
||||
and not isinstance(
|
||||
v,
|
||||
(
|
||||
|
|
|
|||
|
|
@ -189,10 +189,12 @@ class AmazonConverseConfig(BaseConfig):
|
|||
|
||||
@classmethod
|
||||
def get_config(cls):
|
||||
# ``_``-prefixed names are private (lookup tables, ABC machinery,
|
||||
# internal flags) and must not leak into the wire body.
|
||||
return {
|
||||
k: v
|
||||
for k, v in cls.__dict__.items()
|
||||
if not k.startswith("__")
|
||||
if not k.startswith("_")
|
||||
and not isinstance(
|
||||
v,
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue