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