40 lines
949 B
Markdown
40 lines
949 B
Markdown
|
|
|||
|
Start: https://github.com/ollama/ollama?tab=readme-ov-file
|
|||
|
|
|||
|
Main docs: https://github.com/ollama/ollama/blob/main/docs/modelfile.md
|
|||
|
|
|||
|
|
|||
|
### Customize a prompt
|
|||
|
|
|||
|
|
|||
|
Models from the Ollama library can be customized with a prompt. For example, to customize the `llama3` model:
|
|||
|
|
|||
|
```
|
|||
|
ollama pull llama3
|
|||
|
```
|
|||
|
|
|||
|
Create a `Modelfile`:
|
|||
|
|
|||
|
```
|
|||
|
FROM llama3
|
|||
|
|
|||
|
# set the temperature to 1 [higher is more creative, lower is more coherent]
|
|||
|
PARAMETER temperature 1
|
|||
|
|
|||
|
# set the system message
|
|||
|
SYSTEM """
|
|||
|
You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.
|
|||
|
"""
|
|||
|
```
|
|||
|
|
|||
|
Next, create and run the model:
|
|||
|
|
|||
|
```
|
|||
|
ollama create mario -f ./Modelfile
|
|||
|
ollama run mario
|
|||
|
>>> hi
|
|||
|
Hello! It's your friend Mario.
|
|||
|
```
|
|||
|
|
|||
|
For more examples, see the [examples](https://github.com/ollama/ollama/blob/main/examples) directory. For more information on working with a Modelfile, see the [Modelfile](https://github.com/ollama/ollama/blob/main/docs/modelfile.md) documentation.
|