Skip to content

Commit 5a32d64

Browse files
langfuse-botlangfuse-bot
andauthored
feat(api): update API spec from langfuse/langfuse 811f641 (#1738)
Co-authored-by: langfuse-bot <langfuse-bot@langfuse.com>
1 parent 0ad4ec1 commit 5a32d64

36 files changed

Lines changed: 2905 additions & 9 deletions

langfuse/api/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
dataset_items,
1515
dataset_run_items,
1616
datasets,
17+
experiments,
1718
health,
1819
ingestion,
1920
legacy,
@@ -58,6 +59,7 @@
5859
BlobStorageExportSource,
5960
BlobStorageIntegrationDeletionResponse,
6061
BlobStorageIntegrationFileType,
62+
BlobStorageIntegrationFileTypeResponse,
6163
BlobStorageIntegrationResponse,
6264
BlobStorageIntegrationStatusResponse,
6365
BlobStorageIntegrationType,
@@ -147,6 +149,13 @@
147149
PaginatedDatasetRuns,
148150
PaginatedDatasets,
149151
)
152+
from .experiments import (
153+
Experiment,
154+
ExperimentItem,
155+
ExperimentItemsResponse,
156+
ExperimentsResponse,
157+
ExperimentsResponseMeta,
158+
)
150159
from .health import HealthResponse, ServiceUnavailableError
151160
from .ingestion import (
152161
BaseEvent,
@@ -352,6 +361,7 @@
352361
"BlobStorageExportSource": ".blob_storage_integrations",
353362
"BlobStorageIntegrationDeletionResponse": ".blob_storage_integrations",
354363
"BlobStorageIntegrationFileType": ".blob_storage_integrations",
364+
"BlobStorageIntegrationFileTypeResponse": ".blob_storage_integrations",
355365
"BlobStorageIntegrationResponse": ".blob_storage_integrations",
356366
"BlobStorageIntegrationStatusResponse": ".blob_storage_integrations",
357367
"BlobStorageIntegrationType": ".blob_storage_integrations",
@@ -415,6 +425,11 @@
415425
"DeleteTraceResponse": ".trace",
416426
"EmptyResponse": ".scim",
417427
"Error": ".commons",
428+
"Experiment": ".experiments",
429+
"ExperimentItem": ".experiments",
430+
"ExperimentItemsResponse": ".experiments",
431+
"ExperimentsResponse": ".experiments",
432+
"ExperimentsResponseMeta": ".experiments",
418433
"FilterConfig": ".scim",
419434
"GetCommentsResponse": ".comments",
420435
"GetMediaResponse": ".media",
@@ -601,6 +616,7 @@
601616
"dataset_items": ".dataset_items",
602617
"dataset_run_items": ".dataset_run_items",
603618
"datasets": ".datasets",
619+
"experiments": ".experiments",
604620
"health": ".health",
605621
"ingestion": ".ingestion",
606622
"legacy": ".legacy",
@@ -676,6 +692,7 @@ def __dir__():
676692
"BlobStorageExportSource",
677693
"BlobStorageIntegrationDeletionResponse",
678694
"BlobStorageIntegrationFileType",
695+
"BlobStorageIntegrationFileTypeResponse",
679696
"BlobStorageIntegrationResponse",
680697
"BlobStorageIntegrationStatusResponse",
681698
"BlobStorageIntegrationType",
@@ -739,6 +756,11 @@ def __dir__():
739756
"DeleteTraceResponse",
740757
"EmptyResponse",
741758
"Error",
759+
"Experiment",
760+
"ExperimentItem",
761+
"ExperimentItemsResponse",
762+
"ExperimentsResponse",
763+
"ExperimentsResponseMeta",
742764
"FilterConfig",
743765
"GetCommentsResponse",
744766
"GetMediaResponse",
@@ -925,6 +947,7 @@ def __dir__():
925947
"dataset_items",
926948
"dataset_run_items",
927949
"datasets",
950+
"experiments",
928951
"health",
929952
"ingestion",
930953
"legacy",

langfuse/api/blob_storage_integrations/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BlobStorageExportSource,
1414
BlobStorageIntegrationDeletionResponse,
1515
BlobStorageIntegrationFileType,
16+
BlobStorageIntegrationFileTypeResponse,
1617
BlobStorageIntegrationResponse,
1718
BlobStorageIntegrationStatusResponse,
1819
BlobStorageIntegrationType,
@@ -27,6 +28,7 @@
2728
"BlobStorageExportSource": ".types",
2829
"BlobStorageIntegrationDeletionResponse": ".types",
2930
"BlobStorageIntegrationFileType": ".types",
31+
"BlobStorageIntegrationFileTypeResponse": ".types",
3032
"BlobStorageIntegrationResponse": ".types",
3133
"BlobStorageIntegrationStatusResponse": ".types",
3234
"BlobStorageIntegrationType": ".types",
@@ -70,6 +72,7 @@ def __dir__():
7072
"BlobStorageExportSource",
7173
"BlobStorageIntegrationDeletionResponse",
7274
"BlobStorageIntegrationFileType",
75+
"BlobStorageIntegrationFileTypeResponse",
7376
"BlobStorageIntegrationResponse",
7477
"BlobStorageIntegrationStatusResponse",
7578
"BlobStorageIntegrationType",

langfuse/api/blob_storage_integrations/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def upsert_blob_storage_integration(
144144
Path prefix for exported files (must end with forward slash if provided)
145145
146146
export_start_date : typing.Optional[dt.datetime]
147-
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
147+
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
148148
149149
compressed : typing.Optional[bool]
150150
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
@@ -421,7 +421,7 @@ async def upsert_blob_storage_integration(
421421
Path prefix for exported files (must end with forward slash if provided)
422422
423423
export_start_date : typing.Optional[dt.datetime]
424-
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
424+
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
425425
426426
compressed : typing.Optional[bool]
427427
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.

langfuse/api/blob_storage_integrations/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def upsert_blob_storage_integration(
201201
Path prefix for exported files (must end with forward slash if provided)
202202
203203
export_start_date : typing.Optional[dt.datetime]
204-
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
204+
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
205205
206206
compressed : typing.Optional[bool]
207207
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
@@ -696,7 +696,7 @@ async def upsert_blob_storage_integration(
696696
Path prefix for exported files (must end with forward slash if provided)
697697
698698
export_start_date : typing.Optional[dt.datetime]
699-
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
699+
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
700700
701701
compressed : typing.Optional[bool]
702702
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.

langfuse/api/blob_storage_integrations/types/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
BlobStorageIntegrationDeletionResponse,
1515
)
1616
from .blob_storage_integration_file_type import BlobStorageIntegrationFileType
17+
from .blob_storage_integration_file_type_response import (
18+
BlobStorageIntegrationFileTypeResponse,
19+
)
1720
from .blob_storage_integration_response import BlobStorageIntegrationResponse
1821
from .blob_storage_integration_status_response import (
1922
BlobStorageIntegrationStatusResponse,
@@ -31,6 +34,7 @@
3134
"BlobStorageExportSource": ".blob_storage_export_source",
3235
"BlobStorageIntegrationDeletionResponse": ".blob_storage_integration_deletion_response",
3336
"BlobStorageIntegrationFileType": ".blob_storage_integration_file_type",
37+
"BlobStorageIntegrationFileTypeResponse": ".blob_storage_integration_file_type_response",
3438
"BlobStorageIntegrationResponse": ".blob_storage_integration_response",
3539
"BlobStorageIntegrationStatusResponse": ".blob_storage_integration_status_response",
3640
"BlobStorageIntegrationType": ".blob_storage_integration_type",
@@ -74,6 +78,7 @@ def __dir__():
7478
"BlobStorageExportSource",
7579
"BlobStorageIntegrationDeletionResponse",
7680
"BlobStorageIntegrationFileType",
81+
"BlobStorageIntegrationFileTypeResponse",
7782
"BlobStorageIntegrationResponse",
7883
"BlobStorageIntegrationStatusResponse",
7984
"BlobStorageIntegrationType",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
from ...core import enum
6+
7+
T_Result = typing.TypeVar("T_Result")
8+
9+
10+
class BlobStorageIntegrationFileTypeResponse(enum.StrEnum):
11+
"""
12+
File type reported for an existing integration. Includes `PARQUET`, which a project may enable through the Langfuse UI but cannot yet be set via this API (the request `fileType` omits it).
13+
"""
14+
15+
JSON = "JSON"
16+
CSV = "CSV"
17+
JSONL = "JSONL"
18+
PARQUET = "PARQUET"
19+
20+
def visit(
21+
self,
22+
json: typing.Callable[[], T_Result],
23+
csv: typing.Callable[[], T_Result],
24+
jsonl: typing.Callable[[], T_Result],
25+
parquet: typing.Callable[[], T_Result],
26+
) -> T_Result:
27+
if self is BlobStorageIntegrationFileTypeResponse.JSON:
28+
return json()
29+
if self is BlobStorageIntegrationFileTypeResponse.CSV:
30+
return csv()
31+
if self is BlobStorageIntegrationFileTypeResponse.JSONL:
32+
return jsonl()
33+
if self is BlobStorageIntegrationFileTypeResponse.PARQUET:
34+
return parquet()

langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
from .blob_storage_export_frequency import BlobStorageExportFrequency
1212
from .blob_storage_export_mode import BlobStorageExportMode
1313
from .blob_storage_export_source import BlobStorageExportSource
14-
from .blob_storage_integration_file_type import BlobStorageIntegrationFileType
14+
from .blob_storage_integration_file_type_response import (
15+
BlobStorageIntegrationFileTypeResponse,
16+
)
1517
from .blob_storage_integration_type import BlobStorageIntegrationType
1618

1719

@@ -34,7 +36,7 @@ class BlobStorageIntegrationResponse(UniversalBaseModel):
3436
bool, FieldMetadata(alias="forcePathStyle")
3537
]
3638
file_type: typing_extensions.Annotated[
37-
BlobStorageIntegrationFileType, FieldMetadata(alias="fileType")
39+
BlobStorageIntegrationFileTypeResponse, FieldMetadata(alias="fileType")
3840
]
3941
export_mode: typing_extensions.Annotated[
4042
BlobStorageExportMode, FieldMetadata(alias="exportMode")

langfuse/api/blob_storage_integrations/types/blob_storage_sync_status.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ class BlobStorageSyncStatus(enum.StrEnum):
1212
Sync status of the blob storage integration:
1313
- `disabled` — integration is not enabled
1414
- `error` — last export failed (see `lastError` for details)
15-
- `idle` — enabled but has never exported yet
15+
- `running` — an export job is currently being processed
1616
- `queued` — next export is overdue (`nextSyncAt` is in the past) and waiting to be picked up by the worker
17+
- `idle` — enabled but has never exported yet and no export is queued
1718
- `up_to_date` — all available data has been exported; next export is scheduled for the future
1819
1920
**ETL usage**: poll this endpoint and check for `up_to_date` status. Compare `lastSyncAt` against your
@@ -22,6 +23,7 @@ class BlobStorageSyncStatus(enum.StrEnum):
2223
"""
2324

2425
IDLE = "idle"
26+
RUNNING = "running"
2527
QUEUED = "queued"
2628
UP_TO_DATE = "up_to_date"
2729
DISABLED = "disabled"
@@ -30,13 +32,16 @@ class BlobStorageSyncStatus(enum.StrEnum):
3032
def visit(
3133
self,
3234
idle: typing.Callable[[], T_Result],
35+
running: typing.Callable[[], T_Result],
3336
queued: typing.Callable[[], T_Result],
3437
up_to_date: typing.Callable[[], T_Result],
3538
disabled: typing.Callable[[], T_Result],
3639
error: typing.Callable[[], T_Result],
3740
) -> T_Result:
3841
if self is BlobStorageSyncStatus.IDLE:
3942
return idle()
43+
if self is BlobStorageSyncStatus.RUNNING:
44+
return running()
4045
if self is BlobStorageSyncStatus.QUEUED:
4146
return queued()
4247
if self is BlobStorageSyncStatus.UP_TO_DATE:

langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class CreateBlobStorageIntegrationRequest(UniversalBaseModel):
8585
typing.Optional[dt.datetime], FieldMetadata(alias="exportStartDate")
8686
] = pydantic.Field(default=None)
8787
"""
88-
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
88+
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
8989
"""
9090

9191
compressed: typing.Optional[bool] = pydantic.Field(default=None)

langfuse/api/client.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
DatasetRunItemsClient,
2424
)
2525
from .datasets.client import AsyncDatasetsClient, DatasetsClient
26+
from .experiments.client import AsyncExperimentsClient, ExperimentsClient
2627
from .health.client import AsyncHealthClient, HealthClient
2728
from .ingestion.client import AsyncIngestionClient, IngestionClient
2829
from .legacy.client import AsyncLegacyClient, LegacyClient
@@ -131,6 +132,7 @@ def __init__(
131132
self._dataset_items: typing.Optional[DatasetItemsClient] = None
132133
self._dataset_run_items: typing.Optional[DatasetRunItemsClient] = None
133134
self._datasets: typing.Optional[DatasetsClient] = None
135+
self._experiments: typing.Optional[ExperimentsClient] = None
134136
self._health: typing.Optional[HealthClient] = None
135137
self._ingestion: typing.Optional[IngestionClient] = None
136138
self._legacy: typing.Optional[LegacyClient] = None
@@ -208,6 +210,14 @@ def datasets(self):
208210
self._datasets = DatasetsClient(client_wrapper=self._client_wrapper)
209211
return self._datasets
210212

213+
@property
214+
def experiments(self):
215+
if self._experiments is None:
216+
from .experiments.client import ExperimentsClient # noqa: E402
217+
218+
self._experiments = ExperimentsClient(client_wrapper=self._client_wrapper)
219+
return self._experiments
220+
211221
@property
212222
def health(self):
213223
if self._health is None:
@@ -465,6 +475,7 @@ def __init__(
465475
self._dataset_items: typing.Optional[AsyncDatasetItemsClient] = None
466476
self._dataset_run_items: typing.Optional[AsyncDatasetRunItemsClient] = None
467477
self._datasets: typing.Optional[AsyncDatasetsClient] = None
478+
self._experiments: typing.Optional[AsyncExperimentsClient] = None
468479
self._health: typing.Optional[AsyncHealthClient] = None
469480
self._ingestion: typing.Optional[AsyncIngestionClient] = None
470481
self._legacy: typing.Optional[AsyncLegacyClient] = None
@@ -544,6 +555,16 @@ def datasets(self):
544555
self._datasets = AsyncDatasetsClient(client_wrapper=self._client_wrapper)
545556
return self._datasets
546557

558+
@property
559+
def experiments(self):
560+
if self._experiments is None:
561+
from .experiments.client import AsyncExperimentsClient # noqa: E402
562+
563+
self._experiments = AsyncExperimentsClient(
564+
client_wrapper=self._client_wrapper
565+
)
566+
return self._experiments
567+
547568
@property
548569
def health(self):
549570
if self._health is None:

0 commit comments

Comments
 (0)