Skip to content

Commit 24444ff

Browse files
committed
push
1 parent 79bd6c8 commit 24444ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+366
-125
lines changed

langfuse/api/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
PricingTierOperator,
104104
Score,
105105
ScoreConfig,
106+
ScoreConfigDataType,
106107
ScoreDataType,
107108
ScoreSource,
108109
ScoreV1,
@@ -222,6 +223,7 @@
222223
ApiKeyList,
223224
ApiKeyResponse,
224225
ApiKeySummary,
226+
Organization,
225227
Project,
226228
ProjectDeletionResponse,
227229
Projects,
@@ -420,6 +422,7 @@
420422
"OpenAiResponseUsageSchema": ".ingestion",
421423
"OpenAiUsage": ".ingestion",
422424
"OptionalObservationBody": ".ingestion",
425+
"Organization": ".projects",
423426
"OrganizationApiKey": ".organizations",
424427
"OrganizationApiKeysResponse": ".organizations",
425428
"OrganizationProject": ".organizations",
@@ -470,6 +473,7 @@
470473
"Score": ".commons",
471474
"ScoreBody": ".ingestion",
472475
"ScoreConfig": ".commons",
476+
"ScoreConfigDataType": ".commons",
473477
"ScoreConfigs": ".score_configs",
474478
"ScoreDataType": ".commons",
475479
"ScoreEvent": ".ingestion",
@@ -703,6 +707,7 @@ def __dir__():
703707
"OpenAiResponseUsageSchema",
704708
"OpenAiUsage",
705709
"OptionalObservationBody",
710+
"Organization",
706711
"OrganizationApiKey",
707712
"OrganizationApiKeysResponse",
708713
"OrganizationProject",
@@ -753,6 +758,7 @@ def __dir__():
753758
"Score",
754759
"ScoreBody",
755760
"ScoreConfig",
761+
"ScoreConfigDataType",
756762
"ScoreConfigs",
757763
"ScoreDataType",
758764
"ScoreEvent",

langfuse/api/commons/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
PricingTierOperator,
3939
Score,
4040
ScoreConfig,
41+
ScoreConfigDataType,
4142
ScoreDataType,
4243
ScoreSource,
4344
ScoreV1,
@@ -97,6 +98,7 @@
9798
"PricingTierOperator": ".types",
9899
"Score": ".types",
99100
"ScoreConfig": ".types",
101+
"ScoreConfigDataType": ".types",
100102
"ScoreDataType": ".types",
101103
"ScoreSource": ".types",
102104
"ScoreV1": ".types",
@@ -179,6 +181,7 @@ def __dir__():
179181
"PricingTierOperator",
180182
"Score",
181183
"ScoreConfig",
184+
"ScoreConfigDataType",
182185
"ScoreDataType",
183186
"ScoreSource",
184187
"ScoreV1",

langfuse/api/commons/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from .pricing_tier_operator import PricingTierOperator
3838
from .score import Score, Score_Boolean, Score_Categorical, Score_Numeric
3939
from .score_config import ScoreConfig
40+
from .score_config_data_type import ScoreConfigDataType
4041
from .score_data_type import ScoreDataType
4142
from .score_source import ScoreSource
4243
from .score_v1 import ScoreV1, ScoreV1_Boolean, ScoreV1_Categorical, ScoreV1_Numeric
@@ -78,6 +79,7 @@
7879
"PricingTierOperator": ".pricing_tier_operator",
7980
"Score": ".score",
8081
"ScoreConfig": ".score_config",
82+
"ScoreConfigDataType": ".score_config_data_type",
8183
"ScoreDataType": ".score_data_type",
8284
"ScoreSource": ".score_source",
8385
"ScoreV1": ".score_v1",
@@ -155,6 +157,7 @@ def __dir__():
155157
"PricingTierOperator",
156158
"Score",
157159
"ScoreConfig",
160+
"ScoreConfigDataType",
158161
"ScoreDataType",
159162
"ScoreSource",
160163
"ScoreV1",

langfuse/api/commons/types/base_score.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,32 @@ class BaseScore(UniversalBaseModel):
1414
id: str
1515
trace_id: typing_extensions.Annotated[
1616
typing.Optional[str], FieldMetadata(alias="traceId")
17-
] = None
17+
] = pydantic.Field(default=None)
18+
"""
19+
The trace ID associated with the score
20+
"""
21+
1822
session_id: typing_extensions.Annotated[
1923
typing.Optional[str], FieldMetadata(alias="sessionId")
20-
] = None
24+
] = pydantic.Field(default=None)
25+
"""
26+
The session ID associated with the score
27+
"""
28+
2129
observation_id: typing_extensions.Annotated[
2230
typing.Optional[str], FieldMetadata(alias="observationId")
23-
] = None
31+
] = pydantic.Field(default=None)
32+
"""
33+
The observation ID associated with the score
34+
"""
35+
2436
dataset_run_id: typing_extensions.Annotated[
2537
typing.Optional[str], FieldMetadata(alias="datasetRunId")
26-
] = None
38+
] = pydantic.Field(default=None)
39+
"""
40+
The dataset run ID associated with the score
41+
"""
42+
2743
name: str
2844
source: ScoreSource
2945
timestamp: dt.datetime
@@ -35,9 +51,21 @@ class BaseScore(UniversalBaseModel):
3551
]
3652
author_user_id: typing_extensions.Annotated[
3753
typing.Optional[str], FieldMetadata(alias="authorUserId")
38-
] = None
39-
comment: typing.Optional[str] = None
40-
metadata: typing.Optional[typing.Any] = None
54+
] = pydantic.Field(default=None)
55+
"""
56+
The user ID of the author
57+
"""
58+
59+
comment: typing.Optional[str] = pydantic.Field(default=None)
60+
"""
61+
Comment on the score
62+
"""
63+
64+
metadata: typing.Any = pydantic.Field()
65+
"""
66+
Metadata associated with the score
67+
"""
68+
4169
config_id: typing_extensions.Annotated[
4270
typing.Optional[str], FieldMetadata(alias="configId")
4371
] = pydantic.Field(default=None)
@@ -52,7 +80,7 @@ class BaseScore(UniversalBaseModel):
5280
The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
5381
"""
5482

55-
environment: typing.Optional[str] = pydantic.Field(default=None)
83+
environment: str = pydantic.Field()
5684
"""
5785
The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
5886
"""

langfuse/api/commons/types/base_score_v1.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ class BaseScoreV1(UniversalBaseModel):
1717
source: ScoreSource
1818
observation_id: typing_extensions.Annotated[
1919
typing.Optional[str], FieldMetadata(alias="observationId")
20-
] = None
20+
] = pydantic.Field(default=None)
21+
"""
22+
The observation ID associated with the score
23+
"""
24+
2125
timestamp: dt.datetime
2226
created_at: typing_extensions.Annotated[
2327
dt.datetime, FieldMetadata(alias="createdAt")
@@ -27,9 +31,21 @@ class BaseScoreV1(UniversalBaseModel):
2731
]
2832
author_user_id: typing_extensions.Annotated[
2933
typing.Optional[str], FieldMetadata(alias="authorUserId")
30-
] = None
31-
comment: typing.Optional[str] = None
32-
metadata: typing.Optional[typing.Any] = None
34+
] = pydantic.Field(default=None)
35+
"""
36+
The user ID of the author
37+
"""
38+
39+
comment: typing.Optional[str] = pydantic.Field(default=None)
40+
"""
41+
Comment on the score
42+
"""
43+
44+
metadata: typing.Any = pydantic.Field()
45+
"""
46+
Metadata associated with the score
47+
"""
48+
3349
config_id: typing_extensions.Annotated[
3450
typing.Optional[str], FieldMetadata(alias="configId")
3551
] = pydantic.Field(default=None)
@@ -44,7 +60,7 @@ class BaseScoreV1(UniversalBaseModel):
4460
The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
4561
"""
4662

47-
environment: typing.Optional[str] = pydantic.Field(default=None)
63+
environment: str = pydantic.Field()
4864
"""
4965
The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
5066
"""

langfuse/api/commons/types/comment.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ class Comment(UniversalBaseModel):
2626
content: str
2727
author_user_id: typing_extensions.Annotated[
2828
typing.Optional[str], FieldMetadata(alias="authorUserId")
29-
] = None
29+
] = pydantic.Field(default=None)
30+
"""
31+
The user ID of the comment author
32+
"""
3033

3134
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
3235
extra="allow", frozen=True

langfuse/api/commons/types/dataset.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@
1212
class Dataset(UniversalBaseModel):
1313
id: str
1414
name: str
15-
description: typing.Optional[str] = None
16-
metadata: typing.Optional[typing.Any] = None
15+
description: typing.Optional[str] = pydantic.Field(default=None)
16+
"""
17+
Description of the dataset
18+
"""
19+
20+
metadata: typing.Any = pydantic.Field()
21+
"""
22+
Metadata associated with the dataset
23+
"""
24+
1725
input_schema: typing_extensions.Annotated[
1826
typing.Optional[typing.Any], FieldMetadata(alias="inputSchema")
1927
] = pydantic.Field(default=None)

langfuse/api/commons/types/dataset_item.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,37 @@
1313
class DatasetItem(UniversalBaseModel):
1414
id: str
1515
status: DatasetStatus
16-
input: typing.Optional[typing.Any] = None
16+
input: typing.Any = pydantic.Field()
17+
"""
18+
Input data for the dataset item
19+
"""
20+
1721
expected_output: typing_extensions.Annotated[
18-
typing.Optional[typing.Any], FieldMetadata(alias="expectedOutput")
19-
] = None
20-
metadata: typing.Optional[typing.Any] = None
22+
typing.Any, FieldMetadata(alias="expectedOutput")
23+
] = pydantic.Field()
24+
"""
25+
Expected output for the dataset item
26+
"""
27+
28+
metadata: typing.Any = pydantic.Field()
29+
"""
30+
Metadata associated with the dataset item
31+
"""
32+
2133
source_trace_id: typing_extensions.Annotated[
2234
typing.Optional[str], FieldMetadata(alias="sourceTraceId")
23-
] = None
35+
] = pydantic.Field(default=None)
36+
"""
37+
The trace ID that sourced this dataset item
38+
"""
39+
2440
source_observation_id: typing_extensions.Annotated[
2541
typing.Optional[str], FieldMetadata(alias="sourceObservationId")
26-
] = None
42+
] = pydantic.Field(default=None)
43+
"""
44+
The observation ID that sourced this dataset item
45+
"""
46+
2747
dataset_id: typing_extensions.Annotated[str, FieldMetadata(alias="datasetId")]
2848
dataset_name: typing_extensions.Annotated[str, FieldMetadata(alias="datasetName")]
2949
created_at: typing_extensions.Annotated[

langfuse/api/commons/types/dataset_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DatasetRun(UniversalBaseModel):
2525
Description of the run
2626
"""
2727

28-
metadata: typing.Optional[typing.Any] = pydantic.Field(default=None)
28+
metadata: typing.Any = pydantic.Field()
2929
"""
3030
Metadata of the dataset run
3131
"""

langfuse/api/commons/types/dataset_run_item.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class DatasetRunItem(UniversalBaseModel):
2323
trace_id: typing_extensions.Annotated[str, FieldMetadata(alias="traceId")]
2424
observation_id: typing_extensions.Annotated[
2525
typing.Optional[str], FieldMetadata(alias="observationId")
26-
] = None
26+
] = pydantic.Field(default=None)
27+
"""
28+
The observation ID associated with this run item
29+
"""
30+
2731
created_at: typing_extensions.Annotated[
2832
dt.datetime, FieldMetadata(alias="createdAt")
2933
]

0 commit comments

Comments
 (0)