You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #430, it seems the Client().create() method does not accept some modelfile argument for model creation. The example code provided in examples' readme does not actually use a Modelfil.
Posting this here for reference, since a few issues (#430, #431, this one) circle back to the same confusion and the examples/create.py in the repo only shows a tiny slice of it. I ran into the same thing. The short version: modelfile= was removed in #430 (instead create() now takes the Modelfile apart into separate arguments, one per directive) The example in examples/create.py is pretty minimal (just from_ + system).
The mapping is basically:
FROM → from_
SYSTEM → system
TEMPLATE → template
PARAMETER → parameters (as a dict)
LICENSE → license
MESSAGE → messages
So instead of writing a Modelfile like this:
FROM gemma3
SYSTEM You are Mario from Super Mario Bros.
TEMPLATE "{{ .System }} {{ .Prompt }}"
PARAMETER temperature 0.6
PARAMETER stop <end_of_turn>
MESSAGE user Who are you?
MESSAGE assistant It's-a me, Mario!
LICENSE MIT
one can write:
fromollamaimportClientclient=Client()
response=client.create(
model='my-assistant',
from_='gemma3',
system='You are Mario from Super Mario Bros.',
template='{{ .System }} {{ .Prompt }}',
parameters={'temperature': 0.6, 'stop': ['<end_of_turn>']},
messages=[
{'role': 'user', 'content': 'Who are you?'},
{'role': 'assistant', 'content': "It's-a me, Mario!"},
],
license='MIT',
stream=False,
)
print(response.status) # 'success'
Running ollama show my-assistant --modelfile afterwards shows every directive applied.
And for the GGUF-import case (more relevant to #431): create() takes blob digests rather than file paths, so upload the file first with create_blob() and pass the digest through files=:
Activity
jhaveri-bhavya commentedon Sep 6, 2026
Posting this here for reference, since a few issues (#430, #431, this one) circle back to the same confusion and the
examples/create.pyin the repo only shows a tiny slice of it. I ran into the same thing. The short version:modelfile=was removed in #430 (insteadcreate()now takes the Modelfile apart into separate arguments, one per directive) The example inexamples/create.pyis pretty minimal (justfrom_+system).The mapping is basically:
FROM→from_SYSTEM→systemTEMPLATE→templatePARAMETER→parameters(as a dict)LICENSE→licenseMESSAGE→messagesSo instead of writing a Modelfile like this:
one can write:
Running
ollama show my-assistant --modelfileafterwards shows every directive applied.And for the GGUF-import case (more relevant to #431):
create()takes blob digests rather than file paths, so upload the file first withcreate_blob()and pass the digest throughfiles=:Might be worth expanding
examples/create.pyto cover more.examples: show full Modelfile surface in create.py, add create-gguf.py