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

examples: show full Modelfile surface in create.py, add create-gguf.py#730
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
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