[PR #7659] [MERGED] runner.go: Don't trim whitespace from inputs #38352

Closed
opened 2026-04-22 23:00:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/7659
Author: @jessegross
Created: 11/14/2024
Status: Merged
Merged: 11/14/2024
Merged by: @jessegross

Base: mainHead: jessegross/whitespace


📝 Commits (1)

  • e84cdc2 runner.go: Don't trim whitespace from inputs

📊 Changes

1 file changed (+6 additions, -8 deletions)

View changed files

📝 llama/runner/runner.go (+6 -8)

📄 Description

It's possible to get prompts that consist entirely of whitespace - this is most likely to happen when generating embeddings. Currently, we will trim this away, leaving an empty prompt, which will then generate an error.

Generating embeddings from whitespace should not trigger an error, as this may break pipelines. It's better to just leave the whitespace in place and process what we are given. This is consistent with past versions of Ollama.

Bug #7578


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/7659 **Author:** [@jessegross](https://github.com/jessegross) **Created:** 11/14/2024 **Status:** ✅ Merged **Merged:** 11/14/2024 **Merged by:** [@jessegross](https://github.com/jessegross) **Base:** `main` ← **Head:** `jessegross/whitespace` --- ### 📝 Commits (1) - [`e84cdc2`](https://github.com/ollama/ollama/commit/e84cdc2b750163ebd1c2a0279e151c2efd357775) runner.go: Don't trim whitespace from inputs ### 📊 Changes **1 file changed** (+6 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `llama/runner/runner.go` (+6 -8) </details> ### 📄 Description It's possible to get prompts that consist entirely of whitespace - this is most likely to happen when generating embeddings. Currently, we will trim this away, leaving an empty prompt, which will then generate an error. Generating embeddings from whitespace should not trigger an error, as this may break pipelines. It's better to just leave the whitespace in place and process what we are given. This is consistent with past versions of Ollama. Bug #7578 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-22 23:00:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#38352