Skip to content
Merged
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
74 changes: 74 additions & 0 deletions langfuse/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
scim,
score_configs,
scores,
scores_v3,
sessions,
trace,
unstable,
Expand Down Expand Up @@ -297,6 +298,31 @@
GetScoresResponseData_Text,
GetScoresResponseTraceData,
)
from .scores_v3 import (
BaseScoreV3,
BooleanScoreV3,
CategoricalScoreV3,
CorrectionScoreV3,
GetScoresV3Meta,
GetScoresV3Response,
NumericScoreV3,
ScoreSubjectExperimentV3,
ScoreSubjectObservationV3,
ScoreSubjectSessionV3,
ScoreSubjectTraceV3,
ScoreSubjectV3,
ScoreSubjectV3_Experiment,
ScoreSubjectV3_Observation,
ScoreSubjectV3_Session,
ScoreSubjectV3_Trace,
ScoreV3,
ScoreV3_Boolean,
ScoreV3_Categorical,
ScoreV3_Correction,
ScoreV3_Numeric,
ScoreV3_Text,
TextScoreV3,
)
from .sessions import PaginatedSessions
from .trace import DeleteTraceResponse, Sort, Traces
_dynamic_imports: typing.Dict[str, str] = {
Expand All @@ -316,6 +342,7 @@
"BasePrompt": ".prompts",
"BaseScore": ".commons",
"BaseScoreV1": ".commons",
"BaseScoreV3": ".scores_v3",
"BlobStorageExportFieldGroup": ".blob_storage_integrations",
"BlobStorageExportFrequency": ".blob_storage_integrations",
"BlobStorageExportMode": ".blob_storage_integrations",
Expand All @@ -329,9 +356,11 @@
"BlobStorageSyncStatus": ".blob_storage_integrations",
"BooleanScore": ".commons",
"BooleanScoreV1": ".commons",
"BooleanScoreV3": ".scores_v3",
"BulkConfig": ".scim",
"CategoricalScore": ".commons",
"CategoricalScoreV1": ".commons",
"CategoricalScoreV3": ".scores_v3",
"ChatMessage": ".prompts",
"ChatMessageType": ".prompts",
"ChatMessageWithPlaceholders": ".prompts",
Expand All @@ -340,6 +369,7 @@
"CommentObjectType": ".commons",
"ConfigCategory": ".commons",
"CorrectionScore": ".commons",
"CorrectionScoreV3": ".scores_v3",
"CreateAnnotationQueueAssignmentResponse": ".annotation_queues",
"CreateAnnotationQueueItemRequest": ".annotation_queues",
"CreateAnnotationQueueRequest": ".annotation_queues",
Expand Down Expand Up @@ -397,6 +427,8 @@
"GetScoresResponseData_Numeric": ".scores",
"GetScoresResponseData_Text": ".scores",
"GetScoresResponseTraceData": ".scores",
"GetScoresV3Meta": ".scores_v3",
"GetScoresV3Response": ".scores_v3",
"HealthResponse": ".health",
"IngestionError": ".ingestion",
"IngestionEvent": ".ingestion",
Expand Down Expand Up @@ -431,6 +463,7 @@
"NotFoundError": ".commons",
"NumericScore": ".commons",
"NumericScoreV1": ".commons",
"NumericScoreV3": ".scores_v3",
"Observation": ".commons",
"ObservationBody": ".ingestion",
"ObservationLevel": ".commons",
Expand Down Expand Up @@ -500,11 +533,26 @@
"ScoreDataType": ".commons",
"ScoreEvent": ".ingestion",
"ScoreSource": ".commons",
"ScoreSubjectExperimentV3": ".scores_v3",
"ScoreSubjectObservationV3": ".scores_v3",
"ScoreSubjectSessionV3": ".scores_v3",
"ScoreSubjectTraceV3": ".scores_v3",
"ScoreSubjectV3": ".scores_v3",
"ScoreSubjectV3_Experiment": ".scores_v3",
"ScoreSubjectV3_Observation": ".scores_v3",
"ScoreSubjectV3_Session": ".scores_v3",
"ScoreSubjectV3_Trace": ".scores_v3",
"ScoreV1": ".commons",
"ScoreV1_Boolean": ".commons",
"ScoreV1_Categorical": ".commons",
"ScoreV1_Numeric": ".commons",
"ScoreV1_Text": ".commons",
"ScoreV3": ".scores_v3",
"ScoreV3_Boolean": ".scores_v3",
"ScoreV3_Categorical": ".scores_v3",
"ScoreV3_Correction": ".scores_v3",
"ScoreV3_Numeric": ".scores_v3",
"ScoreV3_Text": ".scores_v3",
"Score_Boolean": ".commons",
"Score_Categorical": ".commons",
"Score_Correction": ".commons",
Expand All @@ -520,6 +568,7 @@
"TextPrompt": ".prompts",
"TextScore": ".commons",
"TextScoreV1": ".commons",
"TextScoreV3": ".scores_v3",
"Trace": ".commons",
"TraceBody": ".ingestion",
"TraceEvent": ".ingestion",
Expand Down Expand Up @@ -562,6 +611,7 @@
"scim": ".scim",
"score_configs": ".score_configs",
"scores": ".scores",
"scores_v3": ".scores_v3",
"sessions": ".sessions",
"trace": ".trace",
"unstable": ".unstable",
Expand Down Expand Up @@ -613,6 +663,7 @@ def __dir__():
"BasePrompt",
"BaseScore",
"BaseScoreV1",
"BaseScoreV3",
"BlobStorageExportFieldGroup",
"BlobStorageExportFrequency",
"BlobStorageExportMode",
Expand All @@ -626,9 +677,11 @@ def __dir__():
"BlobStorageSyncStatus",
"BooleanScore",
"BooleanScoreV1",
"BooleanScoreV3",
"BulkConfig",
"CategoricalScore",
"CategoricalScoreV1",
"CategoricalScoreV3",
"ChatMessage",
"ChatMessageType",
"ChatMessageWithPlaceholders",
Expand All @@ -637,6 +690,7 @@ def __dir__():
"CommentObjectType",
"ConfigCategory",
"CorrectionScore",
"CorrectionScoreV3",
"CreateAnnotationQueueAssignmentResponse",
"CreateAnnotationQueueItemRequest",
"CreateAnnotationQueueRequest",
Expand Down Expand Up @@ -694,6 +748,8 @@ def __dir__():
"GetScoresResponseData_Numeric",
"GetScoresResponseData_Text",
"GetScoresResponseTraceData",
"GetScoresV3Meta",
"GetScoresV3Response",
"HealthResponse",
"IngestionError",
"IngestionEvent",
Expand Down Expand Up @@ -728,6 +784,7 @@ def __dir__():
"NotFoundError",
"NumericScore",
"NumericScoreV1",
"NumericScoreV3",
"Observation",
"ObservationBody",
"ObservationLevel",
Expand Down Expand Up @@ -797,11 +854,26 @@ def __dir__():
"ScoreDataType",
"ScoreEvent",
"ScoreSource",
"ScoreSubjectExperimentV3",
"ScoreSubjectObservationV3",
"ScoreSubjectSessionV3",
"ScoreSubjectTraceV3",
"ScoreSubjectV3",
"ScoreSubjectV3_Experiment",
"ScoreSubjectV3_Observation",
"ScoreSubjectV3_Session",
"ScoreSubjectV3_Trace",
"ScoreV1",
"ScoreV1_Boolean",
"ScoreV1_Categorical",
"ScoreV1_Numeric",
"ScoreV1_Text",
"ScoreV3",
"ScoreV3_Boolean",
"ScoreV3_Categorical",
"ScoreV3_Correction",
"ScoreV3_Numeric",
"ScoreV3_Text",
"Score_Boolean",
"Score_Categorical",
"Score_Correction",
Expand All @@ -817,6 +889,7 @@ def __dir__():
"TextPrompt",
"TextScore",
"TextScoreV1",
"TextScoreV3",
"Trace",
"TraceBody",
"TraceEvent",
Expand Down Expand Up @@ -859,6 +932,7 @@ def __dir__():
"scim",
"score_configs",
"scores",
"scores_v3",
"sessions",
"trace",
"unstable",
Expand Down
19 changes: 19 additions & 0 deletions langfuse/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from .scim.client import AsyncScimClient, ScimClient
from .score_configs.client import AsyncScoreConfigsClient, ScoreConfigsClient
from .scores.client import AsyncScoresClient, ScoresClient
from .scores_v3.client import AsyncScoresV3Client, ScoresV3Client
from .sessions.client import AsyncSessionsClient, SessionsClient
from .trace.client import AsyncTraceClient, TraceClient
from .unstable.client import AsyncUnstableClient, UnstableClient
Expand Down Expand Up @@ -145,6 +146,7 @@ def __init__(
self._prompts: typing.Optional[PromptsClient] = None
self._scim: typing.Optional[ScimClient] = None
self._score_configs: typing.Optional[ScoreConfigsClient] = None
self._scores_v3: typing.Optional[ScoresV3Client] = None
self._scores: typing.Optional[ScoresClient] = None
self._sessions: typing.Optional[SessionsClient] = None
self._trace: typing.Optional[TraceClient] = None
Expand Down Expand Up @@ -336,6 +338,14 @@ def score_configs(self):
)
return self._score_configs

@property
def scores_v3(self):
if self._scores_v3 is None:
from .scores_v3.client import ScoresV3Client # noqa: E402

self._scores_v3 = ScoresV3Client(client_wrapper=self._client_wrapper)
return self._scores_v3

@property
def scores(self):
if self._scores is None:
Expand Down Expand Up @@ -470,6 +480,7 @@ def __init__(
self._prompts: typing.Optional[AsyncPromptsClient] = None
self._scim: typing.Optional[AsyncScimClient] = None
self._score_configs: typing.Optional[AsyncScoreConfigsClient] = None
self._scores_v3: typing.Optional[AsyncScoresV3Client] = None
self._scores: typing.Optional[AsyncScoresClient] = None
self._sessions: typing.Optional[AsyncSessionsClient] = None
self._trace: typing.Optional[AsyncTraceClient] = None
Expand Down Expand Up @@ -665,6 +676,14 @@ def score_configs(self):
)
return self._score_configs

@property
def scores_v3(self):
if self._scores_v3 is None:
from .scores_v3.client import AsyncScoresV3Client # noqa: E402

self._scores_v3 = AsyncScoresV3Client(client_wrapper=self._client_wrapper)
return self._scores_v3

@property
def scores(self):
if self._scores is None:
Expand Down
112 changes: 112 additions & 0 deletions langfuse/api/scores_v3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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 (
BaseScoreV3,
BooleanScoreV3,
CategoricalScoreV3,
CorrectionScoreV3,
GetScoresV3Meta,
GetScoresV3Response,
NumericScoreV3,
ScoreSubjectExperimentV3,
ScoreSubjectObservationV3,
ScoreSubjectSessionV3,
ScoreSubjectTraceV3,
ScoreSubjectV3,
ScoreSubjectV3_Experiment,
ScoreSubjectV3_Observation,
ScoreSubjectV3_Session,
ScoreSubjectV3_Trace,
ScoreV3,
ScoreV3_Boolean,
ScoreV3_Categorical,
ScoreV3_Correction,
ScoreV3_Numeric,
ScoreV3_Text,
TextScoreV3,
)
_dynamic_imports: typing.Dict[str, str] = {
"BaseScoreV3": ".types",
"BooleanScoreV3": ".types",
"CategoricalScoreV3": ".types",
"CorrectionScoreV3": ".types",
"GetScoresV3Meta": ".types",
"GetScoresV3Response": ".types",
"NumericScoreV3": ".types",
"ScoreSubjectExperimentV3": ".types",
"ScoreSubjectObservationV3": ".types",
"ScoreSubjectSessionV3": ".types",
"ScoreSubjectTraceV3": ".types",
"ScoreSubjectV3": ".types",
"ScoreSubjectV3_Experiment": ".types",
"ScoreSubjectV3_Observation": ".types",
"ScoreSubjectV3_Session": ".types",
"ScoreSubjectV3_Trace": ".types",
"ScoreV3": ".types",
"ScoreV3_Boolean": ".types",
"ScoreV3_Categorical": ".types",
"ScoreV3_Correction": ".types",
"ScoreV3_Numeric": ".types",
"ScoreV3_Text": ".types",
"TextScoreV3": ".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__ = [
"BaseScoreV3",
"BooleanScoreV3",
"CategoricalScoreV3",
"CorrectionScoreV3",
"GetScoresV3Meta",
"GetScoresV3Response",
"NumericScoreV3",
"ScoreSubjectExperimentV3",
"ScoreSubjectObservationV3",
"ScoreSubjectSessionV3",
"ScoreSubjectTraceV3",
"ScoreSubjectV3",
"ScoreSubjectV3_Experiment",
"ScoreSubjectV3_Observation",
"ScoreSubjectV3_Session",
"ScoreSubjectV3_Trace",
"ScoreV3",
"ScoreV3_Boolean",
"ScoreV3_Categorical",
"ScoreV3_Correction",
"ScoreV3_Numeric",
"ScoreV3_Text",
"TextScoreV3",
]
Loading