Skip to content
Closed
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
4 changes: 2 additions & 2 deletions langfuse/api/blob_storage_integrations/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def upsert_blob_storage_integration(
Path prefix for exported files (must end with forward slash if provided)

export_start_date : typing.Optional[dt.datetime]
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).

compressed : typing.Optional[bool]
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
Expand Down Expand Up @@ -421,7 +421,7 @@ async def upsert_blob_storage_integration(
Path prefix for exported files (must end with forward slash if provided)

export_start_date : typing.Optional[dt.datetime]
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).

compressed : typing.Optional[bool]
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
Expand Down
4 changes: 2 additions & 2 deletions langfuse/api/blob_storage_integrations/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def upsert_blob_storage_integration(
Path prefix for exported files (must end with forward slash if provided)

export_start_date : typing.Optional[dt.datetime]
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).

compressed : typing.Optional[bool]
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
Expand Down Expand Up @@ -696,7 +696,7 @@ async def upsert_blob_storage_integration(
Path prefix for exported files (must end with forward slash if provided)

export_start_date : typing.Optional[dt.datetime]
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).

compressed : typing.Optional[bool]
Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class BlobStorageSyncStatus(enum.StrEnum):
Sync status of the blob storage integration:
- `disabled` — integration is not enabled
- `error` — last export failed (see `lastError` for details)
- `idle` — enabled but has never exported yet
- `running` — an export job is currently being processed
- `queued` — next export is overdue (`nextSyncAt` is in the past) and waiting to be picked up by the worker
- `idle` — enabled but has never exported yet and no export is queued
- `up_to_date` — all available data has been exported; next export is scheduled for the future

**ETL usage**: poll this endpoint and check for `up_to_date` status. Compare `lastSyncAt` against your
Expand All @@ -22,6 +23,7 @@ class BlobStorageSyncStatus(enum.StrEnum):
"""

IDLE = "idle"
RUNNING = "running"
QUEUED = "queued"
UP_TO_DATE = "up_to_date"
DISABLED = "disabled"
Expand All @@ -30,13 +32,16 @@ class BlobStorageSyncStatus(enum.StrEnum):
def visit(
self,
idle: typing.Callable[[], T_Result],
running: typing.Callable[[], T_Result],
queued: typing.Callable[[], T_Result],
up_to_date: typing.Callable[[], T_Result],
disabled: typing.Callable[[], T_Result],
error: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageSyncStatus.IDLE:
return idle()
if self is BlobStorageSyncStatus.RUNNING:
return running()
if self is BlobStorageSyncStatus.QUEUED:
return queued()
if self is BlobStorageSyncStatus.UP_TO_DATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CreateBlobStorageIntegrationRequest(UniversalBaseModel):
typing.Optional[dt.datetime], FieldMetadata(alias="exportStartDate")
] = pydantic.Field(default=None)
"""
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE)
Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
"""

compressed: typing.Optional[bool] = pydantic.Field(default=None)
Expand Down
39 changes: 38 additions & 1 deletion langfuse/api/unstable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
UnauthorizedError,
UnprocessableContentError,
)
from . import commons, errors, evaluation_rules, evaluators
from . import commons, dashboard_widgets, errors, evaluation_rules, evaluators
from .commons import (
ArrayOptionsEvaluationRuleFilter,
BooleanEvaluationRuleFilter,
Expand Down Expand Up @@ -73,6 +73,19 @@
StringObjectEvaluationRuleFilter,
StringOptionsEvaluationRuleFilter,
)
from .dashboard_widgets import (
CreateDashboardWidgetRequest,
DashboardWidget,
DashboardWidgetChartConfig,
DashboardWidgetChartType,
DashboardWidgetDefaultSort,
DashboardWidgetDimension,
DashboardWidgetFilter,
DashboardWidgetMetric,
DashboardWidgetMetricAggregation,
DashboardWidgetSortOrder,
DashboardWidgetView,
)
from .evaluation_rules import (
CodeEvaluationRuleEvaluatorReference,
CreateCodeEvaluationRuleRequest,
Expand Down Expand Up @@ -114,12 +127,23 @@
"ConflictError": ".errors",
"CreateCodeEvaluationRuleRequest": ".evaluation_rules",
"CreateCodeEvaluatorRequest": ".evaluators",
"CreateDashboardWidgetRequest": ".dashboard_widgets",
"CreateEvaluationRuleRequest": ".evaluation_rules",
"CreateEvaluatorRequest": ".evaluators",
"CreateEvaluatorRequest_Code": ".evaluators",
"CreateEvaluatorRequest_LlmAsJudge": ".evaluators",
"CreateLlmAsJudgeEvaluationRuleRequest": ".evaluation_rules",
"CreateLlmAsJudgeEvaluatorRequest": ".evaluators",
"DashboardWidget": ".dashboard_widgets",
"DashboardWidgetChartConfig": ".dashboard_widgets",
"DashboardWidgetChartType": ".dashboard_widgets",
"DashboardWidgetDefaultSort": ".dashboard_widgets",
"DashboardWidgetDimension": ".dashboard_widgets",
"DashboardWidgetFilter": ".dashboard_widgets",
"DashboardWidgetMetric": ".dashboard_widgets",
"DashboardWidgetMetricAggregation": ".dashboard_widgets",
"DashboardWidgetSortOrder": ".dashboard_widgets",
"DashboardWidgetView": ".dashboard_widgets",
"DateTimeEvaluationRuleFilter": ".commons",
"DeleteEvaluationRuleResponse": ".evaluation_rules",
"DeleteEvaluatorResponse": ".evaluators",
Expand Down Expand Up @@ -191,6 +215,7 @@
"UnprocessableContentError": ".errors",
"UpdateEvaluationRuleRequest": ".evaluation_rules",
"commons": ".commons",
"dashboard_widgets": ".dashboard_widgets",
"errors": ".errors",
"evaluation_rules": ".evaluation_rules",
"evaluators": ".evaluators",
Expand Down Expand Up @@ -236,12 +261,23 @@ def __dir__():
"ConflictError",
"CreateCodeEvaluationRuleRequest",
"CreateCodeEvaluatorRequest",
"CreateDashboardWidgetRequest",
"CreateEvaluationRuleRequest",
"CreateEvaluatorRequest",
"CreateEvaluatorRequest_Code",
"CreateEvaluatorRequest_LlmAsJudge",
"CreateLlmAsJudgeEvaluationRuleRequest",
"CreateLlmAsJudgeEvaluatorRequest",
"DashboardWidget",
"DashboardWidgetChartConfig",
"DashboardWidgetChartType",
"DashboardWidgetDefaultSort",
"DashboardWidgetDimension",
"DashboardWidgetFilter",
"DashboardWidgetMetric",
"DashboardWidgetMetricAggregation",
"DashboardWidgetSortOrder",
"DashboardWidgetView",
"DateTimeEvaluationRuleFilter",
"DeleteEvaluationRuleResponse",
"DeleteEvaluatorResponse",
Expand Down Expand Up @@ -313,6 +349,7 @@ def __dir__():
"UnprocessableContentError",
"UpdateEvaluationRuleRequest",
"commons",
"dashboard_widgets",
"errors",
"evaluation_rules",
"evaluators",
Expand Down
26 changes: 26 additions & 0 deletions langfuse/api/unstable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
from .raw_client import AsyncRawUnstableClient, RawUnstableClient

if typing.TYPE_CHECKING:
from .dashboard_widgets.client import (
AsyncDashboardWidgetsClient,
DashboardWidgetsClient,
)
from .evaluation_rules.client import (
AsyncEvaluationRulesClient,
EvaluationRulesClient,
Expand All @@ -19,6 +23,7 @@ class UnstableClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._raw_client = RawUnstableClient(client_wrapper=client_wrapper)
self._client_wrapper = client_wrapper
self._dashboard_widgets: typing.Optional[DashboardWidgetsClient] = None
self._evaluation_rules: typing.Optional[EvaluationRulesClient] = None
self._evaluators: typing.Optional[EvaluatorsClient] = None

Expand All @@ -33,6 +38,16 @@ def with_raw_response(self) -> RawUnstableClient:
"""
return self._raw_client

@property
def dashboard_widgets(self):
if self._dashboard_widgets is None:
from .dashboard_widgets.client import DashboardWidgetsClient # noqa: E402

self._dashboard_widgets = DashboardWidgetsClient(
client_wrapper=self._client_wrapper
)
return self._dashboard_widgets

@property
def evaluation_rules(self):
if self._evaluation_rules is None:
Expand All @@ -56,6 +71,7 @@ class AsyncUnstableClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._raw_client = AsyncRawUnstableClient(client_wrapper=client_wrapper)
self._client_wrapper = client_wrapper
self._dashboard_widgets: typing.Optional[AsyncDashboardWidgetsClient] = None
self._evaluation_rules: typing.Optional[AsyncEvaluationRulesClient] = None
self._evaluators: typing.Optional[AsyncEvaluatorsClient] = None

Expand All @@ -70,6 +86,16 @@ def with_raw_response(self) -> AsyncRawUnstableClient:
"""
return self._raw_client

@property
def dashboard_widgets(self):
if self._dashboard_widgets is None:
from .dashboard_widgets.client import AsyncDashboardWidgetsClient # noqa: E402

self._dashboard_widgets = AsyncDashboardWidgetsClient(
client_wrapper=self._client_wrapper
)
return self._dashboard_widgets

@property
def evaluation_rules(self):
if self._evaluation_rules is None:
Expand Down
76 changes: 76 additions & 0 deletions langfuse/api/unstable/dashboard_widgets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This file was auto-generated by Fern from our API Definition.

# isort: skip_file

import typing
from importlib import import_module

if typing.TYPE_CHECKING:
from .types import (
CreateDashboardWidgetRequest,
DashboardWidget,
DashboardWidgetChartConfig,
DashboardWidgetChartType,
DashboardWidgetDefaultSort,
DashboardWidgetDimension,
DashboardWidgetFilter,
DashboardWidgetMetric,
DashboardWidgetMetricAggregation,
DashboardWidgetSortOrder,
DashboardWidgetView,
)
_dynamic_imports: typing.Dict[str, str] = {
"CreateDashboardWidgetRequest": ".types",
"DashboardWidget": ".types",
"DashboardWidgetChartConfig": ".types",
"DashboardWidgetChartType": ".types",
"DashboardWidgetDefaultSort": ".types",
"DashboardWidgetDimension": ".types",
"DashboardWidgetFilter": ".types",
"DashboardWidgetMetric": ".types",
"DashboardWidgetMetricAggregation": ".types",
"DashboardWidgetSortOrder": ".types",
"DashboardWidgetView": ".types",
}


def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(
f"No {attr_name} found in _dynamic_imports for module name -> {__name__}"
)
try:
module = import_module(module_name, __package__)
if module_name == f".{attr_name}":
return module
else:
return getattr(module, attr_name)
except ImportError as e:
raise ImportError(
f"Failed to import {attr_name} from {module_name}: {e}"
) from e
except AttributeError as e:
raise AttributeError(
f"Failed to get {attr_name} from {module_name}: {e}"
) from e


def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)


__all__ = [
"CreateDashboardWidgetRequest",
"DashboardWidget",
"DashboardWidgetChartConfig",
"DashboardWidgetChartType",
"DashboardWidgetDefaultSort",
"DashboardWidgetDimension",
"DashboardWidgetFilter",
"DashboardWidgetMetric",
"DashboardWidgetMetricAggregation",
"DashboardWidgetSortOrder",
"DashboardWidgetView",
]
Loading
Loading