Skip to content

Commit bee1102

Browse files
committed
Model serializer to handler from keyword
1 parent 427b0c6 commit bee1102

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ollama/_types.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,13 @@ class PushRequest(BaseStreamableRequest):
401401

402402

403403
class CreateRequest(BaseStreamableRequest):
404+
@model_serializer
405+
def serialize_model(self):
406+
output = {k: v for k, v in self.__dict__.items() if v is not None}
407+
if 'from_' in output:
408+
output['from'] = output.pop('from_')
409+
return output
410+
404411
"""
405412
Request to create a new model.
406413
"""

0 commit comments

Comments
 (0)