← Back to changelog
Marlies Mayerhofer
July 11, 2024
Create Non-Numeric Scores via SDKs
The Langfuse API, Python and JS SDKs now support creating categorical, boolean and numeric scores.
Our improved API allows you to create categorical and boolean scores, in addition to the previously supported numeric scores. If you need your scores to follow a specific format (e.g. data type, range or name), you can now define a score configuration using the API or UI and validate scores against it.
Check out our scores documentation for score ingestion examples and code snippets.
New API routes
GET /api/public/score-configsGET /api/public/score-configs/{configId}POST /api/public/score-configs
Existing API Routes with new parameters
GET /api/public/scorescan now retrieve scores bydataTypeand/orconfigIdPOST /api/public/scoresnow supports definingdataTypeand/orconfigId
SDK methods
pip install langfusefrom langfuse import Langfuse
langfuse = Langfuse()
# Create a single numeric, categorical or boolean score
langfuse.score(
score_name="accuracy",
score_value=0.95,
data_type="NUMERIC",
trace_id="traceId"
)