[PR #2356] [CLOSED] fix: Add JSON instruction to default text tagging prompt before content insertion #2082

Closed
opened 2026-03-02 12:00:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/karakeep-app/karakeep/pull/2356
Author: @ElectricTea
Created: 1/6/2026
Status: Closed

Base: mainHead: patch-3


📝 Commits (1)

  • 84106e1 fix: Add JSON instruction to default text tagging prompt before content insertion

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 packages/shared/prompts.ts (+1 -0)

📄 Description

Added the prompt instruction

- You must respond in valid JSON with the key "tags" and the value is list of tags. Don't wrap the response in a markdown code.

to the default text tagging instructions before the content insertion. This change significantly improves the success rate of a response containing structured JSON when a prompt is truncated by the LLM due to the prompt exceeding a maximum token limit.

I kept the original JSON instruction at the end of the prompt because it "reminds" the LLM to use JSON structure after the content insertion, and it causes no issues.


🔄 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/karakeep-app/karakeep/pull/2356 **Author:** [@ElectricTea](https://github.com/ElectricTea) **Created:** 1/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `patch-3` --- ### 📝 Commits (1) - [`84106e1`](https://github.com/karakeep-app/karakeep/commit/84106e1a060ebe5f97c35a83526588f090162c96) fix: Add JSON instruction to default text tagging prompt before content insertion ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/shared/prompts.ts` (+1 -0) </details> ### 📄 Description Added the prompt instruction ``` - You must respond in valid JSON with the key "tags" and the value is list of tags. Don't wrap the response in a markdown code. ``` to the default text tagging instructions before the content insertion. This change significantly improves the success rate of a response containing structured JSON when a prompt is truncated by the LLM due to the prompt exceeding a maximum token limit. I kept the original JSON instruction at the end of the prompt because it "reminds" the LLM to use JSON structure after the content insertion, and it causes no issues. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 12:00:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#2082
No description provided.