langfuse.api.ingestion

  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        BaseEvent,
 11        CreateEventBody,
 12        CreateEventEvent,
 13        CreateGenerationBody,
 14        CreateGenerationEvent,
 15        CreateObservationEvent,
 16        CreateSpanBody,
 17        CreateSpanEvent,
 18        IngestionError,
 19        IngestionEvent,
 20        IngestionEvent_EventCreate,
 21        IngestionEvent_GenerationCreate,
 22        IngestionEvent_GenerationUpdate,
 23        IngestionEvent_ObservationCreate,
 24        IngestionEvent_ObservationUpdate,
 25        IngestionEvent_ScoreCreate,
 26        IngestionEvent_SdkLog,
 27        IngestionEvent_SpanCreate,
 28        IngestionEvent_SpanUpdate,
 29        IngestionEvent_TraceCreate,
 30        IngestionResponse,
 31        IngestionSuccess,
 32        IngestionUsage,
 33        ObservationBody,
 34        ObservationType,
 35        OpenAiCompletionUsageSchema,
 36        OpenAiResponseUsageSchema,
 37        OpenAiUsage,
 38        OptionalObservationBody,
 39        ScoreBody,
 40        ScoreEvent,
 41        SdkLogBody,
 42        SdkLogEvent,
 43        TraceBody,
 44        TraceEvent,
 45        UpdateEventBody,
 46        UpdateGenerationBody,
 47        UpdateGenerationEvent,
 48        UpdateObservationEvent,
 49        UpdateSpanBody,
 50        UpdateSpanEvent,
 51        UsageDetails,
 52    )
 53_dynamic_imports: typing.Dict[str, str] = {
 54    "BaseEvent": ".types",
 55    "CreateEventBody": ".types",
 56    "CreateEventEvent": ".types",
 57    "CreateGenerationBody": ".types",
 58    "CreateGenerationEvent": ".types",
 59    "CreateObservationEvent": ".types",
 60    "CreateSpanBody": ".types",
 61    "CreateSpanEvent": ".types",
 62    "IngestionError": ".types",
 63    "IngestionEvent": ".types",
 64    "IngestionEvent_EventCreate": ".types",
 65    "IngestionEvent_GenerationCreate": ".types",
 66    "IngestionEvent_GenerationUpdate": ".types",
 67    "IngestionEvent_ObservationCreate": ".types",
 68    "IngestionEvent_ObservationUpdate": ".types",
 69    "IngestionEvent_ScoreCreate": ".types",
 70    "IngestionEvent_SdkLog": ".types",
 71    "IngestionEvent_SpanCreate": ".types",
 72    "IngestionEvent_SpanUpdate": ".types",
 73    "IngestionEvent_TraceCreate": ".types",
 74    "IngestionResponse": ".types",
 75    "IngestionSuccess": ".types",
 76    "IngestionUsage": ".types",
 77    "ObservationBody": ".types",
 78    "ObservationType": ".types",
 79    "OpenAiCompletionUsageSchema": ".types",
 80    "OpenAiResponseUsageSchema": ".types",
 81    "OpenAiUsage": ".types",
 82    "OptionalObservationBody": ".types",
 83    "ScoreBody": ".types",
 84    "ScoreEvent": ".types",
 85    "SdkLogBody": ".types",
 86    "SdkLogEvent": ".types",
 87    "TraceBody": ".types",
 88    "TraceEvent": ".types",
 89    "UpdateEventBody": ".types",
 90    "UpdateGenerationBody": ".types",
 91    "UpdateGenerationEvent": ".types",
 92    "UpdateObservationEvent": ".types",
 93    "UpdateSpanBody": ".types",
 94    "UpdateSpanEvent": ".types",
 95    "UsageDetails": ".types",
 96}
 97
 98
 99def __getattr__(attr_name: str) -> typing.Any:
100    module_name = _dynamic_imports.get(attr_name)
101    if module_name is None:
102        raise AttributeError(
103            f"No {attr_name} found in _dynamic_imports for module name -> {__name__}"
104        )
105    try:
106        module = import_module(module_name, __package__)
107        if module_name == f".{attr_name}":
108            return module
109        else:
110            return getattr(module, attr_name)
111    except ImportError as e:
112        raise ImportError(
113            f"Failed to import {attr_name} from {module_name}: {e}"
114        ) from e
115    except AttributeError as e:
116        raise AttributeError(
117            f"Failed to get {attr_name} from {module_name}: {e}"
118        ) from e
119
120
121def __dir__():
122    lazy_attrs = list(_dynamic_imports.keys())
123    return sorted(lazy_attrs)
124
125
126__all__ = [
127    "BaseEvent",
128    "CreateEventBody",
129    "CreateEventEvent",
130    "CreateGenerationBody",
131    "CreateGenerationEvent",
132    "CreateObservationEvent",
133    "CreateSpanBody",
134    "CreateSpanEvent",
135    "IngestionError",
136    "IngestionEvent",
137    "IngestionEvent_EventCreate",
138    "IngestionEvent_GenerationCreate",
139    "IngestionEvent_GenerationUpdate",
140    "IngestionEvent_ObservationCreate",
141    "IngestionEvent_ObservationUpdate",
142    "IngestionEvent_ScoreCreate",
143    "IngestionEvent_SdkLog",
144    "IngestionEvent_SpanCreate",
145    "IngestionEvent_SpanUpdate",
146    "IngestionEvent_TraceCreate",
147    "IngestionResponse",
148    "IngestionSuccess",
149    "IngestionUsage",
150    "ObservationBody",
151    "ObservationType",
152    "OpenAiCompletionUsageSchema",
153    "OpenAiResponseUsageSchema",
154    "OpenAiUsage",
155    "OptionalObservationBody",
156    "ScoreBody",
157    "ScoreEvent",
158    "SdkLogBody",
159    "SdkLogEvent",
160    "TraceBody",
161    "TraceEvent",
162    "UpdateEventBody",
163    "UpdateGenerationBody",
164    "UpdateGenerationEvent",
165    "UpdateObservationEvent",
166    "UpdateSpanBody",
167    "UpdateSpanEvent",
168    "UsageDetails",
169]
BaseEvent
CreateEventBody
CreateEventEvent
CreateGenerationBody
CreateGenerationEvent
CreateObservationEvent
CreateSpanBody
CreateSpanEvent
IngestionError
IngestionEvent
IngestionEvent_EventCreate
IngestionEvent_GenerationCreate
IngestionEvent_GenerationUpdate
IngestionEvent_ObservationCreate
IngestionEvent_ObservationUpdate
IngestionEvent_ScoreCreate
IngestionEvent_SdkLog
IngestionEvent_SpanCreate
IngestionEvent_SpanUpdate
IngestionEvent_TraceCreate
IngestionResponse
IngestionSuccess
IngestionUsage
ObservationBody
ObservationType
OpenAiCompletionUsageSchema
OpenAiResponseUsageSchema
OpenAiUsage
OptionalObservationBody
ScoreBody
ScoreEvent
SdkLogBody
SdkLogEvent
TraceBody
TraceEvent
UpdateEventBody
UpdateGenerationBody
UpdateGenerationEvent
UpdateObservationEvent
UpdateSpanBody
UpdateSpanEvent
UsageDetails