Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion langfuse/_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2442,13 +2442,20 @@ def get_trace_url(self, *, trace_id: Optional[str] = None) -> Optional[str]:
)

def get_dataset(
self, name: str, *, fetch_items_page_size: Optional[int] = 50
self,
name: str,
*,
fetch_items_page_size: Optional[int] = 50,
version: Optional[datetime] = None,
) -> "DatasetClient":
"""Fetch a dataset by its name.

Args:
name (str): The name of the dataset to fetch.
fetch_items_page_size (Optional[int]): All items of the dataset will be fetched in chunks of this size. Defaults to 50.
version (Optional[datetime]): Retrieve dataset items as they existed at this specific point in time (UTC).
If provided, returns the state of items at the specified UTC timestamp.
If not provided, returns the latest version. Must be a timezone-aware datetime object in UTC.

Returns:
DatasetClient: The dataset with the given name.
Expand All @@ -2465,6 +2472,7 @@ def get_dataset(
dataset_name=self._url_encode(name, is_url_param=True),
page=page,
limit=fetch_items_page_size,
version=version,
)
dataset_items.extend(new_items.data)

Expand Down
8 changes: 8 additions & 0 deletions langfuse/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
Comment,
CommentObjectType,
ConfigCategory,
CorrectionScore,
CreateAnnotationQueueAssignmentResponse,
CreateAnnotationQueueItemRequest,
CreateAnnotationQueueRequest,
Expand Down Expand Up @@ -85,9 +86,11 @@
GetScoresResponseData,
GetScoresResponseDataBoolean,
GetScoresResponseDataCategorical,
GetScoresResponseDataCorrection,
GetScoresResponseDataNumeric,
GetScoresResponseData_Boolean,
GetScoresResponseData_Categorical,
GetScoresResponseData_Correction,
GetScoresResponseData_Numeric,
GetScoresResponseTraceData,
HealthResponse,
Expand Down Expand Up @@ -199,6 +202,7 @@
ScoreV1_Numeric,
Score_Boolean,
Score_Categorical,
Score_Correction,
Score_Numeric,
SdkLogBody,
SdkLogEvent,
Expand Down Expand Up @@ -293,6 +297,7 @@
"Comment",
"CommentObjectType",
"ConfigCategory",
"CorrectionScore",
"CreateAnnotationQueueAssignmentResponse",
"CreateAnnotationQueueItemRequest",
"CreateAnnotationQueueRequest",
Expand Down Expand Up @@ -342,9 +347,11 @@
"GetScoresResponseData",
"GetScoresResponseDataBoolean",
"GetScoresResponseDataCategorical",
"GetScoresResponseDataCorrection",
"GetScoresResponseDataNumeric",
"GetScoresResponseData_Boolean",
"GetScoresResponseData_Categorical",
"GetScoresResponseData_Correction",
"GetScoresResponseData_Numeric",
"GetScoresResponseTraceData",
"HealthResponse",
Expand Down Expand Up @@ -456,6 +463,7 @@
"ScoreV1_Numeric",
"Score_Boolean",
"Score_Categorical",
"Score_Correction",
"Score_Numeric",
"SdkLogBody",
"SdkLogEvent",
Expand Down
15 changes: 14 additions & 1 deletion langfuse/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,8 @@ client.dataset_items.get(
<dl>
<dd>

Get dataset items
Get dataset items. Optionally specify a version to get the items as they existed at that point in time.
Note: If version parameter is provided, datasetName must also be provided.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -1584,6 +1585,18 @@ client.dataset_items.list()
<dl>
<dd>

**version:** `typing.Optional[dt.datetime]`

ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z").
If provided, returns state of dataset at this timestamp.
If not provided, returns the latest version. Requires datasetName to be specified.

</dd>
</dl>

<dl>
<dd>

**page:** `typing.Optional[int]` — page number, starts at 1

</dd>
Expand Down
8 changes: 8 additions & 0 deletions langfuse/api/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
Comment,
CommentObjectType,
ConfigCategory,
CorrectionScore,
CreateScoreValue,
Dataset,
DatasetItem,
Expand Down Expand Up @@ -101,6 +102,7 @@
ScoreV1_Numeric,
Score_Boolean,
Score_Categorical,
Score_Correction,
Score_Numeric,
Session,
SessionWithTraces,
Expand Down Expand Up @@ -268,9 +270,11 @@
GetScoresResponseData,
GetScoresResponseDataBoolean,
GetScoresResponseDataCategorical,
GetScoresResponseDataCorrection,
GetScoresResponseDataNumeric,
GetScoresResponseData_Boolean,
GetScoresResponseData_Categorical,
GetScoresResponseData_Correction,
GetScoresResponseData_Numeric,
GetScoresResponseTraceData,
)
Expand Down Expand Up @@ -313,6 +317,7 @@
"Comment",
"CommentObjectType",
"ConfigCategory",
"CorrectionScore",
"CreateAnnotationQueueAssignmentResponse",
"CreateAnnotationQueueItemRequest",
"CreateAnnotationQueueRequest",
Expand Down Expand Up @@ -362,9 +367,11 @@
"GetScoresResponseData",
"GetScoresResponseDataBoolean",
"GetScoresResponseDataCategorical",
"GetScoresResponseDataCorrection",
"GetScoresResponseDataNumeric",
"GetScoresResponseData_Boolean",
"GetScoresResponseData_Categorical",
"GetScoresResponseData_Correction",
"GetScoresResponseData_Numeric",
"GetScoresResponseTraceData",
"HealthResponse",
Expand Down Expand Up @@ -476,6 +483,7 @@
"ScoreV1_Numeric",
"Score_Boolean",
"Score_Categorical",
"Score_Correction",
"Score_Numeric",
"SdkLogBody",
"SdkLogEvent",
Expand Down
4 changes: 4 additions & 0 deletions langfuse/api/resources/commons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Comment,
CommentObjectType,
ConfigCategory,
CorrectionScore,
CreateScoreValue,
Dataset,
DatasetItem,
Expand Down Expand Up @@ -41,6 +42,7 @@
ScoreV1_Numeric,
Score_Boolean,
Score_Categorical,
Score_Correction,
Score_Numeric,
Session,
SessionWithTraces,
Expand Down Expand Up @@ -68,6 +70,7 @@
"Comment",
"CommentObjectType",
"ConfigCategory",
"CorrectionScore",
"CreateScoreValue",
"Dataset",
"DatasetItem",
Expand Down Expand Up @@ -102,6 +105,7 @@
"ScoreV1_Numeric",
"Score_Boolean",
"Score_Categorical",
"Score_Correction",
"Score_Numeric",
"Session",
"SessionWithTraces",
Expand Down
11 changes: 10 additions & 1 deletion langfuse/api/resources/commons/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .comment import Comment
from .comment_object_type import CommentObjectType
from .config_category import ConfigCategory
from .correction_score import CorrectionScore
from .create_score_value import CreateScoreValue
from .dataset import Dataset
from .dataset_item import DatasetItem
Expand All @@ -29,7 +30,13 @@
from .pricing_tier_condition import PricingTierCondition
from .pricing_tier_input import PricingTierInput
from .pricing_tier_operator import PricingTierOperator
from .score import Score, Score_Boolean, Score_Categorical, Score_Numeric
from .score import (
Score,
Score_Boolean,
Score_Categorical,
Score_Correction,
Score_Numeric,
)
from .score_config import ScoreConfig
from .score_config_data_type import ScoreConfigDataType
from .score_data_type import ScoreDataType
Expand All @@ -52,6 +59,7 @@
"Comment",
"CommentObjectType",
"ConfigCategory",
"CorrectionScore",
"CreateScoreValue",
"Dataset",
"DatasetItem",
Expand Down Expand Up @@ -83,6 +91,7 @@
"ScoreV1_Numeric",
"Score_Boolean",
"Score_Categorical",
"Score_Correction",
"Score_Numeric",
"Session",
"SessionWithTraces",
Expand Down
53 changes: 53 additions & 0 deletions langfuse/api/resources/commons/types/correction_score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ....core.datetime_utils import serialize_datetime
from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
from .base_score import BaseScore


class CorrectionScore(BaseScore):
value: float = pydantic_v1.Field()
"""
The numeric value of the score. Always 0 for correction scores.
"""

string_value: str = pydantic_v1.Field(alias="stringValue")
"""
The string representation of the correction content
"""

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {
"by_alias": True,
"exclude_unset": True,
**kwargs,
}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {
"by_alias": True,
"exclude_unset": True,
**kwargs,
}
kwargs_with_defaults_exclude_none: typing.Any = {
"by_alias": True,
"exclude_none": True,
**kwargs,
}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset),
super().dict(**kwargs_with_defaults_exclude_none),
)

class Config:
frozen = True
smart_union = True
allow_population_by_field_name = True
populate_by_name = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}
67 changes: 66 additions & 1 deletion langfuse/api/resources/commons/types/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,69 @@ class Config:
json_encoders = {dt.datetime: serialize_datetime}


Score = typing.Union[Score_Numeric, Score_Categorical, Score_Boolean]
class Score_Correction(pydantic_v1.BaseModel):
value: float
string_value: str = pydantic_v1.Field(alias="stringValue")
id: str
trace_id: typing.Optional[str] = pydantic_v1.Field(alias="traceId", default=None)
session_id: typing.Optional[str] = pydantic_v1.Field(
alias="sessionId", default=None
)
observation_id: typing.Optional[str] = pydantic_v1.Field(
alias="observationId", default=None
)
dataset_run_id: typing.Optional[str] = pydantic_v1.Field(
alias="datasetRunId", default=None
)
name: str
source: ScoreSource
timestamp: dt.datetime
created_at: dt.datetime = pydantic_v1.Field(alias="createdAt")
updated_at: dt.datetime = pydantic_v1.Field(alias="updatedAt")
author_user_id: typing.Optional[str] = pydantic_v1.Field(
alias="authorUserId", default=None
)
comment: typing.Optional[str] = None
metadata: typing.Any
config_id: typing.Optional[str] = pydantic_v1.Field(alias="configId", default=None)
queue_id: typing.Optional[str] = pydantic_v1.Field(alias="queueId", default=None)
environment: str
data_type: typing.Literal["CORRECTION"] = pydantic_v1.Field(
alias="dataType", default="CORRECTION"
)

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {
"by_alias": True,
"exclude_unset": True,
**kwargs,
}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {
"by_alias": True,
"exclude_unset": True,
**kwargs,
}
kwargs_with_defaults_exclude_none: typing.Any = {
"by_alias": True,
"exclude_none": True,
**kwargs,
}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset),
super().dict(**kwargs_with_defaults_exclude_none),
)

class Config:
frozen = True
smart_union = True
allow_population_by_field_name = True
populate_by_name = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}


Score = typing.Union[Score_Numeric, Score_Categorical, Score_Boolean, Score_Correction]
Loading
Loading