diff --git a/docs/modelfile.md b/docs/modelfile.md index 47386b67..37d9b5b1 100644 --- a/docs/modelfile.md +++ b/docs/modelfile.md @@ -125,11 +125,11 @@ PARAMETER #### Template Variables -| Variable | Description | -| --------------- | ------------------------------------------------------------------------------------------------------------ | -| `{{ .System }}` | The system prompt used to specify custom behavior, this must also be set in the Modelfile as an instruction. | -| `{{ .Prompt }}` | The incoming prompt, this is not specified in the model file and will be set based on input. | -| `{{ .First }}` | A boolean value used to render specific template information for the first generation of a session. | +| Variable | Description | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------ | +| `{{ .System }}` | The system prompt used to specify custom behavior, this must also be set in the Modelfile as an instruction. | +| `{{ .Prompt }}` or `{{ .User }}` | The incoming prompt from the user, this is not specified in the model file and will be set based on input. | +| `{{ .First }}` | A boolean value used to render specific template information for the first generation of a session. | ```modelfile TEMPLATE """ diff --git a/server/images.go b/server/images.go index 49142148..dae82012 100644 --- a/server/images.go +++ b/server/images.go @@ -50,7 +50,8 @@ type Model struct { type PromptVars struct { System string - Prompt string + Prompt string // prompt and user are considered the same thing + User string } func (m *Model) Prompt(vars *PromptVars) (string, error) { diff --git a/server/routes.go b/server/routes.go index 8c95f158..8d9f1957 100644 --- a/server/routes.go +++ b/server/routes.go @@ -321,6 +321,7 @@ func promptFromRequestParams(c *gin.Context, model *Model, req api.GenerateReque p, err := model.Prompt(&PromptVars{ System: req.System, Prompt: req.Prompt, + User: req.Prompt, }) if err != nil { return "", err @@ -340,6 +341,7 @@ func promptFromMessages(model *Model, messages []api.Message) (string, error) { prompt.WriteString(p) vars.Prompt = "" + vars.User = "" vars.System = "" return nil } @@ -364,6 +366,7 @@ func promptFromMessages(model *Model, messages []api.Message) (string, error) { vars.System = m.Content case "user": vars.Prompt = m.Content + vars.User = m.Content case "assistant": prompt.WriteString(m.Content) default: