in src/smolagents/models.py [0:0]
def to_dict(self) -> dict:
"""
Converts the model into a JSON-compatible dictionary.
"""
model_dictionary = {
**self.kwargs,
"model_id": self.model_id,
}
for attribute in [
"custom_role_conversion",
"temperature",
"max_tokens",
"provider",
"timeout",
"api_base",
"torch_dtype",
"device_map",
"organization",
"project",
"azure_endpoint",
]:
if hasattr(self, attribute):
model_dictionary[attribute] = getattr(self, attribute)
dangerous_attributes = ["token", "api_key"]
for attribute_name in dangerous_attributes:
if hasattr(self, attribute_name):
print(
f"For security reasons, we do not export the `{attribute_name}` attribute of your model. Please export it manually."
)
return model_dictionary