From bee11029f72345a49e10f46c37eab989f3c4c8ca Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Sun, 12 Jan 2025 23:19:44 -0800 Subject: [PATCH] Model serializer to handler `from` keyword --- ollama/_types.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ollama/_types.py b/ollama/_types.py index cfcafe6..76a6174 100644 --- a/ollama/_types.py +++ b/ollama/_types.py @@ -401,6 +401,13 @@ class PushRequest(BaseStreamableRequest): class CreateRequest(BaseStreamableRequest): + @model_serializer + def serialize_model(self): + output = {k: v for k, v in self.__dict__.items() if v is not None} + if 'from_' in output: + output['from'] = output.pop('from_') + return output + """ Request to create a new model. """