Skip to content

examples: show full Modelfile surface in create.py, add create-gguf.py - #730

Open
jhaveri-bhavya wants to merge 1 commit into
ollama:mainfrom
jhaveri-bhavya:examples-create-directives
Open

jhaveri-bhavya wants to merge 1 commit into
ollama:mainfrom
jhaveri-bhavya:examples-create-directives

Conversation

@jhaveri-bhavya

@jhaveri-bhavya jhaveri-bhavya commented Sep 6, 2026

Copy link
Copy Markdown

Closes #664
Refs #431

examples/create.py only sets from_ and system. Since the raw modelfile= string was removed in #430, that thin example is probably what leads people to think create() can't build a real Modelfile (see #664, and the GGUF-import confusion in #431).

Changes:

  • create.py: also pass template, parameters, messages and license, with a short comment mapping each kwarg to its Modelfile directive.
  • create-gguf.py (new): the weights-import path — create_blob() to upload, then files= with the returned digest.
  • README.md: retitle the section and list the new example.

Examples only, no library changes. Ran both scripts against a local ollama serve; ollama show my-assistant --modelfile afterwards lists FROM/SYSTEM/TEMPLATE/PARAMETER/MESSAGE/LICENSE as set.

create.py only set from_ and system, which makes it look like create()
can't express a full Modelfile. Expand it to cover template, parameters,
messages and license too, with a comment mapping each kwarg to its
Modelfile directive.

Add create-gguf.py for the weights-import path: upload the file with
create_blob() and pass the returned digest through files=.

Refs ollama#664, ollama#431
@jhaveri-bhavya
jhaveri-bhavya force-pushed the examples-create-directives branch from c451b17 to 8f13b47 Compare September 17, 2026 12:33
@jhaveri-bhavya

Copy link
Copy Markdown
Author

Greeting @ParthSareen:
this is rebased on top of main (picked up the gemma4 rename from #740, which had conflicted with this branch) and lint/format checks pass. Ready for review whenever you get a chance.

For context: this expands examples/create.py to cover the full Modelfile directive surface (template, parameters, messages, license, not just from_/system) and adds examples/create-gguf.py showing the create_blob() + files= import path, per the discussion in #664 / #431.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a model using Modelfile

1 participant