@langfuse/core 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +128 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -12
- package/dist/index.d.ts +87 -12
- package/dist/index.mjs +127 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
BlobStorageExportMode: () => BlobStorageExportMode,
|
|
28
28
|
BlobStorageIntegrationFileType: () => BlobStorageIntegrationFileType,
|
|
29
29
|
BlobStorageIntegrationType: () => BlobStorageIntegrationType,
|
|
30
|
+
BlobStorageSyncStatus: () => BlobStorageSyncStatus,
|
|
30
31
|
ChatMessageType: () => ChatMessageType,
|
|
31
32
|
CommentObjectType: () => CommentObjectType,
|
|
32
33
|
CreateChatPromptType: () => CreateChatPromptType,
|
|
@@ -183,6 +184,7 @@ function serializeValue(value) {
|
|
|
183
184
|
|
|
184
185
|
// src/logger/index.ts
|
|
185
186
|
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
187
|
+
LogLevel2[LogLevel2["NONE"] = 4] = "NONE";
|
|
186
188
|
LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
|
|
187
189
|
LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
|
|
188
190
|
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
@@ -197,6 +199,8 @@ function parseLogLevelFromEnv() {
|
|
|
197
199
|
const envValue = getEnv("LANGFUSE_LOG_LEVEL");
|
|
198
200
|
const value = (envValue != null ? envValue : "").toUpperCase();
|
|
199
201
|
switch (value) {
|
|
202
|
+
case "NONE":
|
|
203
|
+
return 4 /* NONE */;
|
|
200
204
|
case "ERROR":
|
|
201
205
|
return 3 /* ERROR */;
|
|
202
206
|
case "WARN":
|
|
@@ -376,7 +380,7 @@ var resetGlobalLogger = () => {
|
|
|
376
380
|
// package.json
|
|
377
381
|
var package_default = {
|
|
378
382
|
name: "@langfuse/core",
|
|
379
|
-
version: "
|
|
383
|
+
version: "5.0.2",
|
|
380
384
|
description: "Core functions and utilities for Langfuse packages",
|
|
381
385
|
type: "module",
|
|
382
386
|
sideEffects: false,
|
|
@@ -487,7 +491,8 @@ __export(blobStorageIntegrations_exports, {
|
|
|
487
491
|
BlobStorageExportFrequency: () => BlobStorageExportFrequency,
|
|
488
492
|
BlobStorageExportMode: () => BlobStorageExportMode,
|
|
489
493
|
BlobStorageIntegrationFileType: () => BlobStorageIntegrationFileType,
|
|
490
|
-
BlobStorageIntegrationType: () => BlobStorageIntegrationType
|
|
494
|
+
BlobStorageIntegrationType: () => BlobStorageIntegrationType,
|
|
495
|
+
BlobStorageSyncStatus: () => BlobStorageSyncStatus
|
|
491
496
|
});
|
|
492
497
|
|
|
493
498
|
// src/api/api/resources/blobStorageIntegrations/types/BlobStorageIntegrationType.ts
|
|
@@ -518,6 +523,15 @@ var BlobStorageExportFrequency = {
|
|
|
518
523
|
Weekly: "weekly"
|
|
519
524
|
};
|
|
520
525
|
|
|
526
|
+
// src/api/api/resources/blobStorageIntegrations/types/BlobStorageSyncStatus.ts
|
|
527
|
+
var BlobStorageSyncStatus = {
|
|
528
|
+
Idle: "idle",
|
|
529
|
+
Queued: "queued",
|
|
530
|
+
UpToDate: "up_to_date",
|
|
531
|
+
Disabled: "disabled",
|
|
532
|
+
Error: "error"
|
|
533
|
+
};
|
|
534
|
+
|
|
521
535
|
// src/api/api/resources/comments/index.ts
|
|
522
536
|
var comments_exports = {};
|
|
523
537
|
|
|
@@ -2929,7 +2943,8 @@ var BlobStorageIntegrations = class {
|
|
|
2929
2943
|
* forcePathStyle: true,
|
|
2930
2944
|
* fileType: "JSON",
|
|
2931
2945
|
* exportMode: "FULL_HISTORY",
|
|
2932
|
-
* exportStartDate: undefined
|
|
2946
|
+
* exportStartDate: undefined,
|
|
2947
|
+
* compressed: undefined
|
|
2933
2948
|
* })
|
|
2934
2949
|
*/
|
|
2935
2950
|
upsertBlobStorageIntegration(request, requestOptions) {
|
|
@@ -3023,6 +3038,109 @@ var BlobStorageIntegrations = class {
|
|
|
3023
3038
|
});
|
|
3024
3039
|
}
|
|
3025
3040
|
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Get the sync status of a blob storage integration by integration ID (requires organization-scoped API key)
|
|
3043
|
+
*
|
|
3044
|
+
* @param {string} id
|
|
3045
|
+
* @param {BlobStorageIntegrations.RequestOptions} requestOptions - Request-specific configuration.
|
|
3046
|
+
*
|
|
3047
|
+
* @throws {@link LangfuseAPI.Error}
|
|
3048
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
3049
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
3050
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
3051
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
3052
|
+
*
|
|
3053
|
+
* @example
|
|
3054
|
+
* await client.blobStorageIntegrations.getBlobStorageIntegrationStatus("id")
|
|
3055
|
+
*/
|
|
3056
|
+
getBlobStorageIntegrationStatus(id, requestOptions) {
|
|
3057
|
+
return HttpResponsePromise.fromPromise(
|
|
3058
|
+
this.__getBlobStorageIntegrationStatus(id, requestOptions)
|
|
3059
|
+
);
|
|
3060
|
+
}
|
|
3061
|
+
async __getBlobStorageIntegrationStatus(id, requestOptions) {
|
|
3062
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
3063
|
+
let _headers = mergeHeaders(
|
|
3064
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
3065
|
+
mergeOnlyDefinedHeaders({
|
|
3066
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3067
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
3068
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
3069
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
3070
|
+
}),
|
|
3071
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
3072
|
+
);
|
|
3073
|
+
const _response = await fetcher({
|
|
3074
|
+
url: url_exports.join(
|
|
3075
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
3076
|
+
`/api/public/integrations/blob-storage/${encodeURIComponent(id)}`
|
|
3077
|
+
),
|
|
3078
|
+
method: "GET",
|
|
3079
|
+
headers: _headers,
|
|
3080
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
3081
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3082
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
3083
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
3084
|
+
});
|
|
3085
|
+
if (_response.ok) {
|
|
3086
|
+
return {
|
|
3087
|
+
data: _response.body,
|
|
3088
|
+
rawResponse: _response.rawResponse
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
if (_response.error.reason === "status-code") {
|
|
3092
|
+
switch (_response.error.statusCode) {
|
|
3093
|
+
case 400:
|
|
3094
|
+
throw new Error2(
|
|
3095
|
+
_response.error.body,
|
|
3096
|
+
_response.rawResponse
|
|
3097
|
+
);
|
|
3098
|
+
case 401:
|
|
3099
|
+
throw new UnauthorizedError(
|
|
3100
|
+
_response.error.body,
|
|
3101
|
+
_response.rawResponse
|
|
3102
|
+
);
|
|
3103
|
+
case 403:
|
|
3104
|
+
throw new AccessDeniedError(
|
|
3105
|
+
_response.error.body,
|
|
3106
|
+
_response.rawResponse
|
|
3107
|
+
);
|
|
3108
|
+
case 405:
|
|
3109
|
+
throw new MethodNotAllowedError(
|
|
3110
|
+
_response.error.body,
|
|
3111
|
+
_response.rawResponse
|
|
3112
|
+
);
|
|
3113
|
+
case 404:
|
|
3114
|
+
throw new NotFoundError(
|
|
3115
|
+
_response.error.body,
|
|
3116
|
+
_response.rawResponse
|
|
3117
|
+
);
|
|
3118
|
+
default:
|
|
3119
|
+
throw new LangfuseAPIError({
|
|
3120
|
+
statusCode: _response.error.statusCode,
|
|
3121
|
+
body: _response.error.body,
|
|
3122
|
+
rawResponse: _response.rawResponse
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
switch (_response.error.reason) {
|
|
3127
|
+
case "non-json":
|
|
3128
|
+
throw new LangfuseAPIError({
|
|
3129
|
+
statusCode: _response.error.statusCode,
|
|
3130
|
+
body: _response.error.rawBody,
|
|
3131
|
+
rawResponse: _response.rawResponse
|
|
3132
|
+
});
|
|
3133
|
+
case "timeout":
|
|
3134
|
+
throw new LangfuseAPITimeoutError(
|
|
3135
|
+
"Timeout exceeded when calling GET /api/public/integrations/blob-storage/{id}."
|
|
3136
|
+
);
|
|
3137
|
+
case "unknown":
|
|
3138
|
+
throw new LangfuseAPIError({
|
|
3139
|
+
message: _response.error.errorMessage,
|
|
3140
|
+
rawResponse: _response.rawResponse
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3026
3144
|
/**
|
|
3027
3145
|
* Delete a blob storage integration by ID (requires organization-scoped API key)
|
|
3028
3146
|
*
|
|
@@ -3985,7 +4103,8 @@ var DatasetRunItems = class {
|
|
|
3985
4103
|
* datasetItemId: "datasetItemId",
|
|
3986
4104
|
* observationId: undefined,
|
|
3987
4105
|
* traceId: undefined,
|
|
3988
|
-
* datasetVersion: undefined
|
|
4106
|
+
* datasetVersion: undefined,
|
|
4107
|
+
* createdAt: undefined
|
|
3989
4108
|
* })
|
|
3990
4109
|
*/
|
|
3991
4110
|
create(request, requestOptions) {
|
|
@@ -9287,7 +9406,7 @@ var Prompts = class {
|
|
|
9287
9406
|
}
|
|
9288
9407
|
async __get(promptName, request = {}, requestOptions) {
|
|
9289
9408
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
9290
|
-
const { version, label } = request;
|
|
9409
|
+
const { version, label, resolve } = request;
|
|
9291
9410
|
const _queryParams = {};
|
|
9292
9411
|
if (version != null) {
|
|
9293
9412
|
_queryParams["version"] = version.toString();
|
|
@@ -9295,6 +9414,9 @@ var Prompts = class {
|
|
|
9295
9414
|
if (label != null) {
|
|
9296
9415
|
_queryParams["label"] = label;
|
|
9297
9416
|
}
|
|
9417
|
+
if (resolve != null) {
|
|
9418
|
+
_queryParams["resolve"] = resolve.toString();
|
|
9419
|
+
}
|
|
9298
9420
|
let _headers = mergeHeaders(
|
|
9299
9421
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
9300
9422
|
mergeOnlyDefinedHeaders({
|
|
@@ -12711,6 +12833,7 @@ function getSpanKeyFromBaggageKey(baggageKey) {
|
|
|
12711
12833
|
BlobStorageExportMode,
|
|
12712
12834
|
BlobStorageIntegrationFileType,
|
|
12713
12835
|
BlobStorageIntegrationType,
|
|
12836
|
+
BlobStorageSyncStatus,
|
|
12714
12837
|
ChatMessageType,
|
|
12715
12838
|
CommentObjectType,
|
|
12716
12839
|
CreateChatPromptType,
|