feat(api): update API spec from langfuse/langfuse 6603be6#1612
feat(api): update API spec from langfuse/langfuse 6603be6#1612langfuse-bot wants to merge 6 commits intomainfrom
Conversation
|
@claude review |
Extend string-value overloads in create_score, score_current_span, score_current_trace, score, and score_trace to accept TEXT alongside CATEGORICAL. Update all related docstrings. Add ExperimentScoreType to exclude TEXT from experiments/evals. Add integration test for TEXT scores. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The spec update is now automated via PR from the langfuse repo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update cast(Literal["CATEGORICAL"], ...) to include "TEXT" in score/score_trace/score_current_span/score_current_trace impl bodies. Add ExperimentScoreType to __all__ in types.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
The issues from the previous review have been addressed: ScoreDataType now includes TEXT, the string-value overloads accept both CATEGORICAL and TEXT, and the experiment layer correctly uses a separate ExperimentScoreType that excludes TEXT. LGTM.
Extended reasoning...
Overview
This PR adds TEXT as a new score data type throughout the Python SDK. Changes span the auto-generated Fern client (langfuse/api/), the high-level SDK types (langfuse/types.py), the client overloads (langfuse/_client/client.py, langfuse/_client/span.py), the experiment layer (langfuse/experiment.py), and a new integration test.
Security risks
No security-sensitive code is touched. The changes are purely additive type-system and data-model updates. No auth, crypto, or permission logic is affected.
Level of scrutiny
The auto-generated Fern client changes in langfuse/api/ are mechanical and follow established patterns exactly. The hand-maintained changes in langfuse/types.py, langfuse/_client/, and langfuse/experiment.py correctly thread TEXT through the type system, and the introduction of ExperimentScoreType cleanly excludes TEXT from the experiment/eval layer (consistent with the documented design intent). The new test in test_core_sdk.py exercises the full round-trip for TEXT scores.
Other factors
My prior review identified two gaps (missing TEXT in ScoreDataType and CATEGORICAL-only overloads) — both are resolved in this revision, and the inline comment was marked resolved. The tenacity dev dependency addition is a minor, appropriate change to support retry logic in the new test.
770e388 to
5eec695
Compare
There was a problem hiding this comment.
LGTM — previous concerns resolved: and overload signatures now include TEXT, correctly excludes it.
Extended reasoning...
Overview
The PR adds TEXT as a new score data type throughout the Python SDK. It covers: auto-generated Fern client types (, , , , discriminated union updates), public type aliases in , high-level SDK method overloads in and , a new alias that intentionally excludes TEXT, and a new integration test.
Security risks
None. This is a feature addition to score types with no auth, crypto, or permission changes.
Level of scrutiny
Moderate — the PR touches the public SDK API surface but all changes are mechanical and follow established patterns exactly. The auto-generated Fern client files are noise; the meaningful hand-edited changes (types.py, client.py, span.py, experiment.py) are small and correct.
Other factors
My prior review identified that still had the old and the overloads hardcoded . Both gaps are now fixed in this revision. The inline comment was resolved. The only remaining flag is a nit about module-level assignments in the test file, which is a pre-existing anti-pattern that does not affect production code or this PR's correctness.
5eec695 to
5e63dcf
Compare
There was a problem hiding this comment.
Previous concerns have been addressed: now includes TEXT, overload signatures updated, and correctly excludes TEXT for experiments. LGTM.
Disclaimer: Experimental PR review
Greptile Summary
This PR is an auto-generated API spec update (from
langfuse/langfusecommit6603be6) that adds TEXT as a new score data type throughout the Python SDK. It introducesTextScore,TextScoreV1,Score_Text,ScoreV1_Text,GetScoresResponseData_Text, andGetScoresResponseDataTextmodels, and updates bothScoreDataTypeandScoreConfigDataTypeenums with theTEXTvalue.TextScore,TextScoreV1) follow the established inheritance pattern fromBaseScore/BaseScoreV1.GetScoresResponseDatais correctly extended withGetScoresResponseData_TextusingdataType="TEXT"as the discriminator key.ScoreDataType.TEXTincludes avisit()branch;ScoreConfigDataType.TEXTalso adds TEXT (note: CORRECTION remains intentionally absent from config data type, consistent with the pre-existing design).__init__.pyindex files and__all__lists are updated consistently acrosslangfuse/api/,langfuse/api/commons/, andlangfuse/api/scores/.ScoreBody,CreateScoreRequest, and the legacyscore_v1clients are updated to mention text score requirements (string value, 1–500 characters).langfuse/api/, which is the auto-generated Fern client zone perCLAUDE.md.Confidence Score: 5/5
This PR is safe to merge — it is auto-generated from an updated API spec and introduces no manually written logic.
All changes are in the auto-generated Fern client directory. The new TEXT score type follows established patterns exactly (enum values, discriminated unions, model inheritance, init.py exports). No logic regressions, no broken contracts, no missing migrations.
No files require special attention.
Important Files Changed
Class Diagram
%%{init: {'theme': 'neutral'}}%% classDiagram class BaseScore { +id: str +name: str +source: ScoreSource +timestamp: datetime +created_at: datetime +updated_at: datetime +metadata: Any +environment: str } class TextScore { +string_value: str } class GetScoresResponseDataText { +trace: Optional[GetScoresResponseTraceData] } class Score_Text { +data_type: Literal["TEXT"] +string_value: str } class ScoreV1_Text { +data_type: Literal["TEXT"] +string_value: str +trace_id: str } class GetScoresResponseData_Text { +data_type: Literal["TEXT"] +string_value: str +trace: Optional[GetScoresResponseTraceData] } BaseScore <|-- TextScore TextScore <|-- GetScoresResponseDataText note for Score_Text "Used in discriminated union Score" note for ScoreV1_Text "Used in discriminated union ScoreV1" note for GetScoresResponseData_Text "Used in GetScoresResponseData union"Reviews (1): Last reviewed commit: "feat(api): update API spec from langfuse..." | Re-trigger Greptile