@langfuse/core 4.4.10-alpha.2 → 4.4.10
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 +111 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.mjs +111 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -351,7 +351,7 @@ var resetGlobalLogger = () => {
|
|
|
351
351
|
// package.json
|
|
352
352
|
var package_default = {
|
|
353
353
|
name: "@langfuse/core",
|
|
354
|
-
version: "4.4.10-alpha.
|
|
354
|
+
version: "4.4.10-alpha.3",
|
|
355
355
|
description: "Core functions and utilities for Langfuse packages",
|
|
356
356
|
type: "module",
|
|
357
357
|
sideEffects: false,
|
|
@@ -7589,7 +7589,7 @@ var Projects = class {
|
|
|
7589
7589
|
this._options = _options;
|
|
7590
7590
|
}
|
|
7591
7591
|
/**
|
|
7592
|
-
* Get Project associated with API key
|
|
7592
|
+
* Get Project associated with API key (requires project-scoped API key). You can use GET /api/public/organizations/projects to get all projects with an organization-scoped key.
|
|
7593
7593
|
*
|
|
7594
7594
|
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
|
|
7595
7595
|
*
|
|
@@ -8838,6 +8838,115 @@ var Prompts = class {
|
|
|
8838
8838
|
});
|
|
8839
8839
|
}
|
|
8840
8840
|
}
|
|
8841
|
+
/**
|
|
8842
|
+
* Delete prompt versions. If neither version nor label is specified, all versions of the prompt are deleted.
|
|
8843
|
+
*
|
|
8844
|
+
* @param {string} promptName - The name of the prompt
|
|
8845
|
+
* @param {LangfuseAPI.DeletePromptRequest} request
|
|
8846
|
+
* @param {Prompts.RequestOptions} requestOptions - Request-specific configuration.
|
|
8847
|
+
*
|
|
8848
|
+
* @throws {@link LangfuseAPI.Error}
|
|
8849
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
8850
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
8851
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
8852
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
8853
|
+
*
|
|
8854
|
+
* @example
|
|
8855
|
+
* await client.prompts.delete("promptName")
|
|
8856
|
+
*/
|
|
8857
|
+
delete(promptName, request = {}, requestOptions) {
|
|
8858
|
+
return HttpResponsePromise.fromPromise(
|
|
8859
|
+
this.__delete(promptName, request, requestOptions)
|
|
8860
|
+
);
|
|
8861
|
+
}
|
|
8862
|
+
async __delete(promptName, request = {}, requestOptions) {
|
|
8863
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
8864
|
+
const { label, version } = request;
|
|
8865
|
+
const _queryParams = {};
|
|
8866
|
+
if (label != null) {
|
|
8867
|
+
_queryParams["label"] = label;
|
|
8868
|
+
}
|
|
8869
|
+
if (version != null) {
|
|
8870
|
+
_queryParams["version"] = version.toString();
|
|
8871
|
+
}
|
|
8872
|
+
let _headers = mergeHeaders(
|
|
8873
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
8874
|
+
mergeOnlyDefinedHeaders({
|
|
8875
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
8876
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
8877
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
8878
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
8879
|
+
}),
|
|
8880
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
8881
|
+
);
|
|
8882
|
+
const _response = await fetcher({
|
|
8883
|
+
url: url_exports.join(
|
|
8884
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
8885
|
+
`/api/public/v2/prompts/${encodeURIComponent(promptName)}`
|
|
8886
|
+
),
|
|
8887
|
+
method: "DELETE",
|
|
8888
|
+
headers: _headers,
|
|
8889
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
8890
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
8891
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
8892
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
8893
|
+
});
|
|
8894
|
+
if (_response.ok) {
|
|
8895
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
8896
|
+
}
|
|
8897
|
+
if (_response.error.reason === "status-code") {
|
|
8898
|
+
switch (_response.error.statusCode) {
|
|
8899
|
+
case 400:
|
|
8900
|
+
throw new Error2(
|
|
8901
|
+
_response.error.body,
|
|
8902
|
+
_response.rawResponse
|
|
8903
|
+
);
|
|
8904
|
+
case 401:
|
|
8905
|
+
throw new UnauthorizedError(
|
|
8906
|
+
_response.error.body,
|
|
8907
|
+
_response.rawResponse
|
|
8908
|
+
);
|
|
8909
|
+
case 403:
|
|
8910
|
+
throw new AccessDeniedError(
|
|
8911
|
+
_response.error.body,
|
|
8912
|
+
_response.rawResponse
|
|
8913
|
+
);
|
|
8914
|
+
case 405:
|
|
8915
|
+
throw new MethodNotAllowedError(
|
|
8916
|
+
_response.error.body,
|
|
8917
|
+
_response.rawResponse
|
|
8918
|
+
);
|
|
8919
|
+
case 404:
|
|
8920
|
+
throw new NotFoundError(
|
|
8921
|
+
_response.error.body,
|
|
8922
|
+
_response.rawResponse
|
|
8923
|
+
);
|
|
8924
|
+
default:
|
|
8925
|
+
throw new LangfuseAPIError({
|
|
8926
|
+
statusCode: _response.error.statusCode,
|
|
8927
|
+
body: _response.error.body,
|
|
8928
|
+
rawResponse: _response.rawResponse
|
|
8929
|
+
});
|
|
8930
|
+
}
|
|
8931
|
+
}
|
|
8932
|
+
switch (_response.error.reason) {
|
|
8933
|
+
case "non-json":
|
|
8934
|
+
throw new LangfuseAPIError({
|
|
8935
|
+
statusCode: _response.error.statusCode,
|
|
8936
|
+
body: _response.error.rawBody,
|
|
8937
|
+
rawResponse: _response.rawResponse
|
|
8938
|
+
});
|
|
8939
|
+
case "timeout":
|
|
8940
|
+
throw new LangfuseAPITimeoutError(
|
|
8941
|
+
"Timeout exceeded when calling DELETE /api/public/v2/prompts/{promptName}."
|
|
8942
|
+
);
|
|
8943
|
+
case "unknown":
|
|
8944
|
+
throw new LangfuseAPIError({
|
|
8945
|
+
message: _response.error.errorMessage,
|
|
8946
|
+
rawResponse: _response.rawResponse
|
|
8947
|
+
});
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8841
8950
|
async _getAuthorizationHeader() {
|
|
8842
8951
|
const username = await Supplier.get(this._options.username);
|
|
8843
8952
|
const password = await Supplier.get(this._options.password);
|