From d543b282a7c3bc59720744d7d3ad7a9d7df8744c Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sat, 30 Nov 2024 14:05:50 -0800 Subject: [PATCH] server: add warning message for deprecated context field (#7878) --- docs/api.md | 2 +- server/routes.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 9fd875902..5353261ac 100644 --- a/docs/api.md +++ b/docs/api.md @@ -49,10 +49,10 @@ Advanced parameters (optional): - `options`: additional model parameters listed in the documentation for the [Modelfile](./modelfile.md#valid-parameters-and-values) such as `temperature` - `system`: system message to (overrides what is defined in the `Modelfile`) - `template`: the prompt template to use (overrides what is defined in the `Modelfile`) -- `context`: the context parameter returned from a previous request to `/generate`, this can be used to keep a short conversational memory - `stream`: if `false` the response will be returned as a single response object, rather than a stream of objects - `raw`: if `true` no formatting will be applied to the prompt. You may choose to use the `raw` parameter if you are specifying a full templated prompt in your request to the API - `keep_alive`: controls how long the model will stay loaded into memory following the request (default: `5m`) +- `context` (deprecated): the context parameter returned from a previous request to `/generate`, this can be used to keep a short conversational memory #### JSON mode diff --git a/server/routes.go b/server/routes.go index edf1f4c51..b8980a65e 100644 --- a/server/routes.go +++ b/server/routes.go @@ -251,6 +251,7 @@ func (s *Server) GenerateHandler(c *gin.Context) { var b bytes.Buffer if req.Context != nil { + slog.Warn("the context field is deprecated and will be removed in a future version of Ollama") s, err := r.Detokenize(c.Request.Context(), req.Context) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})