Skip to content

Commit 4bf1ac1

Browse files
committed
push
1 parent f0f6ff8 commit 4bf1ac1

File tree

16 files changed

+282
-6
lines changed

16 files changed

+282
-6
lines changed

langfuse/api/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
Comment,
7979
CommentObjectType,
8080
ConfigCategory,
81+
CorrectionScore,
8182
CreateScoreValue,
8283
Dataset,
8384
DatasetItem,
@@ -112,6 +113,7 @@
112113
ScoreV1_Numeric,
113114
Score_Boolean,
114115
Score_Categorical,
116+
Score_Correction,
115117
Score_Numeric,
116118
Session,
117119
SessionWithTraces,
@@ -279,9 +281,11 @@
279281
GetScoresResponseData,
280282
GetScoresResponseDataBoolean,
281283
GetScoresResponseDataCategorical,
284+
GetScoresResponseDataCorrection,
282285
GetScoresResponseDataNumeric,
283286
GetScoresResponseData_Boolean,
284287
GetScoresResponseData_Categorical,
288+
GetScoresResponseData_Correction,
285289
GetScoresResponseData_Numeric,
286290
GetScoresResponseTraceData,
287291
)
@@ -323,6 +327,7 @@
323327
"Comment": ".commons",
324328
"CommentObjectType": ".commons",
325329
"ConfigCategory": ".commons",
330+
"CorrectionScore": ".commons",
326331
"CreateAnnotationQueueAssignmentResponse": ".annotation_queues",
327332
"CreateAnnotationQueueItemRequest": ".annotation_queues",
328333
"CreateAnnotationQueueRequest": ".annotation_queues",
@@ -372,9 +377,11 @@
372377
"GetScoresResponseData": ".score_v2",
373378
"GetScoresResponseDataBoolean": ".score_v2",
374379
"GetScoresResponseDataCategorical": ".score_v2",
380+
"GetScoresResponseDataCorrection": ".score_v2",
375381
"GetScoresResponseDataNumeric": ".score_v2",
376382
"GetScoresResponseData_Boolean": ".score_v2",
377383
"GetScoresResponseData_Categorical": ".score_v2",
384+
"GetScoresResponseData_Correction": ".score_v2",
378385
"GetScoresResponseData_Numeric": ".score_v2",
379386
"GetScoresResponseTraceData": ".score_v2",
380387
"HealthResponse": ".health",
@@ -488,6 +495,7 @@
488495
"ScoreV1_Numeric": ".commons",
489496
"Score_Boolean": ".commons",
490497
"Score_Categorical": ".commons",
498+
"Score_Correction": ".commons",
491499
"Score_Numeric": ".commons",
492500
"SdkLogBody": ".ingestion",
493501
"SdkLogEvent": ".ingestion",
@@ -610,6 +618,7 @@ def __dir__():
610618
"Comment",
611619
"CommentObjectType",
612620
"ConfigCategory",
621+
"CorrectionScore",
613622
"CreateAnnotationQueueAssignmentResponse",
614623
"CreateAnnotationQueueItemRequest",
615624
"CreateAnnotationQueueRequest",
@@ -659,9 +668,11 @@ def __dir__():
659668
"GetScoresResponseData",
660669
"GetScoresResponseDataBoolean",
661670
"GetScoresResponseDataCategorical",
671+
"GetScoresResponseDataCorrection",
662672
"GetScoresResponseDataNumeric",
663673
"GetScoresResponseData_Boolean",
664674
"GetScoresResponseData_Categorical",
675+
"GetScoresResponseData_Correction",
665676
"GetScoresResponseData_Numeric",
666677
"GetScoresResponseTraceData",
667678
"HealthResponse",
@@ -775,6 +786,7 @@ def __dir__():
775786
"ScoreV1_Numeric",
776787
"Score_Boolean",
777788
"Score_Categorical",
789+
"Score_Correction",
778790
"Score_Numeric",
779791
"SdkLogBody",
780792
"SdkLogEvent",

langfuse/api/commons/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Comment,
1717
CommentObjectType,
1818
ConfigCategory,
19+
CorrectionScore,
1920
CreateScoreValue,
2021
Dataset,
2122
DatasetItem,
@@ -47,6 +48,7 @@
4748
ScoreV1_Numeric,
4849
Score_Boolean,
4950
Score_Categorical,
51+
Score_Correction,
5052
Score_Numeric,
5153
Session,
5254
SessionWithTraces,
@@ -73,6 +75,7 @@
7375
"Comment": ".types",
7476
"CommentObjectType": ".types",
7577
"ConfigCategory": ".types",
78+
"CorrectionScore": ".types",
7679
"CreateScoreValue": ".types",
7780
"Dataset": ".types",
7881
"DatasetItem": ".types",
@@ -107,6 +110,7 @@
107110
"ScoreV1_Numeric": ".types",
108111
"Score_Boolean": ".types",
109112
"Score_Categorical": ".types",
113+
"Score_Correction": ".types",
110114
"Score_Numeric": ".types",
111115
"Session": ".types",
112116
"SessionWithTraces": ".types",
@@ -156,6 +160,7 @@ def __dir__():
156160
"Comment",
157161
"CommentObjectType",
158162
"ConfigCategory",
163+
"CorrectionScore",
159164
"CreateScoreValue",
160165
"Dataset",
161166
"DatasetItem",
@@ -190,6 +195,7 @@ def __dir__():
190195
"ScoreV1_Numeric",
191196
"Score_Boolean",
192197
"Score_Categorical",
198+
"Score_Correction",
193199
"Score_Numeric",
194200
"Session",
195201
"SessionWithTraces",

langfuse/api/commons/types/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .comment import Comment
1616
from .comment_object_type import CommentObjectType
1717
from .config_category import ConfigCategory
18+
from .correction_score import CorrectionScore
1819
from .create_score_value import CreateScoreValue
1920
from .dataset import Dataset
2021
from .dataset_item import DatasetItem
@@ -35,7 +36,13 @@
3536
from .pricing_tier_condition import PricingTierCondition
3637
from .pricing_tier_input import PricingTierInput
3738
from .pricing_tier_operator import PricingTierOperator
38-
from .score import Score, Score_Boolean, Score_Categorical, Score_Numeric
39+
from .score import (
40+
Score,
41+
Score_Boolean,
42+
Score_Categorical,
43+
Score_Correction,
44+
Score_Numeric,
45+
)
3946
from .score_config import ScoreConfig
4047
from .score_config_data_type import ScoreConfigDataType
4148
from .score_data_type import ScoreDataType
@@ -57,6 +64,7 @@
5764
"Comment": ".comment",
5865
"CommentObjectType": ".comment_object_type",
5966
"ConfigCategory": ".config_category",
67+
"CorrectionScore": ".correction_score",
6068
"CreateScoreValue": ".create_score_value",
6169
"Dataset": ".dataset",
6270
"DatasetItem": ".dataset_item",
@@ -88,6 +96,7 @@
8896
"ScoreV1_Numeric": ".score_v1",
8997
"Score_Boolean": ".score",
9098
"Score_Categorical": ".score",
99+
"Score_Correction": ".score",
91100
"Score_Numeric": ".score",
92101
"Session": ".session",
93102
"SessionWithTraces": ".session_with_traces",
@@ -135,6 +144,7 @@ def __dir__():
135144
"Comment",
136145
"CommentObjectType",
137146
"ConfigCategory",
147+
"CorrectionScore",
138148
"CreateScoreValue",
139149
"Dataset",
140150
"DatasetItem",
@@ -166,6 +176,7 @@ def __dir__():
166176
"ScoreV1_Numeric",
167177
"Score_Boolean",
168178
"Score_Categorical",
179+
"Score_Correction",
169180
"Score_Numeric",
170181
"Session",
171182
"SessionWithTraces",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import pydantic
6+
import typing_extensions
7+
from ...core.serialization import FieldMetadata
8+
from .base_score import BaseScore
9+
10+
11+
class CorrectionScore(BaseScore):
12+
value: float = pydantic.Field()
13+
"""
14+
The numeric value of the score. Always 0 for correction scores.
15+
"""
16+
17+
string_value: typing_extensions.Annotated[
18+
str, FieldMetadata(alias="stringValue")
19+
] = pydantic.Field()
20+
"""
21+
The string representation of the correction content
22+
"""
23+
24+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
25+
extra="allow", frozen=True
26+
)

langfuse/api/commons/types/score.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,53 @@ class Score_Boolean(UniversalBaseModel):
149149
)
150150

151151

152+
class Score_Correction(UniversalBaseModel):
153+
data_type: typing_extensions.Annotated[
154+
typing.Literal["CORRECTION"], FieldMetadata(alias="dataType")
155+
] = "CORRECTION"
156+
value: float
157+
string_value: typing_extensions.Annotated[str, FieldMetadata(alias="stringValue")]
158+
id: str
159+
trace_id: typing_extensions.Annotated[
160+
typing.Optional[str], FieldMetadata(alias="traceId")
161+
] = None
162+
session_id: typing_extensions.Annotated[
163+
typing.Optional[str], FieldMetadata(alias="sessionId")
164+
] = None
165+
observation_id: typing_extensions.Annotated[
166+
typing.Optional[str], FieldMetadata(alias="observationId")
167+
] = None
168+
dataset_run_id: typing_extensions.Annotated[
169+
typing.Optional[str], FieldMetadata(alias="datasetRunId")
170+
] = None
171+
name: str
172+
source: ScoreSource
173+
timestamp: dt.datetime
174+
created_at: typing_extensions.Annotated[
175+
dt.datetime, FieldMetadata(alias="createdAt")
176+
]
177+
updated_at: typing_extensions.Annotated[
178+
dt.datetime, FieldMetadata(alias="updatedAt")
179+
]
180+
author_user_id: typing_extensions.Annotated[
181+
typing.Optional[str], FieldMetadata(alias="authorUserId")
182+
] = None
183+
comment: typing.Optional[str] = None
184+
metadata: typing.Any
185+
config_id: typing_extensions.Annotated[
186+
typing.Optional[str], FieldMetadata(alias="configId")
187+
] = None
188+
queue_id: typing_extensions.Annotated[
189+
typing.Optional[str], FieldMetadata(alias="queueId")
190+
] = None
191+
environment: str
192+
193+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
194+
extra="allow", frozen=True
195+
)
196+
197+
152198
Score = typing_extensions.Annotated[
153-
typing.Union[Score_Numeric, Score_Categorical, Score_Boolean],
199+
typing.Union[Score_Numeric, Score_Categorical, Score_Boolean, Score_Correction],
154200
pydantic.Field(discriminator="data_type"),
155201
]

langfuse/api/dataset_items/client.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3+
import datetime as dt
34
import typing
45

56
from ..commons.types.dataset_item import DatasetItem
@@ -143,12 +144,14 @@ def list(
143144
dataset_name: typing.Optional[str] = None,
144145
source_trace_id: typing.Optional[str] = None,
145146
source_observation_id: typing.Optional[str] = None,
147+
version: typing.Optional[dt.datetime] = None,
146148
page: typing.Optional[int] = None,
147149
limit: typing.Optional[int] = None,
148150
request_options: typing.Optional[RequestOptions] = None,
149151
) -> PaginatedDatasetItems:
150152
"""
151-
Get dataset items
153+
Get dataset items. Optionally specify a version to get the items as they existed at that point in time.
154+
Note: If version parameter is provided, datasetName must also be provided.
152155
153156
Parameters
154157
----------
@@ -158,6 +161,11 @@ def list(
158161
159162
source_observation_id : typing.Optional[str]
160163
164+
version : typing.Optional[dt.datetime]
165+
ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z").
166+
If provided, returns state of dataset at this timestamp.
167+
If not provided, returns the latest version. Requires datasetName to be specified.
168+
161169
page : typing.Optional[int]
162170
page number, starts at 1
163171
@@ -189,6 +197,7 @@ def list(
189197
dataset_name=dataset_name,
190198
source_trace_id=source_trace_id,
191199
source_observation_id=source_observation_id,
200+
version=version,
192201
page=page,
193202
limit=limit,
194203
request_options=request_options,
@@ -377,12 +386,14 @@ async def list(
377386
dataset_name: typing.Optional[str] = None,
378387
source_trace_id: typing.Optional[str] = None,
379388
source_observation_id: typing.Optional[str] = None,
389+
version: typing.Optional[dt.datetime] = None,
380390
page: typing.Optional[int] = None,
381391
limit: typing.Optional[int] = None,
382392
request_options: typing.Optional[RequestOptions] = None,
383393
) -> PaginatedDatasetItems:
384394
"""
385-
Get dataset items
395+
Get dataset items. Optionally specify a version to get the items as they existed at that point in time.
396+
Note: If version parameter is provided, datasetName must also be provided.
386397
387398
Parameters
388399
----------
@@ -392,6 +403,11 @@ async def list(
392403
393404
source_observation_id : typing.Optional[str]
394405
406+
version : typing.Optional[dt.datetime]
407+
ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z").
408+
If provided, returns state of dataset at this timestamp.
409+
If not provided, returns the latest version. Requires datasetName to be specified.
410+
395411
page : typing.Optional[int]
396412
page number, starts at 1
397413
@@ -431,6 +447,7 @@ async def main() -> None:
431447
dataset_name=dataset_name,
432448
source_trace_id=source_trace_id,
433449
source_observation_id=source_observation_id,
450+
version=version,
434451
page=page,
435452
limit=limit,
436453
request_options=request_options,

0 commit comments

Comments
 (0)