[PR #1539] [MERGED] feat: add {{prompt:start:length}} and {{prompt:end:length}} to title gen #7495

Closed
opened 2025-11-11 17:28:17 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/1539
Author: @cheahjs
Created: 4/13/2024
Status: Merged
Merged: 4/14/2024
Merged by: @tjbck

Base: devHead: feat/customizable-title-prompt-length


📝 Commits (4)

  • db817fc feat: add {{prompt:start:length}} and {{prompt:end:length}} to title gen
  • fffd42e fix: replace all instances of prompt:start and prompt:end
  • a938ffb Merge branch 'dev' into feat/customizable-title-prompt-length
  • 0c441b5 refac: naming convention

📊 Changes

3 files changed (+31 additions, -2 deletions)

View changed files

📝 src/lib/apis/ollama/index.ts (+2 -1)
📝 src/lib/apis/openai/index.ts (+2 -1)
📝 src/lib/utils/index.ts (+27 -0)

📄 Description

Pull Request Checklist

  • Description: Briefly describe the changes in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?

Description

Adds support for specifying a subset of the start and end of prompt for title generation. For example, the following title generation prompt uses the first and last 4096 characters of the prompt:

Create a concise, 3-5 word phrase with an emoji as a header for the following query.
Do not use the word title.
Do not use any formatting.
Examples of titles:
😢 Sad Story
🎂 How To Bake A Cake
✉️ Email Draft
💻 Programming Help

Here is the first 4096 characters of the query:
{{prompt:start:4096}}

Here is the last 4096 characters of the query:
{{prompt:end:4096}}

Rationale for this is when using models with mismatched context windows, which breaks when the shorter window model is used for generating the title. For example, in my use case, I'm using Gemini 1.5 Pro as the main model, and using the cheaper Claude 3 Haiku model for title generation, but any chats exceeding Claude's context window would fail. This makes the assumption that most instructions relevant to title generation will be either at the start or end of the prompt.


Changelog Entry

Added

  • Enhanced Title Generation: Added support for using subsets of the prompt for title generation, allowing for more flexibility and control.

🔄 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/open-webui/open-webui/pull/1539 **Author:** [@cheahjs](https://github.com/cheahjs) **Created:** 4/13/2024 **Status:** ✅ Merged **Merged:** 4/14/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `feat/customizable-title-prompt-length` --- ### 📝 Commits (4) - [`db817fc`](https://github.com/open-webui/open-webui/commit/db817fcf29cdeede00244c8eb8bbbc726fdf4b39) feat: add {{prompt:start:length}} and {{prompt:end:length}} to title gen - [`fffd42e`](https://github.com/open-webui/open-webui/commit/fffd42e4d782b37fe7771d9aaa4ff8653b79c88b) fix: replace all instances of prompt:start and prompt:end - [`a938ffb`](https://github.com/open-webui/open-webui/commit/a938ffb5866711f39e9149c39a15d6e15255a79a) Merge branch 'dev' into feat/customizable-title-prompt-length - [`0c441b5`](https://github.com/open-webui/open-webui/commit/0c441b588c2414e96e522476164d7889140b3dbd) refac: naming convention ### 📊 Changes **3 files changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/apis/ollama/index.ts` (+2 -1) 📝 `src/lib/apis/openai/index.ts` (+2 -1) 📝 `src/lib/utils/index.ts` (+27 -0) </details> ### 📄 Description ## Pull Request Checklist - [x] **Description:** Briefly describe the changes in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? --- ## Description Adds support for specifying a subset of the start and end of prompt for title generation. For example, the following title generation prompt uses the first and last 4096 characters of the prompt: ``` Create a concise, 3-5 word phrase with an emoji as a header for the following query. Do not use the word title. Do not use any formatting. Examples of titles: 😢 Sad Story 🎂 How To Bake A Cake ✉️ Email Draft 💻 Programming Help Here is the first 4096 characters of the query: {{prompt:start:4096}} Here is the last 4096 characters of the query: {{prompt:end:4096}} ``` Rationale for this is when using models with mismatched context windows, which breaks when the shorter window model is used for generating the title. For example, in my use case, I'm using Gemini 1.5 Pro as the main model, and using the cheaper Claude 3 Haiku model for title generation, but any chats exceeding Claude's context window would fail. This makes the assumption that most instructions relevant to title generation will be either at the start or end of the prompt. --- ### Changelog Entry ### Added - ✨ **Enhanced Title Generation**: Added support for using subsets of the prompt for title generation, allowing for more flexibility and control. --- <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 2025-11-11 17:28:17 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#7495