Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,33 @@ def __init__(
top_k: Optional[float] = None,
stop: Optional[List[str]] = None,
) -> None:
locals_ = locals().copy()
for key, value in locals_.items():
if key != "self" and value is not None:
# Use local variables passed to __init__, excluding "self" and None values
# Assign directly to class attributes for all non-None args
# NOTE: Preserving behavioral: class-level storage
for key, value in (
("max_tokens", max_tokens),
("temperature", temperature),
("top_p", top_p),
("top_k", top_k),
("stop", stop),
):
if value is not None:
setattr(self.__class__, key, value)

AmazonInvokeConfig.__init__(self)

@classmethod
def get_config(cls):
excluded_types = (
types.FunctionType,
types.BuiltinFunctionType,
classmethod,
staticmethod,
)
return {
k: v
for k, v in cls.__dict__.items()
if not k.startswith("__")
and not k.startswith("_abc")
and not isinstance(
v,
(
types.FunctionType,
types.BuiltinFunctionType,
classmethod,
staticmethod,
),
)
and v is not None
if not k.startswith("__") and not k.startswith("_abc") and type(v) not in excluded_types and v is not None
}

def get_supported_openai_params(self, model: str) -> List[str]:
Expand Down