yamlartificial-intelligencechatbotollama

Error: "command must be one of 'from', 'license', 'template', 'system', 'adapter', 'parameter', or 'message'" when creating a custom model in Ollama


I'm trying to create a custom model using Ollama, but when I run the following command:

ollama create my-custom-model

I get the following error message:

Error: (line 1): command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message"

I’ve followed the instructions and created a Modelfile that looks like this:

from: llama3.2:latest
license: open
system: |
  You are AdelBot, a friendly chatbot designed by Adel. Your responses are concise and include emojis for clarity and fun! 😊✨
message:
  - role: user
    content: Who are you?
  - role: assistant
    content: I'm AdelBot, here to assist you with clear and concise answers. 🚀

However, I’m still getting the same error.
Can someone help me understand why the error is happening and how to fix it?

Things I’ve Tried:


Solution

  • I've also had a same issue, where I tried to pass a message after keyword system and it was not a single line. So I have completely encoded the prompt inside triple quotes(""" complete prompt """) Also I have started my prompt in a same line next to keyword System.

    You can try adding the message like below.

    from: llama3.2:latest
    license: open
    system: """ You are AdelBot, a friendly chatbot designed by Adel. Your responses are concise and include emojis for clarity and fun! 😊✨ """
    message:
      - role: user
        content: Who are you?
      - role: assistant
        content: I'm AdelBot, here to assist you with clear and concise answers. 🚀
    

    I have enclosed text in triple quotes or you can try having it in a single line as prompt was small.

    I have used java library and faced same issue. This quotes resolved my issue. Hope it helps!