langfuse.api.commons
1# This file was auto-generated by Fern from our API Definition. 2 3# isort: skip_file 4 5import typing 6from importlib import import_module 7 8if typing.TYPE_CHECKING: 9 from .types import ( 10 BaseScore, 11 BaseScoreV1, 12 BooleanScore, 13 BooleanScoreV1, 14 CategoricalScore, 15 CategoricalScoreV1, 16 Comment, 17 CommentObjectType, 18 ConfigCategory, 19 CorrectionScore, 20 CreateScoreValue, 21 Dataset, 22 DatasetItem, 23 DatasetItemMediaReference, 24 DatasetItemMediaReferenceField, 25 DatasetItemMediaReferenceMedia, 26 DatasetRun, 27 DatasetRunItem, 28 DatasetRunWithItems, 29 DatasetStatus, 30 Deprecation, 31 MapValue, 32 Model, 33 ModelPrice, 34 ModelUsageUnit, 35 NumericScore, 36 NumericScoreV1, 37 Observation, 38 ObservationLevel, 39 ObservationV2, 40 ObservationsView, 41 ObservationsViewSingle, 42 PricingTier, 43 PricingTierCondition, 44 PricingTierInput, 45 PricingTierOperator, 46 Score, 47 ScoreConfig, 48 ScoreConfigDataType, 49 ScoreDataType, 50 ScoreSource, 51 ScoreV1, 52 ScoreV1_Boolean, 53 ScoreV1_Categorical, 54 ScoreV1_Numeric, 55 ScoreV1_Text, 56 Score_Boolean, 57 Score_Categorical, 58 Score_Correction, 59 Score_Numeric, 60 Score_Text, 61 Session, 62 SessionWithTraces, 63 TextScore, 64 TextScoreV1, 65 Trace, 66 TraceWithDetails, 67 TraceWithFullDetails, 68 Usage, 69 ) 70 from .errors import ( 71 AccessDeniedError, 72 Error, 73 MethodNotAllowedError, 74 NotFoundError, 75 UnauthorizedError, 76 ) 77_dynamic_imports: typing.Dict[str, str] = { 78 "AccessDeniedError": ".errors", 79 "BaseScore": ".types", 80 "BaseScoreV1": ".types", 81 "BooleanScore": ".types", 82 "BooleanScoreV1": ".types", 83 "CategoricalScore": ".types", 84 "CategoricalScoreV1": ".types", 85 "Comment": ".types", 86 "CommentObjectType": ".types", 87 "ConfigCategory": ".types", 88 "CorrectionScore": ".types", 89 "CreateScoreValue": ".types", 90 "Dataset": ".types", 91 "DatasetItem": ".types", 92 "DatasetItemMediaReference": ".types", 93 "DatasetItemMediaReferenceField": ".types", 94 "DatasetItemMediaReferenceMedia": ".types", 95 "DatasetRun": ".types", 96 "DatasetRunItem": ".types", 97 "DatasetRunWithItems": ".types", 98 "DatasetStatus": ".types", 99 "Deprecation": ".types", 100 "Error": ".errors", 101 "MapValue": ".types", 102 "MethodNotAllowedError": ".errors", 103 "Model": ".types", 104 "ModelPrice": ".types", 105 "ModelUsageUnit": ".types", 106 "NotFoundError": ".errors", 107 "NumericScore": ".types", 108 "NumericScoreV1": ".types", 109 "Observation": ".types", 110 "ObservationLevel": ".types", 111 "ObservationV2": ".types", 112 "ObservationsView": ".types", 113 "ObservationsViewSingle": ".types", 114 "PricingTier": ".types", 115 "PricingTierCondition": ".types", 116 "PricingTierInput": ".types", 117 "PricingTierOperator": ".types", 118 "Score": ".types", 119 "ScoreConfig": ".types", 120 "ScoreConfigDataType": ".types", 121 "ScoreDataType": ".types", 122 "ScoreSource": ".types", 123 "ScoreV1": ".types", 124 "ScoreV1_Boolean": ".types", 125 "ScoreV1_Categorical": ".types", 126 "ScoreV1_Numeric": ".types", 127 "ScoreV1_Text": ".types", 128 "Score_Boolean": ".types", 129 "Score_Categorical": ".types", 130 "Score_Correction": ".types", 131 "Score_Numeric": ".types", 132 "Score_Text": ".types", 133 "Session": ".types", 134 "SessionWithTraces": ".types", 135 "TextScore": ".types", 136 "TextScoreV1": ".types", 137 "Trace": ".types", 138 "TraceWithDetails": ".types", 139 "TraceWithFullDetails": ".types", 140 "UnauthorizedError": ".errors", 141 "Usage": ".types", 142} 143 144 145def __getattr__(attr_name: str) -> typing.Any: 146 module_name = _dynamic_imports.get(attr_name) 147 if module_name is None: 148 raise AttributeError( 149 f"No {attr_name} found in _dynamic_imports for module name -> {__name__}" 150 ) 151 try: 152 module = import_module(module_name, __package__) 153 if module_name == f".{attr_name}": 154 return module 155 else: 156 return getattr(module, attr_name) 157 except ImportError as e: 158 raise ImportError( 159 f"Failed to import {attr_name} from {module_name}: {e}" 160 ) from e 161 except AttributeError as e: 162 raise AttributeError( 163 f"Failed to get {attr_name} from {module_name}: {e}" 164 ) from e 165 166 167def __dir__(): 168 lazy_attrs = list(_dynamic_imports.keys()) 169 return sorted(lazy_attrs) 170 171 172__all__ = [ 173 "AccessDeniedError", 174 "BaseScore", 175 "BaseScoreV1", 176 "BooleanScore", 177 "BooleanScoreV1", 178 "CategoricalScore", 179 "CategoricalScoreV1", 180 "Comment", 181 "CommentObjectType", 182 "ConfigCategory", 183 "CorrectionScore", 184 "CreateScoreValue", 185 "Dataset", 186 "DatasetItem", 187 "DatasetItemMediaReference", 188 "DatasetItemMediaReferenceField", 189 "DatasetItemMediaReferenceMedia", 190 "DatasetRun", 191 "DatasetRunItem", 192 "DatasetRunWithItems", 193 "DatasetStatus", 194 "Deprecation", 195 "Error", 196 "MapValue", 197 "MethodNotAllowedError", 198 "Model", 199 "ModelPrice", 200 "ModelUsageUnit", 201 "NotFoundError", 202 "NumericScore", 203 "NumericScoreV1", 204 "Observation", 205 "ObservationLevel", 206 "ObservationV2", 207 "ObservationsView", 208 "ObservationsViewSingle", 209 "PricingTier", 210 "PricingTierCondition", 211 "PricingTierInput", 212 "PricingTierOperator", 213 "Score", 214 "ScoreConfig", 215 "ScoreConfigDataType", 216 "ScoreDataType", 217 "ScoreSource", 218 "ScoreV1", 219 "ScoreV1_Boolean", 220 "ScoreV1_Categorical", 221 "ScoreV1_Numeric", 222 "ScoreV1_Text", 223 "Score_Boolean", 224 "Score_Categorical", 225 "Score_Correction", 226 "Score_Numeric", 227 "Score_Text", 228 "Session", 229 "SessionWithTraces", 230 "TextScore", 231 "TextScoreV1", 232 "Trace", 233 "TraceWithDetails", 234 "TraceWithFullDetails", 235 "UnauthorizedError", 236 "Usage", 237]
AccessDeniedError
BaseScore
BaseScoreV1
BooleanScore
BooleanScoreV1
CategoricalScore
CategoricalScoreV1
Comment
CommentObjectType
ConfigCategory
CorrectionScore
CreateScoreValue
Dataset
DatasetItem
DatasetItemMediaReference
DatasetItemMediaReferenceField
DatasetItemMediaReferenceMedia
DatasetRun
DatasetRunItem
DatasetRunWithItems
DatasetStatus
Deprecation
Error
MapValue
MethodNotAllowedError
Model
ModelPrice
ModelUsageUnit
NotFoundError
NumericScore
NumericScoreV1
Observation
ObservationLevel
ObservationV2
ObservationsView
ObservationsViewSingle
PricingTier
PricingTierCondition
PricingTierInput
PricingTierOperator
Score
ScoreConfig
ScoreConfigDataType
ScoreDataType
ScoreSource
ScoreV1
ScoreV1_Boolean
ScoreV1_Categorical
ScoreV1_Numeric
ScoreV1_Text
Score_Boolean
Score_Categorical
Score_Correction
Score_Numeric
Score_Text
Session
SessionWithTraces
TextScore
TextScoreV1
Trace
TraceWithDetails
TraceWithFullDetails
Usage