← Back to changelog
July 11, 2024
Create Non-Numeric Scores via SDKs
Marlies Mayerhofer
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-configs
GET /api/public/score-configs/{configId}
POST /api/public/score-configs
Existing API Routes with new parameters
GET /api/public/scores
can now retrieve scores bydataType
and/orconfigId
POST /api/public/scores
now supports definingdataType
and/orconfigId
SDK methods
pip install langfuse
from 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"
)