Browse Source

Warn user on truncation - ollama logs

ParthSareen 4 months ago
parent
commit
c9a46140e6
1 changed files with 4 additions and 0 deletions
  1. 4 0
      server/prompt.go

+ 4 - 0
server/prompt.go

@@ -82,6 +82,10 @@ func chatPrompt(ctx context.Context, m *Model, tokenize tokenizeFunc, opts *api.
 	}
 
 	currMsgIdx := n
+	// Warn user if messages are truncated from the input
+	if numTruncatedMessages := len(msgs[0:currMsgIdx]); numTruncatedMessages > 0 {
+		slog.Warn("truncated first messages from input", "num_truncated", numTruncatedMessages)
+	}
 
 	for cnt, msg := range msgs[currMsgIdx:] {
 		prefix := ""