bug: impossible to remove prompt labels using Python SDK or API
Describe the bug
I have one prompt with the labels: ["latest", "candidate"]. After a "competition" vs the productin prompt version, I want to promote it to production and remove the "candidate" label.
I've tried:
langfuse.update_prompt(
name="my-prompt",
version=3,
new_labels=["production"],
)
And also:
response = langfuse.api.prompt_version._client_wrapper.httpx_client.request(
"/api/public/v2/prompts/my-prompt/versions/3",
method="PATCH",
json={"newLabels": ["production"]},
)
But it doesn't work because of this: https://github.com/langfuse/langfuse/blob/44ce6ef58156bcf435412676134bfa88d00518f4/web/src/features/prompts/server/actions/updatePrompts.ts#L55
I understand that we won't be able to remove the "latest" label as it is managed internally, but for custom labels I think we should be able to do it. Maybe the default behaviour should stay like this, but give us a remove_labels: bool parameter or something to remove labels.
Steps to reproduce
- Set a prompt version with several labels, e.g. ["production", "candidate"].
- Try to remove the "candidate" label (without assigning it to any other version).
Langfuse Cloud or self-hosted?
Self-hosted
If self-hosted, what version are you running?
langfuse/langfuse:3@sha256:08ed9568b8d51825b15279e6d66809eece630d5035cfaa7f706d9a2dbdd097bc
SDK and integration versions
No response
Additional information
No response
Are you interested in contributing a fix for this bug?
No
Hi @igonro! I'm Dosu and I’m helping the langfuse team.
You're correct—removing custom labels from a prompt version via the Python SDK or API isn't currently possible. The backend logic always merges the new labels you provide with the existing ones, so labels like "candidate" remain even if you omit them in your update call. This is enforced in the backend code, which creates a union of old and new labels and never actually removes any from the current prompt version, regardless of what you send in the PATCH request (source).
The "latest" label is managed internally and can't be removed or changed manually, but the same restriction currently applies to custom labels due to this logic. There is no hidden or undocumented way to remove custom labels via the API or SDK, and recent updates haven't changed this behavior.
A remove_labels parameter or similar feature would require a change to the backend logic. For now, the only way to remove a label is to wait for a feature update that supports this use case.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale. Please reopen if the issue persists.
Has there been any solution to this? I am happy to work on a solution if no one else is
Has there been any solution to this? I am happy to work on a solution if no one else is
I think this problem still persists. Do you have any solution for it?
Any news about this feature?
Hello! Any news about this feature? Our team is trying to perform some automated prompt reviewing and we'd like to axe some outdated labels. If it's not planned, any suggestions on going around it?
hi all, thank you for pushing on this. we will take a look
@ryanpapetti-studocu you can now remove labels via api its live on could sdk and oss releases are following https://api.reference.langfuse.com/#tag/promptversion/PATCH/api/public/v2/prompts/{name}/versions/{version}