Update/delete score using python sdk #1486
-
Hi team, I noticed that when I use langfuse.score() to create a new score for a traceid, it appends a new score to the trace even if the score with the same name exists already. I'm looking to implement a behavior where only one score is maintained for a trace with a given score name, and that score gets updated on change instead of a new score getting added to the trace. Using the python SDK I could not find an option to update an existing score for a given trace with a given score name. I also couldn't delete all existing scores before creating a new one. Can you please guide me on how I can implement this with the python SDK? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can use the DELETE API found here: https://api.reference.langfuse.com/#delete-/api/public/scores/-scoreId- When you create a new score, the function will return a scoreID. Make sure to save this ID. If you need to update the score later, you'll first need to delete the previous score using the DELETE API, and then create a new one. |
Beta Was this translation helpful? Give feedback.
You can use the DELETE API found here: https://api.reference.langfuse.com/#delete-/api/public/scores/-scoreId-
When you create a new score, the function will return a scoreID. Make sure to save this ID. If you need to update the score later, you'll first need to delete the previous score using the DELETE API, and then create a new one.