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