{"version":3,"file":"index.mjs","sources":["../src/storage.ts","../src/publicApi.ts","../src/langfuse.ts","../src/openai/LangfuseSingleton.ts","../src/openai/parseOpenAI.ts","../src/openai/utils.ts","../src/openai/traceMethod.ts","../src/openai/observeOpenAI.ts"],"sourcesContent":["import { type LangfuseOptions } from \"./types\";\n\nexport type LangfuseStorage = {\n  getItem: (key: string) => string | null | undefined;\n  setItem: (key: string, value: string) => void;\n  removeItem: (key: string) => void;\n  clear: () => void;\n  getAllKeys: () => readonly string[];\n};\n\n// Methods partially borrowed from quirksmode.org/js/cookies.html\nexport const cookieStore: LangfuseStorage = {\n  getItem(key) {\n    try {\n      const nameEQ = key + \"=\";\n      const ca = document.cookie.split(\";\");\n      for (let i = 0; i < ca.length; i++) {\n        let c = ca[i];\n        while (c.charAt(0) == \" \") {\n          c = c.substring(1, c.length);\n        }\n        if (c.indexOf(nameEQ) === 0) {\n          return decodeURIComponent(c.substring(nameEQ.length, c.length));\n        }\n      }\n    } catch (err) {}\n    return null;\n  },\n\n  setItem(key: string, value: string) {\n    try {\n      const cdomain = \"\",\n        expires = \"\",\n        secure = \"\";\n\n      const new_cookie_val = key + \"=\" + encodeURIComponent(value) + expires + \"; path=/\" + cdomain + secure;\n      document.cookie = new_cookie_val;\n    } catch (err) {\n      return;\n    }\n  },\n\n  removeItem(name) {\n    try {\n      cookieStore.setItem(name, \"\");\n    } catch (err) {\n      return;\n    }\n  },\n  clear() {\n    document.cookie = \"\";\n  },\n  getAllKeys() {\n    const ca = document.cookie.split(\";\");\n    const keys = [];\n\n    for (let i = 0; i < ca.length; i++) {\n      let c = ca[i];\n      while (c.charAt(0) == \" \") {\n        c = c.substring(1, c.length);\n      }\n      keys.push(c.split(\"=\")[0]);\n    }\n\n    return keys;\n  },\n};\n\nconst createStorageLike = (store: any): LangfuseStorage => {\n  return {\n    getItem(key) {\n      return store.getItem(key);\n    },\n\n    setItem(key, value) {\n      store.setItem(key, value);\n    },\n\n    removeItem(key) {\n      store.removeItem(key);\n    },\n    clear() {\n      store.clear();\n    },\n    getAllKeys() {\n      const keys = [];\n      for (const key in localStorage) {\n        keys.push(key);\n      }\n      return keys;\n    },\n  };\n};\n\nconst checkStoreIsSupported = (storage: LangfuseStorage, key = \"__mplssupport__\"): boolean => {\n  if (!window) {\n    return false;\n  }\n  try {\n    const val = \"xyz\";\n    storage.setItem(key, val);\n    if (storage.getItem(key) !== val) {\n      return false;\n    }\n    storage.removeItem(key);\n    return true;\n  } catch (err) {\n    return false;\n  }\n};\n\nlet localStore: LangfuseStorage | undefined = undefined;\nlet sessionStore: LangfuseStorage | undefined = undefined;\n\nconst createMemoryStorage = (): LangfuseStorage => {\n  const _cache: { [key: string]: any | undefined } = {};\n\n  const store: LangfuseStorage = {\n    getItem(key) {\n      return _cache[key];\n    },\n\n    setItem(key, value) {\n      _cache[key] = value !== null ? value : undefined;\n    },\n\n    removeItem(key) {\n      delete _cache[key];\n    },\n    clear() {\n      for (const key in _cache) {\n        delete _cache[key];\n      }\n    },\n    getAllKeys() {\n      const keys = [];\n      for (const key in _cache) {\n        keys.push(key);\n      }\n      return keys;\n    },\n  };\n  return store;\n};\n\nexport const getStorage = (type: LangfuseOptions[\"persistence\"], window: Window | undefined): LangfuseStorage => {\n  if (typeof window !== undefined && window) {\n    if (!localStorage) {\n      const _localStore = createStorageLike(window.localStorage);\n      localStore = checkStoreIsSupported(_localStore) ? _localStore : undefined;\n    }\n\n    if (!sessionStore) {\n      const _sessionStore = createStorageLike(window.sessionStorage);\n      sessionStore = checkStoreIsSupported(_sessionStore) ? _sessionStore : undefined;\n    }\n  }\n\n  switch (type) {\n    case \"cookie\":\n      return cookieStore || localStore || sessionStore || createMemoryStorage();\n    case \"localStorage\":\n      return localStore || sessionStore || createMemoryStorage();\n    case \"sessionStorage\":\n      return sessionStore || createMemoryStorage();\n    case \"memory\":\n      return createMemoryStorage();\n    default:\n      return createMemoryStorage();\n  }\n};\n","/* eslint-disable */\n/* tslint:disable */\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##\n * ##                                                           ##\n * ## AUTHOR: acacode                                           ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n/** AnnotationQueueStatus */\nexport type ApiAnnotationQueueStatus = \"PENDING\" | \"COMPLETED\";\n\n/** AnnotationQueueObjectType */\nexport type ApiAnnotationQueueObjectType = \"TRACE\" | \"OBSERVATION\";\n\n/** AnnotationQueue */\nexport interface ApiAnnotationQueue {\n  id: string;\n  name: string;\n  description?: string | null;\n  scoreConfigIds: string[];\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n}\n\n/** AnnotationQueueItem */\nexport interface ApiAnnotationQueueItem {\n  id: string;\n  queueId: string;\n  objectId: string;\n  objectType: ApiAnnotationQueueObjectType;\n  status: ApiAnnotationQueueStatus;\n  /** @format date-time */\n  completedAt?: string | null;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n}\n\n/** PaginatedAnnotationQueues */\nexport interface ApiPaginatedAnnotationQueues {\n  data: ApiAnnotationQueue[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** PaginatedAnnotationQueueItems */\nexport interface ApiPaginatedAnnotationQueueItems {\n  data: ApiAnnotationQueueItem[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** CreateAnnotationQueueItemRequest */\nexport interface ApiCreateAnnotationQueueItemRequest {\n  objectId: string;\n  objectType: ApiAnnotationQueueObjectType;\n  /** Defaults to PENDING for new queue items */\n  status?: ApiAnnotationQueueStatus | null;\n}\n\n/** UpdateAnnotationQueueItemRequest */\nexport interface ApiUpdateAnnotationQueueItemRequest {\n  status?: ApiAnnotationQueueStatus | null;\n}\n\n/** DeleteAnnotationQueueItemResponse */\nexport interface ApiDeleteAnnotationQueueItemResponse {\n  success: boolean;\n  message: string;\n}\n\n/** CreateCommentRequest */\nexport interface ApiCreateCommentRequest {\n  /** The id of the project to attach the comment to. */\n  projectId: string;\n  /** The type of the object to attach the comment to (trace, observation, session, prompt). */\n  objectType: string;\n  /** The id of the object to attach the comment to. If this does not reference a valid existing object, an error will be thrown. */\n  objectId: string;\n  /** The content of the comment. May include markdown. Currently limited to 3000 characters. */\n  content: string;\n  /** The id of the user who created the comment. */\n  authorUserId?: string | null;\n}\n\n/** CreateCommentResponse */\nexport interface ApiCreateCommentResponse {\n  /** The id of the created object in Langfuse */\n  id: string;\n}\n\n/** GetCommentsResponse */\nexport interface ApiGetCommentsResponse {\n  data: ApiComment[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** Trace */\nexport interface ApiTrace {\n  /** The unique identifier of a trace */\n  id: string;\n  /**\n   * The timestamp when the trace was created\n   * @format date-time\n   */\n  timestamp: string;\n  /** The name of the trace */\n  name?: string | null;\n  /** The input data of the trace. Can be any JSON. */\n  input?: any;\n  /** The output data of the trace. Can be any JSON. */\n  output?: any;\n  /** The session identifier associated with the trace */\n  sessionId?: string | null;\n  /** The release version of the application when the trace was created */\n  release?: string | null;\n  /** The version of the trace */\n  version?: string | null;\n  /** The user identifier associated with the trace */\n  userId?: string | null;\n  /** The metadata associated with the trace. Can be any JSON. */\n  metadata?: any;\n  /** The tags associated with the trace. Can be an array of strings or null. */\n  tags?: string[] | null;\n  /** Public traces are accessible via url without login */\n  public?: boolean | null;\n  /** The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */\n  environment?: string | null;\n}\n\n/** TraceWithDetails */\nexport type ApiTraceWithDetails = ApiTrace & {\n  /** Path of trace in Langfuse UI */\n  htmlPath: string;\n  /**\n   * Latency of trace in seconds\n   * @format double\n   */\n  latency: number;\n  /**\n   * Cost of trace in USD\n   * @format double\n   */\n  totalCost: number;\n  /** List of observation ids */\n  observations: string[];\n  /** List of score ids */\n  scores: string[];\n};\n\n/** TraceWithFullDetails */\nexport type ApiTraceWithFullDetails = ApiTrace & {\n  /** Path of trace in Langfuse UI */\n  htmlPath: string;\n  /**\n   * Latency of trace in seconds\n   * @format double\n   */\n  latency: number;\n  /**\n   * Cost of trace in USD\n   * @format double\n   */\n  totalCost: number;\n  /** List of observations */\n  observations: ApiObservationsView[];\n  /** List of scores */\n  scores: ApiScore[];\n};\n\n/** Session */\nexport interface ApiSession {\n  id: string;\n  /** @format date-time */\n  createdAt: string;\n  projectId: string;\n  /** The environment from which this session originated. */\n  environment?: string | null;\n}\n\n/** SessionWithTraces */\nexport type ApiSessionWithTraces = ApiSession & {\n  traces: ApiTrace[];\n};\n\n/** Observation */\nexport interface ApiObservation {\n  /** The unique identifier of the observation */\n  id: string;\n  /** The trace ID associated with the observation */\n  traceId?: string | null;\n  /** The type of the observation */\n  type: string;\n  /** The name of the observation */\n  name?: string | null;\n  /**\n   * The start time of the observation\n   * @format date-time\n   */\n  startTime: string;\n  /**\n   * The end time of the observation.\n   * @format date-time\n   */\n  endTime?: string | null;\n  /**\n   * The completion start time of the observation\n   * @format date-time\n   */\n  completionStartTime?: string | null;\n  /** The model used for the observation */\n  model?: string | null;\n  /** The parameters of the model used for the observation */\n  modelParameters?: Record<string, ApiMapValue>;\n  /** The input data of the observation */\n  input?: any;\n  /** The version of the observation */\n  version?: string | null;\n  /** Additional metadata of the observation */\n  metadata?: any;\n  /** The output data of the observation */\n  output?: any;\n  /** (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation */\n  usage?: ApiUsage | null;\n  /** The level of the observation */\n  level: ApiObservationLevel;\n  /** The status message of the observation */\n  statusMessage?: string | null;\n  /** The parent observation ID */\n  parentObservationId?: string | null;\n  /** The prompt ID associated with the observation */\n  promptId?: string | null;\n  /** The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested. */\n  usageDetails?: Record<string, number>;\n  /** The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested. */\n  costDetails?: Record<string, number>;\n  /** The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */\n  environment?: string | null;\n}\n\n/** ObservationsView */\nexport type ApiObservationsView = ApiObservation & {\n  /** The name of the prompt associated with the observation */\n  promptName?: string | null;\n  /** The version of the prompt associated with the observation */\n  promptVersion?: number | null;\n  /** The unique identifier of the model */\n  modelId?: string | null;\n  /**\n   * The price of the input in USD\n   * @format double\n   */\n  inputPrice?: number | null;\n  /**\n   * The price of the output in USD.\n   * @format double\n   */\n  outputPrice?: number | null;\n  /**\n   * The total price in USD.\n   * @format double\n   */\n  totalPrice?: number | null;\n  /**\n   * (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD\n   * @format double\n   */\n  calculatedInputCost?: number | null;\n  /**\n   * (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD\n   * @format double\n   */\n  calculatedOutputCost?: number | null;\n  /**\n   * (Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD\n   * @format double\n   */\n  calculatedTotalCost?: number | null;\n  /**\n   * The latency in seconds.\n   * @format double\n   */\n  latency?: number | null;\n  /**\n   * The time to the first token in seconds\n   * @format double\n   */\n  timeToFirstToken?: number | null;\n};\n\n/**\n * Usage\n * (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost\n */\nexport interface ApiUsage {\n  /** Number of input units (e.g. tokens) */\n  input?: number | null;\n  /** Number of output units (e.g. tokens) */\n  output?: number | null;\n  /** Defaults to input+output if not set */\n  total?: number | null;\n  /** Unit of usage in Langfuse */\n  unit?: ApiModelUsageUnit | null;\n  /**\n   * USD input cost\n   * @format double\n   */\n  inputCost?: number | null;\n  /**\n   * USD output cost\n   * @format double\n   */\n  outputCost?: number | null;\n  /**\n   * USD total cost, defaults to input+output\n   * @format double\n   */\n  totalCost?: number | null;\n}\n\n/**\n * ScoreConfig\n * Configuration for a score\n */\nexport interface ApiScoreConfig {\n  id: string;\n  name: string;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n  projectId: string;\n  dataType: ApiScoreDataType;\n  /** Whether the score config is archived. Defaults to false */\n  isArchived: boolean;\n  /**\n   * Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞\n   * @format double\n   */\n  minValue?: number | null;\n  /**\n   * Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞\n   * @format double\n   */\n  maxValue?: number | null;\n  /** Configures custom categories for categorical scores */\n  categories?: ApiConfigCategory[] | null;\n  description?: string | null;\n}\n\n/** ConfigCategory */\nexport interface ApiConfigCategory {\n  /** @format double */\n  value: number;\n  label: string;\n}\n\n/** BaseScore */\nexport interface ApiBaseScore {\n  id: string;\n  traceId: string;\n  name: string;\n  source: ApiScoreSource;\n  observationId?: string | null;\n  /** @format date-time */\n  timestamp: string;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n  authorUserId?: string | null;\n  comment?: string | null;\n  /** Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range */\n  configId?: string | null;\n  /** Reference an annotation queue on a score. Populated if the score was initially created in an annotation queue. */\n  queueId?: string | null;\n  /** The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */\n  environment?: string | null;\n}\n\n/** NumericScore */\nexport type ApiNumericScore = ApiBaseScore & {\n  /**\n   * The numeric value of the score\n   * @format double\n   */\n  value: number;\n};\n\n/** BooleanScore */\nexport type ApiBooleanScore = ApiBaseScore & {\n  /**\n   * The numeric value of the score. Equals 1 for \"True\" and 0 for \"False\"\n   * @format double\n   */\n  value: number;\n  /** The string representation of the score value. Is inferred from the numeric value and equals \"True\" or \"False\" */\n  stringValue: string;\n};\n\n/** CategoricalScore */\nexport type ApiCategoricalScore = ApiBaseScore & {\n  /**\n   * Only defined if a config is linked. Represents the numeric category mapping of the stringValue\n   * @format double\n   */\n  value?: number | null;\n  /** The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category */\n  stringValue: string;\n};\n\n/** Score */\nexport type ApiScore =\n  | ({\n      dataType: \"NUMERIC\";\n    } & ApiNumericScore)\n  | ({\n      dataType: \"CATEGORICAL\";\n    } & ApiCategoricalScore)\n  | ({\n      dataType: \"BOOLEAN\";\n    } & ApiBooleanScore);\n\n/**\n * CreateScoreValue\n * The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores\n */\nexport type ApiCreateScoreValue = number | string;\n\n/** Comment */\nexport interface ApiComment {\n  id: string;\n  projectId: string;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n  objectType: ApiCommentObjectType;\n  objectId: string;\n  content: string;\n  authorUserId?: string | null;\n}\n\n/** Dataset */\nexport interface ApiDataset {\n  id: string;\n  name: string;\n  description?: string | null;\n  metadata?: any;\n  projectId: string;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n}\n\n/** DatasetItem */\nexport interface ApiDatasetItem {\n  id: string;\n  status: ApiDatasetStatus;\n  input?: any;\n  expectedOutput?: any;\n  metadata?: any;\n  sourceTraceId?: string | null;\n  sourceObservationId?: string | null;\n  datasetId: string;\n  datasetName: string;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n}\n\n/** DatasetRunItem */\nexport interface ApiDatasetRunItem {\n  id: string;\n  datasetRunId: string;\n  datasetRunName: string;\n  datasetItemId: string;\n  traceId: string;\n  observationId?: string | null;\n  /** @format date-time */\n  createdAt: string;\n  /** @format date-time */\n  updatedAt: string;\n}\n\n/** DatasetRun */\nexport interface ApiDatasetRun {\n  /** Unique identifier of the dataset run */\n  id: string;\n  /** Name of the dataset run */\n  name: string;\n  /** Description of the run */\n  description?: string | null;\n  /** Metadata of the dataset run */\n  metadata?: any;\n  /** Id of the associated dataset */\n  datasetId: string;\n  /** Name of the associated dataset */\n  datasetName: string;\n  /**\n   * The date and time when the dataset run was created\n   * @format date-time\n   */\n  createdAt: string;\n  /**\n   * The date and time when the dataset run was last updated\n   * @format date-time\n   */\n  updatedAt: string;\n}\n\n/** DatasetRunWithItems */\nexport type ApiDatasetRunWithItems = ApiDatasetRun & {\n  datasetRunItems: ApiDatasetRunItem[];\n};\n\n/**\n * Model\n * Model definition used for transforming usage into USD cost and/or tokenization.\n */\nexport interface ApiModel {\n  id: string;\n  /** Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime */\n  modelName: string;\n  /** Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$` */\n  matchPattern: string;\n  /**\n   * Apply only to generations which are newer than this ISO date.\n   * @format date-time\n   */\n  startDate?: string | null;\n  /** Unit used by this model. */\n  unit?: ApiModelUsageUnit | null;\n  /**\n   * Price (USD) per input unit\n   * @format double\n   */\n  inputPrice?: number | null;\n  /**\n   * Price (USD) per output unit\n   * @format double\n   */\n  outputPrice?: number | null;\n  /**\n   * Price (USD) per total unit. Cannot be set if input or output price is set.\n   * @format double\n   */\n  totalPrice?: number | null;\n  /** Optional. Tokenizer to be applied to observations which match to this model. See docs for more details. */\n  tokenizerId?: string | null;\n  /** Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details. */\n  tokenizerConfig?: any;\n  isLangfuseManaged: boolean;\n}\n\n/**\n * ModelUsageUnit\n * Unit of usage in Langfuse\n */\nexport type ApiModelUsageUnit = \"CHARACTERS\" | \"TOKENS\" | \"MILLISECONDS\" | \"SECONDS\" | \"IMAGES\" | \"REQUESTS\";\n\n/** ObservationLevel */\nexport type ApiObservationLevel = \"DEBUG\" | \"DEFAULT\" | \"WARNING\" | \"ERROR\";\n\n/** MapValue */\nexport type ApiMapValue = string | null | number | null | boolean | null | string[] | null;\n\n/** CommentObjectType */\nexport type ApiCommentObjectType = \"TRACE\" | \"OBSERVATION\" | \"SESSION\" | \"PROMPT\";\n\n/** DatasetStatus */\nexport type ApiDatasetStatus = \"ACTIVE\" | \"ARCHIVED\";\n\n/** ScoreSource */\nexport type ApiScoreSource = \"ANNOTATION\" | \"API\" | \"EVAL\";\n\n/** ScoreDataType */\nexport type ApiScoreDataType = \"NUMERIC\" | \"BOOLEAN\" | \"CATEGORICAL\";\n\n/** DeleteDatasetItemResponse */\nexport interface ApiDeleteDatasetItemResponse {\n  /** Success message after deletion */\n  message: string;\n}\n\n/** CreateDatasetItemRequest */\nexport interface ApiCreateDatasetItemRequest {\n  datasetName: string;\n  input?: any;\n  expectedOutput?: any;\n  metadata?: any;\n  sourceTraceId?: string | null;\n  sourceObservationId?: string | null;\n  /** Dataset items are upserted on their id. Id needs to be unique (project-level) and cannot be reused across datasets. */\n  id?: string | null;\n  /** Defaults to ACTIVE for newly created items */\n  status?: ApiDatasetStatus | null;\n}\n\n/** PaginatedDatasetItems */\nexport interface ApiPaginatedDatasetItems {\n  data: ApiDatasetItem[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** CreateDatasetRunItemRequest */\nexport interface ApiCreateDatasetRunItemRequest {\n  runName: string;\n  /** Description of the run. If run exists, description will be updated. */\n  runDescription?: string | null;\n  /** Metadata of the dataset run, updates run if run already exists */\n  metadata?: any;\n  datasetItemId: string;\n  observationId?: string | null;\n  /** traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId. */\n  traceId?: string | null;\n}\n\n/** PaginatedDatasets */\nexport interface ApiPaginatedDatasets {\n  data: ApiDataset[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** CreateDatasetRequest */\nexport interface ApiCreateDatasetRequest {\n  name: string;\n  description?: string | null;\n  metadata?: any;\n}\n\n/** PaginatedDatasetRuns */\nexport interface ApiPaginatedDatasetRuns {\n  data: ApiDatasetRun[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** DeleteDatasetRunResponse */\nexport interface ApiDeleteDatasetRunResponse {\n  message: string;\n}\n\n/** HealthResponse */\nexport interface ApiHealthResponse {\n  /**\n   * Langfuse server version\n   * @example \"1.25.0\"\n   */\n  version: string;\n  /** @example \"OK\" */\n  status: string;\n}\n\n/** IngestionEvent */\nexport type ApiIngestionEvent =\n  | ({\n      type: \"trace-create\";\n    } & ApiTraceEvent)\n  | ({\n      type: \"score-create\";\n    } & ApiScoreEvent)\n  | ({\n      type: \"span-create\";\n    } & ApiCreateSpanEvent)\n  | ({\n      type: \"span-update\";\n    } & ApiUpdateSpanEvent)\n  | ({\n      type: \"generation-create\";\n    } & ApiCreateGenerationEvent)\n  | ({\n      type: \"generation-update\";\n    } & ApiUpdateGenerationEvent)\n  | ({\n      type: \"event-create\";\n    } & ApiCreateEventEvent)\n  | ({\n      type: \"sdk-log\";\n    } & ApiSDKLogEvent)\n  | ({\n      type: \"observation-create\";\n    } & ApiCreateObservationEvent)\n  | ({\n      type: \"observation-update\";\n    } & ApiUpdateObservationEvent);\n\n/** ObservationType */\nexport type ApiObservationType = \"SPAN\" | \"GENERATION\" | \"EVENT\";\n\n/** IngestionUsage */\nexport type ApiIngestionUsage = ApiUsage | ApiOpenAIUsage;\n\n/**\n * OpenAIUsage\n * Usage interface of OpenAI for improved compatibility.\n */\nexport interface ApiOpenAIUsage {\n  promptTokens?: number | null;\n  completionTokens?: number | null;\n  totalTokens?: number | null;\n}\n\n/** OptionalObservationBody */\nexport interface ApiOptionalObservationBody {\n  traceId?: string | null;\n  name?: string | null;\n  /** @format date-time */\n  startTime?: string | null;\n  metadata?: any;\n  input?: any;\n  output?: any;\n  level?: ApiObservationLevel | null;\n  statusMessage?: string | null;\n  parentObservationId?: string | null;\n  version?: string | null;\n  environment?: string | null;\n}\n\n/** CreateEventBody */\nexport type ApiCreateEventBody = ApiOptionalObservationBody & {\n  id?: string | null;\n};\n\n/** UpdateEventBody */\nexport type ApiUpdateEventBody = ApiOptionalObservationBody & {\n  id: string;\n};\n\n/** CreateSpanBody */\nexport type ApiCreateSpanBody = ApiCreateEventBody & {\n  /** @format date-time */\n  endTime?: string | null;\n};\n\n/** UpdateSpanBody */\nexport type ApiUpdateSpanBody = ApiUpdateEventBody & {\n  /** @format date-time */\n  endTime?: string | null;\n};\n\n/** CreateGenerationBody */\nexport type ApiCreateGenerationBody = ApiCreateSpanBody & {\n  /** @format date-time */\n  completionStartTime?: string | null;\n  model?: string | null;\n  modelParameters?: Record<string, ApiMapValue>;\n  usage?: ApiIngestionUsage | null;\n  usageDetails?: ApiUsageDetails | null;\n  costDetails?: Record<string, number>;\n  promptName?: string | null;\n  promptVersion?: number | null;\n};\n\n/** UpdateGenerationBody */\nexport type ApiUpdateGenerationBody = ApiUpdateSpanBody & {\n  /** @format date-time */\n  completionStartTime?: string | null;\n  model?: string | null;\n  modelParameters?: Record<string, ApiMapValue>;\n  usage?: ApiIngestionUsage | null;\n  promptName?: string | null;\n  usageDetails?: ApiUsageDetails | null;\n  costDetails?: Record<string, number>;\n  promptVersion?: number | null;\n};\n\n/** ObservationBody */\nexport interface ApiObservationBody {\n  id?: string | null;\n  traceId?: string | null;\n  type: ApiObservationType;\n  name?: string | null;\n  /** @format date-time */\n  startTime?: string | null;\n  /** @format date-time */\n  endTime?: string | null;\n  /** @format date-time */\n  completionStartTime?: string | null;\n  model?: string | null;\n  modelParameters?: Record<string, ApiMapValue>;\n  input?: any;\n  version?: string | null;\n  metadata?: any;\n  output?: any;\n  /** (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost */\n  usage?: ApiUsage | null;\n  level?: ApiObservationLevel | null;\n  statusMessage?: string | null;\n  parentObservationId?: string | null;\n  environment?: string | null;\n}\n\n/** TraceBody */\nexport interface ApiTraceBody {\n  id?: string | null;\n  /** @format date-time */\n  timestamp?: string | null;\n  name?: string | null;\n  userId?: string | null;\n  input?: any;\n  output?: any;\n  sessionId?: string | null;\n  release?: string | null;\n  version?: string | null;\n  metadata?: any;\n  tags?: string[] | null;\n  environment?: string | null;\n  /** Make trace publicly accessible via url */\n  public?: boolean | null;\n}\n\n/** SDKLogBody */\nexport interface ApiSDKLogBody {\n  log: any;\n}\n\n/** ScoreBody */\nexport interface ApiScoreBody {\n  id?: string | null;\n  /** @example \"cdef-1234-5678-90ab\" */\n  traceId: string;\n  /** @example \"novelty\" */\n  name: string;\n  environment?: string | null;\n  /** The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false) */\n  value: ApiCreateScoreValue;\n  observationId?: string | null;\n  comment?: string | null;\n  /** When set, must match the score value's type. If not set, will be inferred from the score value or config */\n  dataType?: ApiScoreDataType | null;\n  /** Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values */\n  configId?: string | null;\n}\n\n/** BaseEvent */\nexport interface ApiBaseEvent {\n  /** UUID v4 that identifies the event */\n  id: string;\n  /** Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). */\n  timestamp: string;\n  /** Optional. Metadata field used by the Langfuse SDKs for debugging. */\n  metadata?: any;\n}\n\n/** TraceEvent */\nexport type ApiTraceEvent = ApiBaseEvent & {\n  body: ApiTraceBody;\n};\n\n/** CreateObservationEvent */\nexport type ApiCreateObservationEvent = ApiBaseEvent & {\n  body: ApiObservationBody;\n};\n\n/** UpdateObservationEvent */\nexport type ApiUpdateObservationEvent = ApiBaseEvent & {\n  body: ApiObservationBody;\n};\n\n/** ScoreEvent */\nexport type ApiScoreEvent = ApiBaseEvent & {\n  body: ApiScoreBody;\n};\n\n/** SDKLogEvent */\nexport type ApiSDKLogEvent = ApiBaseEvent & {\n  body: ApiSDKLogBody;\n};\n\n/** CreateGenerationEvent */\nexport type ApiCreateGenerationEvent = ApiBaseEvent & {\n  body: ApiCreateGenerationBody;\n};\n\n/** UpdateGenerationEvent */\nexport type ApiUpdateGenerationEvent = ApiBaseEvent & {\n  body: ApiUpdateGenerationBody;\n};\n\n/** CreateSpanEvent */\nexport type ApiCreateSpanEvent = ApiBaseEvent & {\n  body: ApiCreateSpanBody;\n};\n\n/** UpdateSpanEvent */\nexport type ApiUpdateSpanEvent = ApiBaseEvent & {\n  body: ApiUpdateSpanBody;\n};\n\n/** CreateEventEvent */\nexport type ApiCreateEventEvent = ApiBaseEvent & {\n  body: ApiCreateEventBody;\n};\n\n/** IngestionSuccess */\nexport interface ApiIngestionSuccess {\n  id: string;\n  status: number;\n}\n\n/** IngestionError */\nexport interface ApiIngestionError {\n  id: string;\n  status: number;\n  message?: string | null;\n  error?: any;\n}\n\n/** IngestionResponse */\nexport interface ApiIngestionResponse {\n  successes: ApiIngestionSuccess[];\n  errors: ApiIngestionError[];\n}\n\n/**\n * OpenAICompletionUsageSchema\n * OpenAI Usage schema from (Chat-)Completion APIs\n */\nexport interface ApiOpenAICompletionUsageSchema {\n  prompt_tokens: number;\n  completion_tokens: number;\n  total_tokens: number;\n  prompt_tokens_details?: Record<string, number | null>;\n  completion_tokens_details?: Record<string, number | null>;\n}\n\n/**\n * OpenAIResponseUsageSchema\n * OpenAI Usage schema from Response API\n */\nexport interface ApiOpenAIResponseUsageSchema {\n  input_tokens: number;\n  output_tokens: number;\n  total_tokens: number;\n  input_tokens_details?: Record<string, number | null>;\n  output_tokens_details?: Record<string, number | null>;\n}\n\n/** UsageDetails */\nexport type ApiUsageDetails = Record<string, number> | ApiOpenAICompletionUsageSchema | ApiOpenAIResponseUsageSchema;\n\n/** GetMediaResponse */\nexport interface ApiGetMediaResponse {\n  /** The unique langfuse identifier of a media record */\n  mediaId: string;\n  /** The MIME type of the media record */\n  contentType: string;\n  /** The size of the media record in bytes */\n  contentLength: number;\n  /**\n   * The date and time when the media record was uploaded\n   * @format date-time\n   */\n  uploadedAt: string;\n  /** The download URL of the media record */\n  url: string;\n  /** The expiry date and time of the media record download URL */\n  urlExpiry: string;\n}\n\n/** PatchMediaBody */\nexport interface ApiPatchMediaBody {\n  /**\n   * The date and time when the media record was uploaded\n   * @format date-time\n   */\n  uploadedAt: string;\n  /** The HTTP status code of the upload */\n  uploadHttpStatus: number;\n  /** The HTTP error message of the upload */\n  uploadHttpError?: string | null;\n  /** The time in milliseconds it took to upload the media record */\n  uploadTimeMs?: number | null;\n}\n\n/** GetMediaUploadUrlRequest */\nexport interface ApiGetMediaUploadUrlRequest {\n  /** The trace ID associated with the media record */\n  traceId: string;\n  /** The observation ID associated with the media record. If the media record is associated directly with a trace, this will be null. */\n  observationId?: string | null;\n  /** The MIME type of the media record */\n  contentType: ApiMediaContentType;\n  /** The size of the media record in bytes */\n  contentLength: number;\n  /** The SHA-256 hash of the media record */\n  sha256Hash: string;\n  /** The trace / observation field the media record is associated with. This can be one of `input`, `output`, `metadata` */\n  field: string;\n}\n\n/** GetMediaUploadUrlResponse */\nexport interface ApiGetMediaUploadUrlResponse {\n  /** The presigned upload URL. If the asset is already uploaded, this will be null */\n  uploadUrl?: string | null;\n  /** The unique langfuse identifier of a media record */\n  mediaId: string;\n}\n\n/**\n * MediaContentType\n * The MIME type of the media record\n */\nexport type ApiMediaContentType =\n  | \"image/png\"\n  | \"image/jpeg\"\n  | \"image/jpg\"\n  | \"image/webp\"\n  | \"image/gif\"\n  | \"image/svg+xml\"\n  | \"image/tiff\"\n  | \"image/bmp\"\n  | \"audio/mpeg\"\n  | \"audio/mp3\"\n  | \"audio/wav\"\n  | \"audio/ogg\"\n  | \"audio/oga\"\n  | \"audio/aac\"\n  | \"audio/mp4\"\n  | \"audio/flac\"\n  | \"video/mp4\"\n  | \"video/webm\"\n  | \"text/plain\"\n  | \"text/html\"\n  | \"text/css\"\n  | \"text/csv\"\n  | \"application/pdf\"\n  | \"application/msword\"\n  | \"application/vnd.ms-excel\"\n  | \"application/zip\"\n  | \"application/json\"\n  | \"application/xml\"\n  | \"application/octet-stream\";\n\n/** DailyMetrics */\nexport interface ApiDailyMetrics {\n  /** A list of daily metrics, only days with ingested data are included. */\n  data: ApiDailyMetricsDetails[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** DailyMetricsDetails */\nexport interface ApiDailyMetricsDetails {\n  /** @format date */\n  date: string;\n  countTraces: number;\n  countObservations: number;\n  /**\n   * Total model cost in USD\n   * @format double\n   */\n  totalCost: number;\n  usage: ApiUsageByModel[];\n}\n\n/**\n * UsageByModel\n * Daily usage of a given model. Usage corresponds to the unit set for the specific model (e.g. tokens).\n */\nexport interface ApiUsageByModel {\n  model?: string | null;\n  /** Total number of generation input units (e.g. tokens) */\n  inputUsage: number;\n  /** Total number of generation output units (e.g. tokens) */\n  outputUsage: number;\n  /** Total number of generation total units (e.g. tokens) */\n  totalUsage: number;\n  countTraces: number;\n  countObservations: number;\n  /**\n   * Total model cost in USD\n   * @format double\n   */\n  totalCost: number;\n}\n\n/** PaginatedModels */\nexport interface ApiPaginatedModels {\n  data: ApiModel[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** CreateModelRequest */\nexport interface ApiCreateModelRequest {\n  /** Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime */\n  modelName: string;\n  /** Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$` */\n  matchPattern: string;\n  /**\n   * Apply only to generations which are newer than this ISO date.\n   * @format date-time\n   */\n  startDate?: string | null;\n  /** Unit used by this model. */\n  unit?: ApiModelUsageUnit | null;\n  /**\n   * Price (USD) per input unit\n   * @format double\n   */\n  inputPrice?: number | null;\n  /**\n   * Price (USD) per output unit\n   * @format double\n   */\n  outputPrice?: number | null;\n  /**\n   * Price (USD) per total units. Cannot be set if input or output price is set.\n   * @format double\n   */\n  totalPrice?: number | null;\n  /** Optional. Tokenizer to be applied to observations which match to this model. See docs for more details. */\n  tokenizerId?: string | null;\n  /** Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details. */\n  tokenizerConfig?: any;\n}\n\n/** Observations */\nexport interface ApiObservations {\n  data: ApiObservation[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** ObservationsViews */\nexport interface ApiObservationsViews {\n  data: ApiObservationsView[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** Projects */\nexport interface ApiProjects {\n  data: ApiProject[];\n}\n\n/** Project */\nexport interface ApiProject {\n  id: string;\n  name: string;\n}\n\n/** PromptMetaListResponse */\nexport interface ApiPromptMetaListResponse {\n  data: ApiPromptMeta[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** PromptMeta */\nexport interface ApiPromptMeta {\n  name: string;\n  versions: number[];\n  labels: string[];\n  tags: string[];\n  /** @format date-time */\n  lastUpdatedAt: string;\n  /** Config object of the most recent prompt version that matches the filters (if any are provided) */\n  lastConfig: any;\n}\n\n/** CreatePromptRequest */\nexport type ApiCreatePromptRequest =\n  | ({\n      type: \"chat\";\n    } & ApiCreateChatPromptRequest)\n  | ({\n      type: \"text\";\n    } & ApiCreateTextPromptRequest);\n\n/** CreateChatPromptRequest */\nexport interface ApiCreateChatPromptRequest {\n  name: string;\n  prompt: ApiChatMessage[];\n  config?: any;\n  /** List of deployment labels of this prompt version. */\n  labels?: string[] | null;\n  /** List of tags to apply to all versions of this prompt. */\n  tags?: string[] | null;\n  /** Commit message for this prompt version. */\n  commitMessage?: string | null;\n}\n\n/** CreateTextPromptRequest */\nexport interface ApiCreateTextPromptRequest {\n  name: string;\n  prompt: string;\n  config?: any;\n  /** List of deployment labels of this prompt version. */\n  labels?: string[] | null;\n  /** List of tags to apply to all versions of this prompt. */\n  tags?: string[] | null;\n  /** Commit message for this prompt version. */\n  commitMessage?: string | null;\n}\n\n/** Prompt */\nexport type ApiPrompt =\n  | ({\n      type: \"chat\";\n    } & ApiChatPrompt)\n  | ({\n      type: \"text\";\n    } & ApiTextPrompt);\n\n/** BasePrompt */\nexport interface ApiBasePrompt {\n  name: string;\n  version: number;\n  config: any;\n  /** List of deployment labels of this prompt version. */\n  labels: string[];\n  /** List of tags. Used to filter via UI and API. The same across versions of a prompt. */\n  tags: string[];\n  /** Commit message for this prompt version. */\n  commitMessage?: string | null;\n  /** The dependency resolution graph for the current prompt. Null if prompt has no dependencies. */\n  resolutionGraph?: Record<string, any>;\n}\n\n/** ChatMessage */\nexport interface ApiChatMessage {\n  role: string;\n  content: string;\n}\n\n/** TextPrompt */\nexport type ApiTextPrompt = ApiBasePrompt & {\n  prompt: string;\n};\n\n/** ChatPrompt */\nexport type ApiChatPrompt = ApiBasePrompt & {\n  prompt: ApiChatMessage[];\n};\n\n/** ScoreConfigs */\nexport interface ApiScoreConfigs {\n  data: ApiScoreConfig[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** CreateScoreConfigRequest */\nexport interface ApiCreateScoreConfigRequest {\n  name: string;\n  dataType: ApiScoreDataType;\n  /** Configure custom categories for categorical scores. Pass a list of objects with `label` and `value` properties. Categories are autogenerated for boolean configs and cannot be passed */\n  categories?: ApiConfigCategory[] | null;\n  /**\n   * Configure a minimum value for numerical scores. If not set, the minimum value defaults to -∞\n   * @format double\n   */\n  minValue?: number | null;\n  /**\n   * Configure a maximum value for numerical scores. If not set, the maximum value defaults to +∞\n   * @format double\n   */\n  maxValue?: number | null;\n  /** Description is shown across the Langfuse UI and can be used to e.g. explain the config categories in detail, why a numeric range was set, or provide additional context on config name or usage */\n  description?: string | null;\n}\n\n/** CreateScoreRequest */\nexport interface ApiCreateScoreRequest {\n  id?: string | null;\n  /** @example \"cdef-1234-5678-90ab\" */\n  traceId: string;\n  /** @example \"novelty\" */\n  name: string;\n  /** The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false) */\n  value: ApiCreateScoreValue;\n  observationId?: string | null;\n  comment?: string | null;\n  /** The environment of the score. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */\n  environment?: string | null;\n  /** The data type of the score. When passing a configId this field is inferred. Otherwise, this field must be passed or will default to numeric. */\n  dataType?: ApiScoreDataType | null;\n  /** Reference a score config on a score. The unique langfuse identifier of a score config. When passing this field, the dataType and stringValue fields are automatically populated. */\n  configId?: string | null;\n}\n\n/** CreateScoreResponse */\nexport interface ApiCreateScoreResponse {\n  /** The id of the created object in Langfuse */\n  id: string;\n}\n\n/** GetScoresResponseTraceData */\nexport interface ApiGetScoresResponseTraceData {\n  /** The user ID associated with the trace referenced by score */\n  userId?: string | null;\n  /** A list of tags associated with the trace referenced by score */\n  tags?: string[] | null;\n  /** The environment of the trace referenced by score */\n  environment?: string | null;\n}\n\n/** GetScoresResponseDataNumeric */\nexport type ApiGetScoresResponseDataNumeric = ApiNumericScore & {\n  trace: ApiGetScoresResponseTraceData;\n};\n\n/** GetScoresResponseDataCategorical */\nexport type ApiGetScoresResponseDataCategorical = ApiCategoricalScore & {\n  trace: ApiGetScoresResponseTraceData;\n};\n\n/** GetScoresResponseDataBoolean */\nexport type ApiGetScoresResponseDataBoolean = ApiBooleanScore & {\n  trace: ApiGetScoresResponseTraceData;\n};\n\n/** GetScoresResponseData */\nexport type ApiGetScoresResponseData =\n  | ({\n      dataType: \"NUMERIC\";\n    } & ApiGetScoresResponseDataNumeric)\n  | ({\n      dataType: \"CATEGORICAL\";\n    } & ApiGetScoresResponseDataCategorical)\n  | ({\n      dataType: \"BOOLEAN\";\n    } & ApiGetScoresResponseDataBoolean);\n\n/** GetScoresResponse */\nexport interface ApiGetScoresResponse {\n  data: ApiGetScoresResponseData[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** PaginatedSessions */\nexport interface ApiPaginatedSessions {\n  data: ApiSession[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** Traces */\nexport interface ApiTraces {\n  data: ApiTraceWithDetails[];\n  meta: ApiUtilsMetaResponse;\n}\n\n/** DeleteTraceResponse */\nexport interface ApiDeleteTraceResponse {\n  message: string;\n}\n\n/** Sort */\nexport interface ApiSort {\n  id: string;\n}\n\n/** utilsMetaResponse */\nexport interface ApiUtilsMetaResponse {\n  /** current page number */\n  page: number;\n  /** number of items per page */\n  limit: number;\n  /** number of total items given the current filters/selection (if any) */\n  totalItems: number;\n  /** number of total pages given the current limit */\n  totalPages: number;\n}\n\nexport interface ApiAnnotationQueuesListQueuesParams {\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n}\n\nexport interface ApiAnnotationQueuesListQueueItemsParams {\n  /** Filter by status */\n  status?: ApiAnnotationQueueStatus | null;\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n  /** The unique identifier of the annotation queue */\n  queueId: string;\n}\n\nexport interface ApiCommentsGetParams {\n  /** Page number, starts at 1. */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit */\n  limit?: number | null;\n  /** Filter comments by object type (trace, observation, session, prompt). */\n  objectType?: string | null;\n  /** Filter comments by object id. If objectType is not provided, an error will be thrown. */\n  objectId?: string | null;\n  /** Filter comments by author user id. */\n  authorUserId?: string | null;\n}\n\nexport interface ApiDatasetItemsListParams {\n  datasetName?: string | null;\n  sourceTraceId?: string | null;\n  sourceObservationId?: string | null;\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n}\n\nexport interface ApiDatasetsListParams {\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n}\n\nexport interface ApiDatasetsGetRunsParams {\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n  datasetName: string;\n}\n\nexport interface ApiIngestionBatchPayload {\n  /** Batch of tracing events to be ingested. Discriminated by attribute `type`. */\n  batch: ApiIngestionEvent[];\n  /** Optional. Metadata field used by the Langfuse SDKs for debugging. */\n  metadata?: any;\n}\n\nexport interface ApiMetricsDailyParams {\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n  /** Optional filter by the name of the trace */\n  traceName?: string | null;\n  /** Optional filter by the userId associated with the trace */\n  userId?: string | null;\n  /** Optional filter for metrics where traces include all of these tags */\n  tags?: (string | null)[];\n  /** Optional filter for metrics where events include any of these environments */\n  environment?: (string | null)[];\n  /**\n   * Optional filter to only include traces and observations on or after a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  fromTimestamp?: string | null;\n  /**\n   * Optional filter to only include traces and observations before a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  toTimestamp?: string | null;\n}\n\nexport interface ApiModelsListParams {\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n}\n\nexport interface ApiObservationsGetManyParams {\n  /** Page number, starts at 1. */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. */\n  limit?: number | null;\n  name?: string | null;\n  userId?: string | null;\n  type?: string | null;\n  traceId?: string | null;\n  parentObservationId?: string | null;\n  /** Optional filter for observations where the environment is one of the provided values. */\n  environment?: (string | null)[];\n  /**\n   * Retrieve only observations with a start_time or or after this datetime (ISO 8601).\n   * @format date-time\n   */\n  fromStartTime?: string | null;\n  /**\n   * Retrieve only observations with a start_time before this datetime (ISO 8601).\n   * @format date-time\n   */\n  toStartTime?: string | null;\n  /** Optional filter to only include observations with a certain version. */\n  version?: string | null;\n}\n\nexport interface ApiPromptVersionUpdatePayload {\n  /** New labels for the prompt version. Labels are unique across versions. The \"latest\" label is reserved and managed by Langfuse. */\n  newLabels: string[];\n}\n\nexport interface ApiPromptsGetParams {\n  /** Version of the prompt to be retrieved. */\n  version?: number | null;\n  /** Label of the prompt to be retrieved. Defaults to \"production\" if no label or version is set. */\n  label?: string | null;\n  /** The name of the prompt */\n  promptName: string;\n}\n\nexport interface ApiPromptsListParams {\n  name?: string | null;\n  label?: string | null;\n  tag?: string | null;\n  /** page number, starts at 1 */\n  page?: number | null;\n  /** limit of items per page */\n  limit?: number | null;\n  /**\n   * Optional filter to only include prompt versions created/updated on or after a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  fromUpdatedAt?: string | null;\n  /**\n   * Optional filter to only include prompt versions created/updated before a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  toUpdatedAt?: string | null;\n}\n\nexport interface ApiScoreConfigsGetParams {\n  /** Page number, starts at 1. */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit */\n  limit?: number | null;\n}\n\nexport interface ApiScoreGetParams {\n  /** Page number, starts at 1. */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. */\n  limit?: number | null;\n  /** Retrieve only scores with this userId associated to the trace. */\n  userId?: string | null;\n  /** Retrieve only scores with this name. */\n  name?: string | null;\n  /**\n   * Optional filter to only include scores created on or after a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  fromTimestamp?: string | null;\n  /**\n   * Optional filter to only include scores created before a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  toTimestamp?: string | null;\n  /** Optional filter for scores where the environment is one of the provided values. */\n  environment?: (string | null)[];\n  /** Retrieve only scores from a specific source. */\n  source?: ApiScoreSource | null;\n  /** Retrieve only scores with <operator> value. */\n  operator?: string | null;\n  /**\n   * Retrieve only scores with <operator> value.\n   * @format double\n   */\n  value?: number | null;\n  /** Comma-separated list of score IDs to limit the results to. */\n  scoreIds?: string | null;\n  /** Retrieve only scores with a specific configId. */\n  configId?: string | null;\n  /** Retrieve only scores with a specific annotation queueId. */\n  queueId?: string | null;\n  /** Retrieve only scores with a specific dataType. */\n  dataType?: ApiScoreDataType | null;\n  /** Only scores linked to traces that include all of these tags will be returned. */\n  traceTags?: (string | null)[];\n}\n\nexport interface ApiSessionsListParams {\n  /** Page number, starts at 1 */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. */\n  limit?: number | null;\n  /**\n   * Optional filter to only include sessions created on or after a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  fromTimestamp?: string | null;\n  /**\n   * Optional filter to only include sessions created before a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  toTimestamp?: string | null;\n  /** Optional filter for sessions where the environment is one of the provided values. */\n  environment?: (string | null)[];\n}\n\nexport interface ApiTraceListParams {\n  /** Page number, starts at 1 */\n  page?: number | null;\n  /** Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. */\n  limit?: number | null;\n  userId?: string | null;\n  name?: string | null;\n  sessionId?: string | null;\n  /**\n   * Optional filter to only include traces with a trace.timestamp on or after a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  fromTimestamp?: string | null;\n  /**\n   * Optional filter to only include traces with a trace.timestamp before a certain datetime (ISO 8601)\n   * @format date-time\n   */\n  toTimestamp?: string | null;\n  /** Format of the string [field].[asc/desc]. Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Example: timestamp.asc */\n  orderBy?: string | null;\n  /** Only traces that include all of these tags will be returned. */\n  tags?: (string | null)[];\n  /** Optional filter to only include traces with a certain version. */\n  version?: string | null;\n  /** Optional filter to only include traces with a certain release. */\n  release?: string | null;\n  /** Optional filter for traces where the environment is one of the provided values. */\n  environment?: (string | null)[];\n}\n\nexport interface ApiTraceDeleteMultiplePayload {\n  /** List of trace IDs to delete */\n  traceIds: string[];\n}\n\nexport type QueryParamsType = Record<string | number, any>;\nexport type ResponseFormat = keyof Omit<Body, \"body\" | \"bodyUsed\">;\n\nexport interface FullRequestParams extends Omit<RequestInit, \"body\"> {\n  /** set parameter to `true` for call `securityWorker` for this request */\n  secure?: boolean;\n  /** request path */\n  path: string;\n  /** content type of request body */\n  type?: ContentType;\n  /** query params */\n  query?: QueryParamsType;\n  /** format of response (i.e. response.json() -> format: \"json\") */\n  format?: ResponseFormat;\n  /** request body */\n  body?: unknown;\n  /** base url */\n  baseUrl?: string;\n  /** request cancellation token */\n  cancelToken?: CancelToken;\n}\n\nexport type RequestParams = Omit<FullRequestParams, \"body\" | \"method\" | \"query\" | \"path\">;\n\nexport interface ApiConfig<SecurityDataType = unknown> {\n  baseUrl?: string;\n  baseApiParams?: Omit<RequestParams, \"baseUrl\" | \"cancelToken\" | \"signal\">;\n  securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;\n  customFetch?: typeof fetch;\n}\n\nexport interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {\n  data: D;\n  error: E;\n}\n\ntype CancelToken = Symbol | string | number;\n\nexport enum ContentType {\n  Json = \"application/json\",\n  FormData = \"multipart/form-data\",\n  UrlEncoded = \"application/x-www-form-urlencoded\",\n  Text = \"text/plain\",\n}\n\nexport class HttpClient<SecurityDataType = unknown> {\n  public baseUrl: string = \"\";\n  private securityData: SecurityDataType | null = null;\n  private securityWorker?: ApiConfig<SecurityDataType>[\"securityWorker\"];\n  private abortControllers = new Map<CancelToken, AbortController>();\n  private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);\n\n  private baseApiParams: RequestParams = {\n    credentials: \"same-origin\",\n    headers: {},\n    redirect: \"follow\",\n    referrerPolicy: \"no-referrer\",\n  };\n\n  constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {\n    Object.assign(this, apiConfig);\n  }\n\n  public setSecurityData = (data: SecurityDataType | null) => {\n    this.securityData = data;\n  };\n\n  protected encodeQueryParam(key: string, value: any) {\n    const encodedKey = encodeURIComponent(key);\n    return `${encodedKey}=${encodeURIComponent(typeof value === \"number\" ? value : `${value}`)}`;\n  }\n\n  protected addQueryParam(query: QueryParamsType, key: string) {\n    return this.encodeQueryParam(key, query[key]);\n  }\n\n  protected addArrayQueryParam(query: QueryParamsType, key: string) {\n    const value = query[key];\n    return value.map((v: any) => this.encodeQueryParam(key, v)).join(\"&\");\n  }\n\n  protected toQueryString(rawQuery?: QueryParamsType): string {\n    const query = rawQuery || {};\n    const keys = Object.keys(query).filter((key) => \"undefined\" !== typeof query[key]);\n    return keys\n      .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))\n      .join(\"&\");\n  }\n\n  protected addQueryParams(rawQuery?: QueryParamsType): string {\n    const queryString = this.toQueryString(rawQuery);\n    return queryString ? `?${queryString}` : \"\";\n  }\n\n  private contentFormatters: Record<ContentType, (input: any) => any> = {\n    [ContentType.Json]: (input: any) =>\n      input !== null && (typeof input === \"object\" || typeof input === \"string\") ? JSON.stringify(input) : input,\n    [ContentType.Text]: (input: any) => (input !== null && typeof input !== \"string\" ? JSON.stringify(input) : input),\n    [ContentType.FormData]: (input: any) =>\n      Object.keys(input || {}).reduce((formData, key) => {\n        const property = input[key];\n        formData.append(\n          key,\n          property instanceof Blob\n            ? property\n            : typeof property === \"object\" && property !== null\n              ? JSON.stringify(property)\n              : `${property}`\n        );\n        return formData;\n      }, new FormData()),\n    [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),\n  };\n\n  protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {\n    return {\n      ...this.baseApiParams,\n      ...params1,\n      ...(params2 || {}),\n      headers: {\n        ...(this.baseApiParams.headers || {}),\n        ...(params1.headers || {}),\n        ...((params2 && params2.headers) || {}),\n      },\n    };\n  }\n\n  protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {\n    if (this.abortControllers.has(cancelToken)) {\n      const abortController = this.abortControllers.get(cancelToken);\n      if (abortController) {\n        return abortController.signal;\n      }\n      return void 0;\n    }\n\n    const abortController = new AbortController();\n    this.abortControllers.set(cancelToken, abortController);\n    return abortController.signal;\n  };\n\n  public abortRequest = (cancelToken: CancelToken) => {\n    const abortController = this.abortControllers.get(cancelToken);\n\n    if (abortController) {\n      abortController.abort();\n      this.abortControllers.delete(cancelToken);\n    }\n  };\n\n  public request = async <T = any, E = any>({\n    body,\n    secure,\n    path,\n    type,\n    query,\n    format,\n    baseUrl,\n    cancelToken,\n    ...params\n  }: FullRequestParams): Promise<T> => {\n    const secureParams =\n      ((typeof secure === \"boolean\" ? secure : this.baseApiParams.secure) &&\n        this.securityWorker &&\n        (await this.securityWorker(this.securityData))) ||\n      {};\n    const requestParams = this.mergeRequestParams(params, secureParams);\n    const queryString = query && this.toQueryString(query);\n    const payloadFormatter = this.contentFormatters[type || ContentType.Json];\n    const responseFormat = format || requestParams.format;\n\n    return this.customFetch(`${baseUrl || this.baseUrl || \"\"}${path}${queryString ? `?${queryString}` : \"\"}`, {\n      ...requestParams,\n      headers: {\n        ...(requestParams.headers || {}),\n        ...(type && type !== ContentType.FormData ? { \"Content-Type\": type } : {}),\n      },\n      signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,\n      body: typeof body === \"undefined\" || body === null ? null : payloadFormatter(body),\n    }).then(async (response) => {\n      const r = response.clone() as HttpResponse<T, E>;\n      r.data = null as unknown as T;\n      r.error = null as unknown as E;\n\n      const data = !responseFormat\n        ? r\n        : await response[responseFormat]()\n            .then((data) => {\n              if (r.ok) {\n                r.data = data;\n              } else {\n                r.error = data;\n              }\n              return r;\n            })\n            .catch((e) => {\n              r.error = e;\n              return r;\n            });\n\n      if (cancelToken) {\n        this.abortControllers.delete(cancelToken);\n      }\n\n      if (!response.ok) throw data;\n      return data.data;\n    });\n  };\n}\n\n/**\n * @title langfuse\n *\n * ## Authentication\n *\n * Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:\n *\n * - username: Langfuse Public Key\n * - password: Langfuse Secret Key\n *\n * ## Exports\n *\n * - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml\n * - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json\n */\nexport class LangfusePublicApi<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {\n  api = {\n    /**\n     * @description Add an item to an annotation queue\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesCreateQueueItem\n     * @request POST:/api/public/annotation-queues/{queueId}/items\n     * @secure\n     */\n    annotationQueuesCreateQueueItem: (\n      queueId: string,\n      data: ApiCreateAnnotationQueueItemRequest,\n      params: RequestParams = {}\n    ) =>\n      this.request<ApiAnnotationQueueItem, any>({\n        path: `/api/public/annotation-queues/${queueId}/items`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Remove an item from an annotation queue\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesDeleteQueueItem\n     * @request DELETE:/api/public/annotation-queues/{queueId}/items/{itemId}\n     * @secure\n     */\n    annotationQueuesDeleteQueueItem: (queueId: string, itemId: string, params: RequestParams = {}) =>\n      this.request<ApiDeleteAnnotationQueueItemResponse, any>({\n        path: `/api/public/annotation-queues/${queueId}/items/${itemId}`,\n        method: \"DELETE\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get an annotation queue by ID\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesGetQueue\n     * @request GET:/api/public/annotation-queues/{queueId}\n     * @secure\n     */\n    annotationQueuesGetQueue: (queueId: string, params: RequestParams = {}) =>\n      this.request<ApiAnnotationQueue, any>({\n        path: `/api/public/annotation-queues/${queueId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a specific item from an annotation queue\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesGetQueueItem\n     * @request GET:/api/public/annotation-queues/{queueId}/items/{itemId}\n     * @secure\n     */\n    annotationQueuesGetQueueItem: (queueId: string, itemId: string, params: RequestParams = {}) =>\n      this.request<ApiAnnotationQueueItem, any>({\n        path: `/api/public/annotation-queues/${queueId}/items/${itemId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get items for a specific annotation queue\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesListQueueItems\n     * @request GET:/api/public/annotation-queues/{queueId}/items\n     * @secure\n     */\n    annotationQueuesListQueueItems: (\n      { queueId, ...query }: ApiAnnotationQueuesListQueueItemsParams,\n      params: RequestParams = {}\n    ) =>\n      this.request<ApiPaginatedAnnotationQueueItems, any>({\n        path: `/api/public/annotation-queues/${queueId}/items`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get all annotation queues\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesListQueues\n     * @request GET:/api/public/annotation-queues\n     * @secure\n     */\n    annotationQueuesListQueues: (query: ApiAnnotationQueuesListQueuesParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedAnnotationQueues, any>({\n        path: `/api/public/annotation-queues`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Update an annotation queue item\n     *\n     * @tags AnnotationQueues\n     * @name AnnotationQueuesUpdateQueueItem\n     * @request PATCH:/api/public/annotation-queues/{queueId}/items/{itemId}\n     * @secure\n     */\n    annotationQueuesUpdateQueueItem: (\n      queueId: string,\n      itemId: string,\n      data: ApiUpdateAnnotationQueueItemRequest,\n      params: RequestParams = {}\n    ) =>\n      this.request<ApiAnnotationQueueItem, any>({\n        path: `/api/public/annotation-queues/${queueId}/items/${itemId}`,\n        method: \"PATCH\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a comment. Comments may be attached to different object types (trace, observation, session, prompt).\n     *\n     * @tags Comments\n     * @name CommentsCreate\n     * @request POST:/api/public/comments\n     * @secure\n     */\n    commentsCreate: (data: ApiCreateCommentRequest, params: RequestParams = {}) =>\n      this.request<ApiCreateCommentResponse, any>({\n        path: `/api/public/comments`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get all comments\n     *\n     * @tags Comments\n     * @name CommentsGet\n     * @request GET:/api/public/comments\n     * @secure\n     */\n    commentsGet: (query: ApiCommentsGetParams, params: RequestParams = {}) =>\n      this.request<ApiGetCommentsResponse, any>({\n        path: `/api/public/comments`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a comment by id\n     *\n     * @tags Comments\n     * @name CommentsGetById\n     * @request GET:/api/public/comments/{commentId}\n     * @secure\n     */\n    commentsGetById: (commentId: string, params: RequestParams = {}) =>\n      this.request<ApiComment, any>({\n        path: `/api/public/comments/${commentId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a dataset item\n     *\n     * @tags DatasetItems\n     * @name DatasetItemsCreate\n     * @request POST:/api/public/dataset-items\n     * @secure\n     */\n    datasetItemsCreate: (data: ApiCreateDatasetItemRequest, params: RequestParams = {}) =>\n      this.request<ApiDatasetItem, any>({\n        path: `/api/public/dataset-items`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete a dataset item and all its run items. This action is irreversible.\n     *\n     * @tags DatasetItems\n     * @name DatasetItemsDelete\n     * @request DELETE:/api/public/dataset-items/{id}\n     * @secure\n     */\n    datasetItemsDelete: (id: string, params: RequestParams = {}) =>\n      this.request<ApiDeleteDatasetItemResponse, any>({\n        path: `/api/public/dataset-items/${id}`,\n        method: \"DELETE\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a dataset item\n     *\n     * @tags DatasetItems\n     * @name DatasetItemsGet\n     * @request GET:/api/public/dataset-items/{id}\n     * @secure\n     */\n    datasetItemsGet: (id: string, params: RequestParams = {}) =>\n      this.request<ApiDatasetItem, any>({\n        path: `/api/public/dataset-items/${id}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get dataset items\n     *\n     * @tags DatasetItems\n     * @name DatasetItemsList\n     * @request GET:/api/public/dataset-items\n     * @secure\n     */\n    datasetItemsList: (query: ApiDatasetItemsListParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedDatasetItems, any>({\n        path: `/api/public/dataset-items`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a dataset run item\n     *\n     * @tags DatasetRunItems\n     * @name DatasetRunItemsCreate\n     * @request POST:/api/public/dataset-run-items\n     * @secure\n     */\n    datasetRunItemsCreate: (data: ApiCreateDatasetRunItemRequest, params: RequestParams = {}) =>\n      this.request<ApiDatasetRunItem, any>({\n        path: `/api/public/dataset-run-items`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a dataset\n     *\n     * @tags Datasets\n     * @name DatasetsCreate\n     * @request POST:/api/public/v2/datasets\n     * @secure\n     */\n    datasetsCreate: (data: ApiCreateDatasetRequest, params: RequestParams = {}) =>\n      this.request<ApiDataset, any>({\n        path: `/api/public/v2/datasets`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete a dataset run and all its run items. This action is irreversible.\n     *\n     * @tags Datasets\n     * @name DatasetsDeleteRun\n     * @request DELETE:/api/public/datasets/{datasetName}/runs/{runName}\n     * @secure\n     */\n    datasetsDeleteRun: (datasetName: string, runName: string, params: RequestParams = {}) =>\n      this.request<ApiDeleteDatasetRunResponse, any>({\n        path: `/api/public/datasets/${datasetName}/runs/${runName}`,\n        method: \"DELETE\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a dataset\n     *\n     * @tags Datasets\n     * @name DatasetsGet\n     * @request GET:/api/public/v2/datasets/{datasetName}\n     * @secure\n     */\n    datasetsGet: (datasetName: string, params: RequestParams = {}) =>\n      this.request<ApiDataset, any>({\n        path: `/api/public/v2/datasets/${datasetName}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a dataset run and its items\n     *\n     * @tags Datasets\n     * @name DatasetsGetRun\n     * @request GET:/api/public/datasets/{datasetName}/runs/{runName}\n     * @secure\n     */\n    datasetsGetRun: (datasetName: string, runName: string, params: RequestParams = {}) =>\n      this.request<ApiDatasetRunWithItems, any>({\n        path: `/api/public/datasets/${datasetName}/runs/${runName}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get dataset runs\n     *\n     * @tags Datasets\n     * @name DatasetsGetRuns\n     * @request GET:/api/public/datasets/{datasetName}/runs\n     * @secure\n     */\n    datasetsGetRuns: ({ datasetName, ...query }: ApiDatasetsGetRunsParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedDatasetRuns, any>({\n        path: `/api/public/datasets/${datasetName}/runs`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get all datasets\n     *\n     * @tags Datasets\n     * @name DatasetsList\n     * @request GET:/api/public/v2/datasets\n     * @secure\n     */\n    datasetsList: (query: ApiDatasetsListParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedDatasets, any>({\n        path: `/api/public/v2/datasets`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Check health of API and database\n     *\n     * @tags Health\n     * @name HealthHealth\n     * @request GET:/api/public/health\n     */\n    healthHealth: (params: RequestParams = {}) =>\n      this.request<ApiHealthResponse, void>({\n        path: `/api/public/health`,\n        method: \"GET\",\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Batched ingestion for Langfuse Tracing. If you want to use tracing via the API, such as to build your own Langfuse client implementation, this is the only API route you need to implement. Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. Internally, we refer to this as the \"event envelope\" as it tells us something about the event but not the trace. We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. I.e. if you want to update a trace, you'd use the same body id, but separate event IDs. Notes: - Introduction to data model: https://langfuse.com/docs/tracing-data-model - Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly. - The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.\n     *\n     * @tags Ingestion\n     * @name IngestionBatch\n     * @request POST:/api/public/ingestion\n     * @secure\n     */\n    ingestionBatch: (data: ApiIngestionBatchPayload, params: RequestParams = {}) =>\n      this.request<ApiIngestionResponse, any>({\n        path: `/api/public/ingestion`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a media record\n     *\n     * @tags Media\n     * @name MediaGet\n     * @request GET:/api/public/media/{mediaId}\n     * @secure\n     */\n    mediaGet: (mediaId: string, params: RequestParams = {}) =>\n      this.request<ApiGetMediaResponse, any>({\n        path: `/api/public/media/${mediaId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a presigned upload URL for a media record\n     *\n     * @tags Media\n     * @name MediaGetUploadUrl\n     * @request POST:/api/public/media\n     * @secure\n     */\n    mediaGetUploadUrl: (data: ApiGetMediaUploadUrlRequest, params: RequestParams = {}) =>\n      this.request<ApiGetMediaUploadUrlResponse, any>({\n        path: `/api/public/media`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Patch a media record\n     *\n     * @tags Media\n     * @name MediaPatch\n     * @request PATCH:/api/public/media/{mediaId}\n     * @secure\n     */\n    mediaPatch: (mediaId: string, data: ApiPatchMediaBody, params: RequestParams = {}) =>\n      this.request<void, any>({\n        path: `/api/public/media/${mediaId}`,\n        method: \"PATCH\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        ...params,\n      }),\n\n    /**\n     * @description Get daily metrics of the Langfuse project\n     *\n     * @tags Metrics\n     * @name MetricsDaily\n     * @request GET:/api/public/metrics/daily\n     * @secure\n     */\n    metricsDaily: (query: ApiMetricsDailyParams, params: RequestParams = {}) =>\n      this.request<ApiDailyMetrics, any>({\n        path: `/api/public/metrics/daily`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a model\n     *\n     * @tags Models\n     * @name ModelsCreate\n     * @request POST:/api/public/models\n     * @secure\n     */\n    modelsCreate: (data: ApiCreateModelRequest, params: RequestParams = {}) =>\n      this.request<ApiModel, any>({\n        path: `/api/public/models`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.\n     *\n     * @tags Models\n     * @name ModelsDelete\n     * @request DELETE:/api/public/models/{id}\n     * @secure\n     */\n    modelsDelete: (id: string, params: RequestParams = {}) =>\n      this.request<void, any>({\n        path: `/api/public/models/${id}`,\n        method: \"DELETE\",\n        secure: true,\n        ...params,\n      }),\n\n    /**\n     * @description Get a model\n     *\n     * @tags Models\n     * @name ModelsGet\n     * @request GET:/api/public/models/{id}\n     * @secure\n     */\n    modelsGet: (id: string, params: RequestParams = {}) =>\n      this.request<ApiModel, any>({\n        path: `/api/public/models/${id}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get all models\n     *\n     * @tags Models\n     * @name ModelsList\n     * @request GET:/api/public/models\n     * @secure\n     */\n    modelsList: (query: ApiModelsListParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedModels, any>({\n        path: `/api/public/models`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a observation\n     *\n     * @tags Observations\n     * @name ObservationsGet\n     * @request GET:/api/public/observations/{observationId}\n     * @secure\n     */\n    observationsGet: (observationId: string, params: RequestParams = {}) =>\n      this.request<ApiObservationsView, any>({\n        path: `/api/public/observations/${observationId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a list of observations\n     *\n     * @tags Observations\n     * @name ObservationsGetMany\n     * @request GET:/api/public/observations\n     * @secure\n     */\n    observationsGetMany: (query: ApiObservationsGetManyParams, params: RequestParams = {}) =>\n      this.request<ApiObservationsViews, any>({\n        path: `/api/public/observations`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get Project associated with API key\n     *\n     * @tags Projects\n     * @name ProjectsGet\n     * @request GET:/api/public/projects\n     * @secure\n     */\n    projectsGet: (params: RequestParams = {}) =>\n      this.request<ApiProjects, any>({\n        path: `/api/public/projects`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a new version for the prompt with the given `name`\n     *\n     * @tags Prompts\n     * @name PromptsCreate\n     * @request POST:/api/public/v2/prompts\n     * @secure\n     */\n    promptsCreate: (data: ApiCreatePromptRequest, params: RequestParams = {}) =>\n      this.request<ApiPrompt, any>({\n        path: `/api/public/v2/prompts`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a prompt\n     *\n     * @tags Prompts\n     * @name PromptsGet\n     * @request GET:/api/public/v2/prompts/{promptName}\n     * @secure\n     */\n    promptsGet: ({ promptName, ...query }: ApiPromptsGetParams, params: RequestParams = {}) =>\n      this.request<ApiPrompt, any>({\n        path: `/api/public/v2/prompts/${promptName}`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a list of prompt names with versions and labels\n     *\n     * @tags Prompts\n     * @name PromptsList\n     * @request GET:/api/public/v2/prompts\n     * @secure\n     */\n    promptsList: (query: ApiPromptsListParams, params: RequestParams = {}) =>\n      this.request<ApiPromptMetaListResponse, any>({\n        path: `/api/public/v2/prompts`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Update labels for a specific prompt version\n     *\n     * @tags PromptVersion\n     * @name PromptVersionUpdate\n     * @request PATCH:/api/public/v2/prompts/{name}/versions/{version}\n     * @secure\n     */\n    promptVersionUpdate: (\n      name: string,\n      version: number,\n      data: ApiPromptVersionUpdatePayload,\n      params: RequestParams = {}\n    ) =>\n      this.request<ApiPrompt, any>({\n        path: `/api/public/v2/prompts/${name}/versions/${version}`,\n        method: \"PATCH\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a score configuration (config). Score configs are used to define the structure of scores\n     *\n     * @tags ScoreConfigs\n     * @name ScoreConfigsCreate\n     * @request POST:/api/public/score-configs\n     * @secure\n     */\n    scoreConfigsCreate: (data: ApiCreateScoreConfigRequest, params: RequestParams = {}) =>\n      this.request<ApiScoreConfig, any>({\n        path: `/api/public/score-configs`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get all score configs\n     *\n     * @tags ScoreConfigs\n     * @name ScoreConfigsGet\n     * @request GET:/api/public/score-configs\n     * @secure\n     */\n    scoreConfigsGet: (query: ApiScoreConfigsGetParams, params: RequestParams = {}) =>\n      this.request<ApiScoreConfigs, any>({\n        path: `/api/public/score-configs`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a score config\n     *\n     * @tags ScoreConfigs\n     * @name ScoreConfigsGetById\n     * @request GET:/api/public/score-configs/{configId}\n     * @secure\n     */\n    scoreConfigsGetById: (configId: string, params: RequestParams = {}) =>\n      this.request<ApiScoreConfig, any>({\n        path: `/api/public/score-configs/${configId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Create a score\n     *\n     * @tags Score\n     * @name ScoreCreate\n     * @request POST:/api/public/scores\n     * @secure\n     */\n    scoreCreate: (data: ApiCreateScoreRequest, params: RequestParams = {}) =>\n      this.request<ApiCreateScoreResponse, any>({\n        path: `/api/public/scores`,\n        method: \"POST\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete a score\n     *\n     * @tags Score\n     * @name ScoreDelete\n     * @request DELETE:/api/public/scores/{scoreId}\n     * @secure\n     */\n    scoreDelete: (scoreId: string, params: RequestParams = {}) =>\n      this.request<void, any>({\n        path: `/api/public/scores/${scoreId}`,\n        method: \"DELETE\",\n        secure: true,\n        ...params,\n      }),\n\n    /**\n     * @description Get a list of scores\n     *\n     * @tags Score\n     * @name ScoreGet\n     * @request GET:/api/public/scores\n     * @secure\n     */\n    scoreGet: (query: ApiScoreGetParams, params: RequestParams = {}) =>\n      this.request<ApiGetScoresResponse, any>({\n        path: `/api/public/scores`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a score\n     *\n     * @tags Score\n     * @name ScoreGetById\n     * @request GET:/api/public/scores/{scoreId}\n     * @secure\n     */\n    scoreGetById: (scoreId: string, params: RequestParams = {}) =>\n      this.request<ApiScore, any>({\n        path: `/api/public/scores/${scoreId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a session. Please note that `traces` on this endpoint are not paginated, if you plan to fetch large sessions, consider `GET /api/public/traces?sessionId=<sessionId>`\n     *\n     * @tags Sessions\n     * @name SessionsGet\n     * @request GET:/api/public/sessions/{sessionId}\n     * @secure\n     */\n    sessionsGet: (sessionId: string, params: RequestParams = {}) =>\n      this.request<ApiSessionWithTraces, any>({\n        path: `/api/public/sessions/${sessionId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get sessions\n     *\n     * @tags Sessions\n     * @name SessionsList\n     * @request GET:/api/public/sessions\n     * @secure\n     */\n    sessionsList: (query: ApiSessionsListParams, params: RequestParams = {}) =>\n      this.request<ApiPaginatedSessions, any>({\n        path: `/api/public/sessions`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete a specific trace\n     *\n     * @tags Trace\n     * @name TraceDelete\n     * @request DELETE:/api/public/traces/{traceId}\n     * @secure\n     */\n    traceDelete: (traceId: string, params: RequestParams = {}) =>\n      this.request<ApiDeleteTraceResponse, any>({\n        path: `/api/public/traces/${traceId}`,\n        method: \"DELETE\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Delete multiple traces\n     *\n     * @tags Trace\n     * @name TraceDeleteMultiple\n     * @request DELETE:/api/public/traces\n     * @secure\n     */\n    traceDeleteMultiple: (data: ApiTraceDeleteMultiplePayload, params: RequestParams = {}) =>\n      this.request<ApiDeleteTraceResponse, any>({\n        path: `/api/public/traces`,\n        method: \"DELETE\",\n        body: data,\n        secure: true,\n        type: ContentType.Json,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get a specific trace\n     *\n     * @tags Trace\n     * @name TraceGet\n     * @request GET:/api/public/traces/{traceId}\n     * @secure\n     */\n    traceGet: (traceId: string, params: RequestParams = {}) =>\n      this.request<ApiTraceWithFullDetails, any>({\n        path: `/api/public/traces/${traceId}`,\n        method: \"GET\",\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n\n    /**\n     * @description Get list of traces\n     *\n     * @tags Trace\n     * @name TraceList\n     * @request GET:/api/public/traces\n     * @secure\n     */\n    traceList: (query: ApiTraceListParams, params: RequestParams = {}) =>\n      this.request<ApiTraces, any>({\n        path: `/api/public/traces`,\n        method: \"GET\",\n        query: query,\n        secure: true,\n        format: \"json\",\n        ...params,\n      }),\n  };\n}\n","import {\n  LangfuseCore,\n  LangfuseWebStateless,\n  type LangfuseFetchOptions,\n  type LangfuseFetchResponse,\n  type LangfusePersistedProperty,\n  utils,\n} from \"langfuse-core\";\nimport { type LangfuseStorage, getStorage } from \"./storage\";\nimport { LangfusePublicApi } from \"./publicApi\";\nimport { version } from \"../package.json\";\nimport { type LangfuseOptions } from \"./types\";\n\nexport type * from \"./publicApi\";\nexport type {\n  LangfusePromptClient,\n  ChatPromptClient,\n  TextPromptClient,\n  LangfusePromptRecord,\n  LangfuseTraceClient,\n  LangfuseSpanClient,\n  LangfuseEventClient,\n  LangfuseGenerationClient,\n} from \"langfuse-core\";\n\n// Required when users pass these as typed arguments\nexport { LangfuseMedia } from \"langfuse-core\";\n\nexport class Langfuse extends LangfuseCore {\n  private _storage: LangfuseStorage;\n  private _storageCache: any;\n  private _storageKey: string;\n  public api: LangfusePublicApi<null>[\"api\"];\n\n  constructor(params?: { publicKey?: string; secretKey?: string } & LangfuseOptions) {\n    const langfuseConfig = utils.configLangfuseSDK(params);\n    super(langfuseConfig);\n\n    if (typeof window !== \"undefined\" && \"Deno\" in window === false) {\n      this._storageKey = params?.persistence_name\n        ? `lf_${params.persistence_name}`\n        : `lf_${langfuseConfig.publicKey}_langfuse`;\n      this._storage = getStorage(params?.persistence || \"localStorage\", window);\n    } else {\n      this._storageKey = `lf_${langfuseConfig.publicKey}_langfuse`;\n      this._storage = getStorage(\"memory\", undefined);\n    }\n\n    this.api = new LangfusePublicApi({\n      baseUrl: this.baseUrl,\n      baseApiParams: {\n        headers: {\n          \"X-Langfuse-Sdk-Name\": \"langfuse-js\",\n          \"X-Langfuse-Sdk-Version\": this.getLibraryVersion(),\n          \"X-Langfuse-Sdk-Variant\": this.getLibraryId(),\n          \"X-Langfuse-Sdk-Integration\": this.sdkIntegration,\n          \"X-Langfuse-Public-Key\": this.publicKey,\n          ...this.additionalHeaders,\n          ...this.constructAuthorizationHeader(this.publicKey, this.secretKey),\n        },\n      },\n    }).api;\n  }\n\n  getPersistedProperty<T>(key: LangfusePersistedProperty): T | undefined {\n    if (!this._storageCache) {\n      this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || \"{}\") || {};\n    }\n\n    return this._storageCache[key];\n  }\n\n  setPersistedProperty<T>(key: LangfusePersistedProperty, value: T | null): void {\n    if (!this._storageCache) {\n      this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || \"{}\") || {};\n    }\n\n    if (value === null) {\n      delete this._storageCache[key];\n    } else {\n      this._storageCache[key] = value;\n    }\n\n    this._storage.setItem(this._storageKey, JSON.stringify(this._storageCache));\n  }\n\n  fetch(url: string, options: LangfuseFetchOptions): Promise<LangfuseFetchResponse> {\n    return fetch(url, options);\n  }\n\n  getLibraryId(): string {\n    return \"langfuse\";\n  }\n\n  getLibraryVersion(): string {\n    return version;\n  }\n\n  getCustomUserAgent(): void {\n    return;\n  }\n}\n\nexport class LangfuseWeb extends LangfuseWebStateless {\n  private _storage: LangfuseStorage;\n  private _storageCache: any;\n  private _storageKey: string;\n\n  constructor(params?: Omit<LangfuseOptions, \"secretKey\">) {\n    const langfuseConfig = utils.configLangfuseSDK(params, false);\n    super(langfuseConfig);\n\n    if (typeof window !== \"undefined\") {\n      this._storageKey = params?.persistence_name\n        ? `lf_${params.persistence_name}`\n        : `lf_${langfuseConfig.publicKey}_langfuse`;\n      this._storage = getStorage(params?.persistence || \"localStorage\", window);\n    } else {\n      this._storageKey = `lf_${langfuseConfig.publicKey}_langfuse`;\n      this._storage = getStorage(\"memory\", undefined);\n    }\n  }\n\n  getPersistedProperty<T>(key: LangfusePersistedProperty): T | undefined {\n    if (!this._storageCache) {\n      this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || \"{}\") || {};\n    }\n\n    return this._storageCache[key];\n  }\n\n  setPersistedProperty<T>(key: LangfusePersistedProperty, value: T | null): void {\n    if (!this._storageCache) {\n      this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || \"{}\") || {};\n    }\n\n    if (value === null) {\n      delete this._storageCache[key];\n    } else {\n      this._storageCache[key] = value;\n    }\n\n    this._storage.setItem(this._storageKey, JSON.stringify(this._storageCache));\n  }\n\n  fetch(url: string, options: LangfuseFetchOptions): Promise<LangfuseFetchResponse> {\n    return fetch(url, options);\n  }\n\n  getLibraryId(): string {\n    return \"langfuse-frontend\";\n  }\n\n  getLibraryVersion(): string {\n    return version;\n  }\n\n  getCustomUserAgent(): void {\n    return;\n  }\n}\n","import { Langfuse } from \"../langfuse\";\nimport type { LangfuseInitParams } from \"./types\";\n\n/**\n * Represents a singleton instance of the Langfuse client.\n */\nexport class LangfuseSingleton {\n  private static instance: Langfuse | null = null; // Lazy initialization\n\n  /**\n   * Returns the singleton instance of the Langfuse client.\n   * @param params Optional parameters for initializing the Langfuse instance. Only used for the first call.\n   * @returns The singleton instance of the Langfuse client.\n   */\n  public static getInstance(params?: LangfuseInitParams): Langfuse {\n    if (!LangfuseSingleton.instance) {\n      LangfuseSingleton.instance = new Langfuse(params);\n    }\n    return LangfuseSingleton.instance;\n  }\n}\n","import type OpenAI from \"openai\";\nimport type { CreateLangfuseGenerationBody, Usage, UsageDetails } from \"langfuse-core\";\n\ntype ParsedOpenAIArguments = {\n  model: string;\n  input: Record<string, any> | string;\n  modelParameters: Record<string, any>;\n};\n\nexport const parseInputArgs = (args: Record<string, any>): ParsedOpenAIArguments => {\n  let params: Record<string, any> = {};\n  params = {\n    frequency_penalty: args.frequency_penalty,\n    logit_bias: args.logit_bias,\n    logprobs: args.logprobs,\n    max_tokens: args.max_tokens,\n    n: args.n,\n    presence_penalty: args.presence_penalty,\n    seed: args.seed,\n    stop: args.stop,\n    stream: args.stream,\n    temperature: args.temperature,\n    top_p: args.top_p,\n    user: args.user,\n    response_format: args.response_format,\n    top_logprobs: args.top_logprobs,\n  };\n\n  let input: Record<string, any> | string = args.input;\n\n  if (args && typeof args === \"object\" && !Array.isArray(args) && \"messages\" in args) {\n    input = {};\n    input.messages = args.messages;\n    if (\"function_call\" in args) {\n      input.function_call = args.function_call;\n    }\n    if (\"functions\" in args) {\n      input.functions = args.functions;\n    }\n    if (\"tools\" in args) {\n      input.tools = args.tools;\n    }\n\n    if (\"tool_choice\" in args) {\n      input.tool_choice = args.tool_choice;\n    }\n  } else if (!input) {\n    input = args.prompt;\n  }\n\n  return {\n    model: args.model,\n    input: input,\n    modelParameters: params,\n  };\n};\n\nexport const parseCompletionOutput = (res: unknown): CreateLangfuseGenerationBody[\"output\"] => {\n  if (res instanceof Object && \"output_text\" in res && res[\"output_text\"] !== \"\") {\n    return res[\"output_text\"] as string;\n  }\n\n  if (typeof res === \"object\" && res && \"output\" in res && Array.isArray(res[\"output\"])) {\n    const output = res[\"output\"];\n\n    if (output.length > 1) {\n      return output;\n    }\n    if (output.length === 1) {\n      return output[0] as Record<string, unknown>;\n    }\n\n    return null;\n  }\n\n  if (!(res instanceof Object && \"choices\" in res && Array.isArray(res.choices))) {\n    return \"\";\n  }\n\n  return \"message\" in res.choices[0] ? res.choices[0].message : res.choices[0].text ?? \"\";\n};\n\nexport const parseUsage = (res: unknown): Usage | undefined => {\n  if (hasCompletionUsage(res)) {\n    const { prompt_tokens, completion_tokens, total_tokens } = res.usage;\n\n    return {\n      input: prompt_tokens,\n      output: completion_tokens,\n      total: total_tokens,\n    };\n  }\n};\n\nexport const parseUsageDetails = (completionUsage: OpenAI.CompletionUsage): UsageDetails | undefined => {\n  if (\"prompt_tokens\" in completionUsage) {\n    const { prompt_tokens, completion_tokens, total_tokens, completion_tokens_details, prompt_tokens_details } =\n      completionUsage;\n\n    return {\n      input: prompt_tokens,\n      output: completion_tokens,\n      total: total_tokens,\n      ...Object.fromEntries(\n        Object.entries(prompt_tokens_details ?? {}).map(([key, value]) => [`input_${key}`, value as number])\n      ),\n      ...Object.fromEntries(\n        Object.entries(completion_tokens_details ?? {}).map(([key, value]) => [`output_${key}`, value as number])\n      ),\n    };\n  } else if (\"input_tokens\" in completionUsage) {\n    const { input_tokens, output_tokens, total_tokens, input_tokens_details, output_tokens_details } = completionUsage;\n\n    return {\n      input: input_tokens,\n      output: output_tokens,\n      total: total_tokens,\n      ...Object.fromEntries(\n        Object.entries(input_tokens_details ?? {}).map(([key, value]) => [`input_${key}`, value as number])\n      ),\n      ...Object.fromEntries(\n        Object.entries(output_tokens_details ?? {}).map(([key, value]) => [`output_${key}`, value as number])\n      ),\n    };\n  }\n};\n\nexport const parseUsageDetailsFromResponse = (res: unknown): UsageDetails | undefined => {\n  if (hasCompletionUsage(res)) {\n    return parseUsageDetails(res.usage);\n  }\n};\n\nexport const parseChunk = (\n  rawChunk: unknown\n):\n  | { isToolCall: false; data: string }\n  | { isToolCall: true; data: OpenAI.Chat.Completions.ChatCompletionChunk.Choice.Delta.ToolCall } => {\n  let isToolCall = false;\n  const _chunk = rawChunk as OpenAI.ChatCompletionChunk | OpenAI.Completions.Completion;\n  const chunkData = _chunk?.choices?.[0];\n\n  try {\n    if (\"delta\" in chunkData && \"tool_calls\" in chunkData.delta && Array.isArray(chunkData.delta.tool_calls)) {\n      isToolCall = true;\n\n      return { isToolCall, data: chunkData.delta.tool_calls[0] };\n    }\n    if (\"delta\" in chunkData) {\n      return { isToolCall, data: chunkData.delta?.content || \"\" };\n    }\n\n    if (\"text\" in chunkData) {\n      return { isToolCall, data: chunkData.text || \"\" };\n    }\n  } catch (e) {}\n\n  return { isToolCall: false, data: \"\" };\n};\n\n// Type guard to check if an unknown object is a UsageResponse\nfunction hasCompletionUsage(obj: any): obj is { usage: OpenAI.CompletionUsage } {\n  return (\n    obj instanceof Object &&\n    \"usage\" in obj &&\n    obj.usage instanceof Object &&\n    // Completion API Usage format\n    ((typeof obj.usage.prompt_tokens === \"number\" &&\n      typeof obj.usage.completion_tokens === \"number\" &&\n      typeof obj.usage.total_tokens === \"number\") ||\n      // Response API Usage format\n      (typeof obj.usage.input_tokens === \"number\" &&\n        typeof obj.usage.output_tokens === \"number\" &&\n        typeof obj.usage.total_tokens === \"number\"))\n  );\n}\n\nexport const getToolCallOutput = (\n  toolCallChunks: OpenAI.Chat.Completions.ChatCompletionChunk.Choice.Delta.ToolCall[]\n): {\n  tool_calls: {\n    function: {\n      name: string;\n      arguments: string;\n    };\n  }[];\n} => {\n  let name = \"\";\n  let toolArguments = \"\";\n\n  for (const toolCall of toolCallChunks) {\n    name = toolCall.function?.name || name;\n    toolArguments += toolCall.function?.arguments || \"\";\n  }\n\n  return {\n    tool_calls: [\n      {\n        function: {\n          name,\n          arguments: toolArguments,\n        },\n      },\n    ],\n  };\n};\n\nexport const parseModelDataFromResponse = (\n  res: unknown\n): {\n  model: string | undefined;\n  modelParameters: Record<string, string | number> | undefined;\n  metadata: Record<string, unknown> | undefined;\n} => {\n  if (typeof res !== \"object\" || res === null) {\n    return {\n      model: undefined,\n      modelParameters: undefined,\n      metadata: undefined,\n    };\n  }\n\n  const model = \"model\" in res ? (res[\"model\"] as string) : undefined;\n  const modelParameters: Record<string, string | number> = {};\n  const modelParamKeys = [\n    \"max_output_tokens\",\n    \"parallel_tool_calls\",\n    \"store\",\n    \"temperature\",\n    \"tool_choice\",\n    \"top_p\",\n    \"truncation\",\n    \"user\",\n  ];\n\n  const metadata: Record<string, unknown> = {};\n  const metadataKeys = [\n    \"reasoning\",\n    \"incomplete_details\",\n    \"instructions\",\n    \"previous_response_id\",\n    \"tools\",\n    \"metadata\",\n    \"status\",\n    \"error\",\n  ];\n\n  for (const key of modelParamKeys) {\n    const val = key in res ? (res[key as keyof typeof res] as string | number) : null;\n    if (val !== null && val !== undefined) {\n      modelParameters[key as keyof typeof modelParameters] = val;\n    }\n  }\n\n  for (const key of metadataKeys) {\n    const val = key in res ? (res[key as keyof typeof res] as string | number) : null;\n    if (val) {\n      metadata[key as keyof typeof metadata] = val;\n    }\n  }\n\n  return {\n    model,\n    modelParameters: Object.keys(modelParameters).length > 0 ? modelParameters : undefined,\n    metadata: Object.keys(metadata).length > 0 ? metadata : undefined,\n  };\n};\n","export const isAsyncIterable = (x: unknown): x is AsyncIterable<unknown> =>\n  x != null && typeof x === \"object\" && typeof (x as any)[Symbol.asyncIterator] === \"function\";\n","import type OpenAI from \"openai\";\n\nimport { type CreateLangfuseGenerationBody } from \"langfuse-core\";\n\nimport { LangfuseSingleton } from \"./LangfuseSingleton\";\nimport {\n  getToolCallOutput,\n  parseChunk,\n  parseCompletionOutput,\n  parseInputArgs,\n  parseUsage,\n  parseUsageDetails,\n  parseModelDataFromResponse,\n  parseUsageDetailsFromResponse,\n} from \"./parseOpenAI\";\nimport { isAsyncIterable } from \"./utils\";\nimport type { LangfuseConfig, LangfuseParent } from \"./types\";\n\ntype GenericMethod = (...args: unknown[]) => unknown;\n\nexport const withTracing = <T extends GenericMethod>(\n  tracedMethod: T,\n  config?: LangfuseConfig & Required<{ generationName: string }>\n): ((...args: Parameters<T>) => Promise<ReturnType<T>>) => {\n  return (...args) => wrapMethod(tracedMethod, config, ...args);\n};\n\nconst wrapMethod = <T extends GenericMethod>(\n  tracedMethod: T,\n  config?: LangfuseConfig,\n  ...args: Parameters<T>\n): ReturnType<T> | any => {\n  const { model, input, modelParameters } = parseInputArgs(args[0] ?? {});\n\n  const finalModelParams = { ...modelParameters, response_format: null };\n  const finalMetadata = {\n    ...config?.metadata,\n    response_format: \"response_format\" in modelParameters ? modelParameters.response_format : undefined,\n  };\n\n  let observationData = {\n    model,\n    input,\n    modelParameters: finalModelParams,\n    name: config?.generationName,\n    startTime: new Date(),\n    promptName: config?.langfusePrompt?.name,\n    promptVersion: config?.langfusePrompt?.version,\n    metadata: finalMetadata,\n  };\n\n  let langfuseParent: LangfuseParent;\n  const hasUserProvidedParent = config && \"parent\" in config;\n\n  if (hasUserProvidedParent) {\n    langfuseParent = config.parent;\n\n    // Remove the parent from the config to avoid circular references in the generation body\n    const filteredConfig = { ...config, parent: undefined };\n\n    observationData = {\n      ...filteredConfig,\n      ...observationData,\n      promptName: config?.promptName ?? config?.langfusePrompt?.name, // Maintain backward compatibility for users who use promptName\n      promptVersion: config?.promptVersion ?? config?.langfusePrompt?.version, // Maintain backward compatibility for users who use promptVersion\n    };\n  } else {\n    const langfuse = LangfuseSingleton.getInstance(config?.clientInitParams);\n    langfuseParent = langfuse.trace({\n      ...config,\n      ...observationData,\n      id: config?.traceId,\n      name: config?.traceName,\n      timestamp: observationData.startTime,\n    });\n  }\n\n  try {\n    const res = tracedMethod(...args);\n\n    // Handle stream responses\n    if (isAsyncIterable(res)) {\n      return wrapAsyncIterable(res, langfuseParent, hasUserProvidedParent, observationData);\n    }\n\n    if (res instanceof Promise) {\n      const wrappedPromise = res\n        .then((result) => {\n          if (isAsyncIterable(result)) {\n            return wrapAsyncIterable(result, langfuseParent, hasUserProvidedParent, observationData);\n          }\n\n          const output = parseCompletionOutput(result);\n          const usage = parseUsage(result);\n          const usageDetails = parseUsageDetailsFromResponse(result);\n          const {\n            model: modelFromResponse,\n            modelParameters: modelParametersFromResponse,\n            metadata: metadataFromResponse,\n          } = parseModelDataFromResponse(result);\n\n          langfuseParent.generation({\n            ...observationData,\n            output,\n            endTime: new Date(),\n            usage,\n            usageDetails,\n            model: modelFromResponse || observationData.model,\n            modelParameters: { ...observationData.modelParameters, ...modelParametersFromResponse },\n            metadata: { ...observationData.metadata, ...metadataFromResponse },\n          });\n\n          if (!hasUserProvidedParent) {\n            langfuseParent.update({ output });\n          }\n\n          return result;\n        })\n        .catch((err) => {\n          langfuseParent.generation({\n            ...observationData,\n            endTime: new Date(),\n            statusMessage: String(err),\n            level: \"ERROR\",\n            usage: {\n              inputCost: 0,\n              outputCost: 0,\n              totalCost: 0,\n            },\n            costDetails: {\n              input: 0,\n              output: 0,\n              total: 0,\n            },\n          });\n\n          throw err;\n        });\n\n      return wrappedPromise;\n    }\n\n    return res;\n  } catch (error) {\n    langfuseParent.generation({\n      ...observationData,\n      endTime: new Date(),\n      statusMessage: String(error),\n      level: \"ERROR\",\n      usage: {\n        inputCost: 0,\n        outputCost: 0,\n        totalCost: 0,\n      },\n      costDetails: {\n        input: 0,\n        output: 0,\n        total: 0,\n      },\n    });\n\n    throw error;\n  }\n};\n\nfunction wrapAsyncIterable<R>(\n  iterable: AsyncIterable<unknown>,\n  langfuseParent: LangfuseParent,\n  hasUserProvidedParent: boolean | undefined,\n  observationData: Record<string, any>\n): R {\n  async function* tracedOutputGenerator(): AsyncGenerator<unknown, void, unknown> {\n    const response = iterable;\n    const textChunks: string[] = [];\n    const toolCallChunks: OpenAI.Chat.Completions.ChatCompletionChunk.Choice.Delta.ToolCall[] = [];\n    let completionStartTime: Date | null = null;\n    let usage: OpenAI.CompletionUsage | null = null;\n    let usageDetails: CreateLangfuseGenerationBody[\"usageDetails\"] = undefined;\n    let output: CreateLangfuseGenerationBody[\"output\"] = null;\n\n    for await (const rawChunk of response as AsyncIterable<unknown>) {\n      completionStartTime = completionStartTime ?? new Date();\n\n      // Handle Response API chunks\n      if (typeof rawChunk === \"object\" && rawChunk && \"response\" in rawChunk) {\n        const result = rawChunk[\"response\"];\n        output = parseCompletionOutput(result);\n        usageDetails = parseUsageDetailsFromResponse(result);\n\n        const {\n          model: modelFromResponse,\n          modelParameters: modelParametersFromResponse,\n          metadata: metadataFromResponse,\n        } = parseModelDataFromResponse(result);\n\n        observationData[\"model\"] = modelFromResponse ?? observationData[\"model\"];\n        observationData[\"modelParameters\"] = { ...observationData.modelParameters, ...modelParametersFromResponse };\n        observationData[\"metadata\"] = { ...observationData.metadata, ...metadataFromResponse };\n      }\n\n      if (typeof rawChunk === \"object\" && rawChunk != null && \"usage\" in rawChunk) {\n        usage = rawChunk.usage as OpenAI.CompletionUsage | null;\n      }\n\n      const processedChunk = parseChunk(rawChunk);\n\n      if (!processedChunk.isToolCall) {\n        textChunks.push(processedChunk.data);\n      } else {\n        toolCallChunks.push(processedChunk.data);\n      }\n\n      yield rawChunk;\n    }\n\n    output = output ?? (toolCallChunks.length > 0 ? getToolCallOutput(toolCallChunks) : textChunks.join(\"\"));\n\n    langfuseParent.generation({\n      ...observationData,\n      output,\n      endTime: new Date(),\n      completionStartTime,\n      usage: usage\n        ? {\n            input: \"prompt_tokens\" in usage ? usage.prompt_tokens : undefined,\n            output: \"completion_tokens\" in usage ? usage.completion_tokens : undefined,\n            total: \"total_tokens\" in usage ? usage.total_tokens : undefined,\n          }\n        : undefined,\n      usageDetails: usageDetails ?? (usage ? parseUsageDetails(usage) : undefined),\n    });\n\n    if (!hasUserProvidedParent) {\n      langfuseParent.update({ output });\n    }\n  }\n\n  return tracedOutputGenerator() as R;\n}\n","import type { LangfuseCore } from \"langfuse-core\";\n\nimport { LangfuseSingleton } from \"./LangfuseSingleton\";\nimport { withTracing } from \"./traceMethod\";\nimport type { LangfuseConfig, LangfuseExtension } from \"./types\";\n\n/**\n * Wraps an OpenAI SDK object with Langfuse tracing. Function calls are extended with a tracer that logs detailed information about the call, including the method name,\n * input parameters, and output.\n * \n * @param {T} sdk - The OpenAI SDK object to be wrapped.\n * @param {LangfuseConfig} [langfuseConfig] - Optional configuration object for the wrapper.\n * @param {string} [langfuseConfig.traceName] - The name to use for tracing. If not provided, a default name based on the SDK's constructor name and the method name will be used.\n * @param {string} [langfuseConfig.sessionId] - Optional session ID for tracing.\n * @param {string} [langfuseConfig.userId] - Optional user ID for tracing.\n * @param {string} [langfuseConfig.release] - Optional release version for tracing.\n * @param {string} [langfuseConfig.version] - Optional version for tracing.\n * @param {string} [langfuseConfig.metadata] - Optional metadata for tracing.\n * @param {string} [langfuseConfig.tags] - Optional tags for tracing.\n * @returns {T} - A proxy of the original SDK object with methods wrapped for tracing.\n *\n * @example\n * const client = new OpenAI();\n * const res = observeOpenAI(client, { traceName: \"My.OpenAI.Chat.Trace\" }).chat.completions.create({\n *      messages: [{ role: \"system\", content: \"Say this is a test!\" }],\n        model: \"gpt-3.5-turbo\",\n        user: \"langfuse\",\n        max_tokens: 300\n * });\n * */\nexport const observeOpenAI = <SDKType extends object>(\n  sdk: SDKType,\n  langfuseConfig?: LangfuseConfig\n): SDKType & LangfuseExtension => {\n  return new Proxy(sdk, {\n    get(wrappedSdk, propKey, proxy) {\n      const originalProperty = wrappedSdk[propKey as keyof SDKType];\n\n      const defaultGenerationName = `${sdk.constructor?.name}.${propKey.toString()}`;\n      const generationName = langfuseConfig?.generationName ?? defaultGenerationName;\n      const traceName = langfuseConfig && \"traceName\" in langfuseConfig ? langfuseConfig.traceName : generationName;\n      const config = { ...langfuseConfig, generationName, traceName };\n\n      // Add a flushAsync method to the OpenAI SDK that flushes the Langfuse client\n      if (propKey === \"flushAsync\") {\n        let langfuseClient: LangfuseCore;\n\n        // Flush the correct client depending on whether a parent client is provided\n        if (langfuseConfig && \"parent\" in langfuseConfig) {\n          langfuseClient = langfuseConfig.parent.client;\n        } else {\n          langfuseClient = LangfuseSingleton.getInstance();\n        }\n\n        return langfuseClient.flushAsync.bind(langfuseClient);\n      }\n\n      // Add a shutdownAsync method to the OpenAI SDK that flushes the Langfuse client\n      if (propKey === \"shutdownAsync\") {\n        let langfuseClient: LangfuseCore;\n\n        // Flush the correct client depending on whether a parent client is provided\n        if (langfuseConfig && \"parent\" in langfuseConfig) {\n          langfuseClient = langfuseConfig.parent.client;\n        } else {\n          langfuseClient = LangfuseSingleton.getInstance();\n        }\n\n        return langfuseClient.shutdownAsync.bind(langfuseClient);\n      }\n\n      // Trace methods of the OpenAI SDK\n      if (typeof originalProperty === \"function\") {\n        return withTracing(originalProperty.bind(wrappedSdk), config);\n      }\n\n      const isNestedOpenAIObject =\n        originalProperty &&\n        !Array.isArray(originalProperty) &&\n        !(originalProperty instanceof Date) &&\n        typeof originalProperty === \"object\";\n\n      // Recursively wrap nested objects to ensure all nested properties or methods are also traced\n      if (isNestedOpenAIObject) {\n        return observeOpenAI(originalProperty, config);\n      }\n\n      // Fallback to returning the original value\n      return Reflect.get(wrappedSdk, propKey, proxy);\n    },\n  }) as SDKType & LangfuseExtension;\n};\n"],"names":["cookieStore","getItem","key","nameEQ","ca","document","cookie","split","i","length","c","charAt","substring","indexOf","decodeURIComponent","err","setItem","value","cdomain","expires","secure","new_cookie_val","encodeURIComponent","removeItem","name","clear","getAllKeys","keys","push","createStorageLike","store","localStorage","checkStoreIsSupported","storage","window","val","localStore","undefined","sessionStore","createMemoryStorage","_cache","getStorage","type","_localStore","_sessionStore","sessionStorage","ContentType","HttpClient","constructor","apiConfig","baseUrl","securityData","abortControllers","Map","customFetch","fetchParams","fetch","baseApiParams","credentials","headers","redirect","referrerPolicy","setSecurityData","data","contentFormatters","Json","input","JSON","stringify","Text","FormData","Object","reduce","formData","property","append","Blob","UrlEncoded","toQueryString","createAbortSignal","cancelToken","has","abortController","get","signal","AbortController","set","abortRequest","abort","delete","request","body","path","query","format","params","secureParams","securityWorker","requestParams","mergeRequestParams","queryString","payloadFormatter","responseFormat","then","response","r","clone","error","ok","catch","e","assign","encodeQueryParam","encodedKey","addQueryParam","addArrayQueryParam","map","v","join","rawQuery","filter","Array","isArray","addQueryParams","params1","params2","LangfusePublicApi","api","annotationQueuesCreateQueueItem","queueId","method","annotationQueuesDeleteQueueItem","itemId","annotationQueuesGetQueue","annotationQueuesGetQueueItem","annotationQueuesListQueueItems","annotationQueuesListQueues","annotationQueuesUpdateQueueItem","commentsCreate","commentsGet","commentsGetById","commentId","datasetItemsCreate","datasetItemsDelete","id","datasetItemsGet","datasetItemsList","datasetRunItemsCreate","datasetsCreate","datasetsDeleteRun","datasetName","runName","datasetsGet","datasetsGetRun","datasetsGetRuns","datasetsList","healthHealth","ingestionBatch","mediaGet","mediaId","mediaGetUploadUrl","mediaPatch","metricsDaily","modelsCreate","modelsDelete","modelsGet","modelsList","observationsGet","observationId","observationsGetMany","projectsGet","promptsCreate","promptsGet","promptName","promptsList","promptVersionUpdate","version","scoreConfigsCreate","scoreConfigsGet","scoreConfigsGetById","configId","scoreCreate","scoreDelete","scoreId","scoreGet","scoreGetById","sessionsGet","sessionId","sessionsList","traceDelete","traceId","traceDeleteMultiple","traceGet","traceList","Langfuse","LangfuseCore","langfuseConfig","utils","configLangfuseSDK","_storageKey","persistence_name","publicKey","_storage","persistence","getLibraryVersion","getLibraryId","sdkIntegration","additionalHeaders","constructAuthorizationHeader","secretKey","getPersistedProperty","_storageCache","parse","setPersistedProperty","url","options","getCustomUserAgent","LangfuseWeb","LangfuseWebStateless","LangfuseSingleton","getInstance","instance","parseInputArgs","args","frequency_penalty","logit_bias","logprobs","max_tokens","n","presence_penalty","seed","stop","stream","temperature","top_p","user","response_format","top_logprobs","messages","function_call","functions","tools","tool_choice","prompt","model","modelParameters","parseCompletionOutput","res","output","choices","message","text","parseUsage","hasCompletionUsage","prompt_tokens","completion_tokens","total_tokens","usage","total","parseUsageDetails","completionUsage","completion_tokens_details","prompt_tokens_details","fromEntries","entries","input_tokens","output_tokens","input_tokens_details","output_tokens_details","parseUsageDetailsFromResponse","parseChunk","rawChunk","isToolCall","_chunk","chunkData","delta","tool_calls","content","obj","getToolCallOutput","toolCallChunks","toolArguments","toolCall","function","arguments","parseModelDataFromResponse","metadata","modelParamKeys","metadataKeys","isAsyncIterable","x","Symbol","asyncIterator","withTracing","tracedMethod","config","wrapMethod","finalModelParams","finalMetadata","observationData","generationName","startTime","Date","langfusePrompt","promptVersion","langfuseParent","hasUserProvidedParent","parent","filteredConfig","langfuse","clientInitParams","trace","traceName","timestamp","wrapAsyncIterable","Promise","wrappedPromise","result","usageDetails","modelFromResponse","modelParametersFromResponse","metadataFromResponse","generation","endTime","update","statusMessage","String","level","inputCost","outputCost","totalCost","costDetails","iterable","tracedOutputGenerator","textChunks","completionStartTime","processedChunk","observeOpenAI","sdk","Proxy","wrappedSdk","propKey","proxy","originalProperty","defaultGenerationName","toString","langfuseClient","client","flushAsync","bind","shutdownAsync","isNestedOpenAIObject","Reflect"],"mappings":";;;AAUA;AACO,MAAMA,WAAW,GAAoB;EAC1CC,OAAOA,CAACC,GAAG,EAAA;IACT,IAAI;AACF,MAAA,MAAMC,MAAM,GAAGD,GAAG,GAAG,GAAG,CAAA;MACxB,MAAME,EAAE,GAAGC,QAAQ,CAACC,MAAM,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;AACrC,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,EAAE,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;AAClC,QAAA,IAAIE,CAAC,GAAGN,EAAE,CAACI,CAAC,CAAC,CAAA;QACb,OAA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