New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

langfuse-core

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langfuse-core - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

35

lib/index.cjs.js
'use strict';
var mustache = require('mustache');
exports.LangfusePersistedProperty = void 0;

@@ -355,2 +357,15 @@ (function (LangfusePersistedProperty) {

}
async createPromptStateless(body) {
return this.fetch(`${this.baseUrl}/api/public/prompts/`, this.getFetchOptions({
method: "POST",
body: JSON.stringify(body)
})).then(res => res.json());
}
async getPromptStateless(name, version) {
const url = `${this.baseUrl}/api/public/prompts/?name=${name}` + (version ? `&version=${version}` : "");
console.log(url);
return this.fetch(url, this.getFetchOptions({
method: "GET"
})).then(res => res.json());
}
/***

@@ -613,2 +628,10 @@ *** QUEUEING AND FLUSHING

}
async createPrompt(body) {
const prompt = await this.createPromptStateless(body);
return new LangfusePromptClient(prompt);
}
async getPrompt(name, version) {
const prompt = await this.getPromptStateless(name, version);
return new LangfusePromptClient(prompt);
}
_updateSpan(body) {

@@ -744,2 +767,13 @@ this.updateSpanStateless(body);

}
class LangfusePromptClient {
constructor(prompt) {
this.promptResponse = prompt;
}
compile(variables) {
if (typeof variables !== "object") {
throw new Error("Variables must be an object");
}
return mustache.render(this.promptResponse.prompt, variables);
}
}

@@ -751,2 +785,3 @@ exports.LangfuseCore = LangfuseCore;

exports.LangfuseObjectClient = LangfuseObjectClient;
exports.LangfusePromptClient = LangfusePromptClient;
exports.LangfuseSpanClient = LangfuseSpanClient;

@@ -753,0 +788,0 @@ exports.LangfuseTraceClient = LangfuseTraceClient;

129

lib/index.d.ts

@@ -54,2 +54,8 @@ /// <reference types="node" />

};
"/api/public/prompts": {
/** @description Get a specific prompt */
get: operations["prompts_get"];
/** @description Create a specific prompt */
post: operations["prompts_create"];
};
"/api/public/scores": {

@@ -141,2 +147,3 @@ /** @description Get scores */

parentObservationId?: string | null;
promptId?: string | null;
};

@@ -268,2 +275,5 @@ /** Usage */

/** @enum {string} */
type?: "sdk-log";
} & components["schemas"]["SDKLogEvent"], "type"> | WithRequired<{
/** @enum {string} */
type?: "observation-create";

@@ -328,2 +338,4 @@ } & components["schemas"]["CreateObservationEvent"], "type"> | WithRequired<{

usage?: components["schemas"]["IngestionUsage"];
promptName?: string | null;
promptVersion?: number | null;
} & components["schemas"]["CreateSpanBody"];

@@ -339,2 +351,4 @@ /** UpdateGenerationBody */

usage?: components["schemas"]["IngestionUsage"];
promptName?: string | null;
promptVersion?: number | null;
} & components["schemas"]["UpdateSpanBody"];

@@ -380,2 +394,6 @@ /** ObservationBody */

};
/** SDKLogBody */
SDKLogBody: {
log: unknown;
};
/** ScoreBody */

@@ -413,2 +431,6 @@ ScoreBody: {

} & components["schemas"]["BaseEvent"], "body">;
/** SDKLogEvent */
SDKLogEvent: WithRequired<{
body: components["schemas"]["SDKLogBody"];
} & components["schemas"]["BaseEvent"], "body">;
/** CreateGenerationEvent */

@@ -465,2 +487,14 @@ CreateGenerationEvent: WithRequired<{

};
/** CreatePromptRequest */
CreatePromptRequest: {
name: string;
isActive: boolean;
prompt: string;
};
/** Prompt */
Prompt: {
name: string;
version: number;
prompt: string;
};
/** CreateScoreRequest */

@@ -946,2 +980,83 @@ CreateScoreRequest: {

};
/** @description Get a specific prompt */
prompts_get: {
parameters: {
query: {
name: string;
version?: number | null;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Prompt"];
};
};
400: {
content: {
"application/json": unknown;
};
};
401: {
content: {
"application/json": unknown;
};
};
403: {
content: {
"application/json": unknown;
};
};
404: {
content: {
"application/json": unknown;
};
};
405: {
content: {
"application/json": unknown;
};
};
};
};
/** @description Create a specific prompt */
prompts_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreatePromptRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Prompt"];
};
};
400: {
content: {
"application/json": unknown;
};
};
401: {
content: {
"application/json": unknown;
};
};
403: {
content: {
"application/json": unknown;
};
};
404: {
content: {
"application/json": unknown;
};
};
405: {
content: {
"application/json": unknown;
};
};
};
};
/** @description Get scores */

@@ -1215,2 +1330,5 @@ score_get: {

type GetLangfuseDatasetRunResponse = FixTypes<paths["/api/public/datasets/{datasetName}/runs/{runName}"]["get"]["responses"]["200"]["content"]["application/json"]>;
type CreateLangfusePromptBody = FixTypes<paths["/api/public/prompts"]["post"]["requestBody"]["content"]["application/json"]>;
type CreateLangfusePromptResponse = FixTypes<paths["/api/public/prompts"]["post"]["responses"]["200"]["content"]["application/json"]>;
type GetLangfusePromptResponse = FixTypes<paths["/api/public/prompts"]["get"]["responses"]["200"]["content"]["application/json"]>;
type JsonType = string | number | boolean | null | {

@@ -1335,2 +1453,4 @@ [key: string]: JsonType;

protected _parsePayload(response: any): any;
createPromptStateless(body: CreateLangfusePromptBody): Promise<CreateLangfusePromptResponse>;
getPromptStateless(name: string, version?: number): Promise<GetLangfusePromptResponse>;
/***

@@ -1379,2 +1499,4 @@ *** QUEUEING AND FLUSHING

}>;
createPrompt(body: CreateLangfusePromptBody): Promise<LangfusePromptClient>;
getPrompt(name: string, version?: number): Promise<LangfusePromptClient>;
_updateSpan(body: UpdateLangfuseSpanBody): this;

@@ -1420,3 +1542,8 @@ _updateGeneration(body: UpdateLangfuseGenerationBody): this;

}
declare class LangfusePromptClient {
private promptResponse;
constructor(prompt: CreateLangfusePromptResponse);
compile(variables: unknown): string;
}
export { CreateLangfuseDatasetBody, CreateLangfuseDatasetItemBody, CreateLangfuseDatasetItemResponse, CreateLangfuseDatasetResponse, CreateLangfuseDatasetRunItemBody, CreateLangfuseDatasetRunItemResponse, CreateLangfuseEventBody, CreateLangfuseGenerationBody, CreateLangfuseScoreBody, CreateLangfuseSpanBody, CreateLangfuseTraceBody, DeferRuntime, GetLangfuseDatasetParams, GetLangfuseDatasetResponse, GetLangfuseDatasetRunParams, GetLangfuseDatasetRunResponse, IngestionBody, IngestionReturnType, JsonType, LangfuseCore, LangfuseCoreOptions, LangfuseEventClient, LangfuseEventProperties, LangfuseFetchOptions, LangfuseFetchResponse, LangfuseGenerationClient, LangfuseMemoryStorage, LangfuseMetadataProperties, LangfuseObject, LangfuseObjectClient, LangfusePersistedProperty, LangfuseQueueItem, LangfuseSpanClient, LangfuseTraceClient, LangfuseWebStateless, SingleIngestionEvent, UpdateLangfuseGenerationBody, UpdateLangfuseSpanBody, Usage, components, external, operations, paths, utils_d as utils, webhooks };
export { CreateLangfuseDatasetBody, CreateLangfuseDatasetItemBody, CreateLangfuseDatasetItemResponse, CreateLangfuseDatasetResponse, CreateLangfuseDatasetRunItemBody, CreateLangfuseDatasetRunItemResponse, CreateLangfuseEventBody, CreateLangfuseGenerationBody, CreateLangfusePromptBody, CreateLangfusePromptResponse, CreateLangfuseScoreBody, CreateLangfuseSpanBody, CreateLangfuseTraceBody, DeferRuntime, GetLangfuseDatasetParams, GetLangfuseDatasetResponse, GetLangfuseDatasetRunParams, GetLangfuseDatasetRunResponse, GetLangfusePromptResponse, IngestionBody, IngestionReturnType, JsonType, LangfuseCore, LangfuseCoreOptions, LangfuseEventClient, LangfuseEventProperties, LangfuseFetchOptions, LangfuseFetchResponse, LangfuseGenerationClient, LangfuseMemoryStorage, LangfuseMetadataProperties, LangfuseObject, LangfuseObjectClient, LangfusePersistedProperty, LangfusePromptClient, LangfuseQueueItem, LangfuseSpanClient, LangfuseTraceClient, LangfuseWebStateless, SingleIngestionEvent, UpdateLangfuseGenerationBody, UpdateLangfuseSpanBody, Usage, components, external, operations, paths, utils_d as utils, webhooks };

10

package.json
{
"name": "langfuse-core",
"version": "2.0.2",
"version": "2.1.0",
"engines": {

@@ -34,3 +34,9 @@ "node": ">=18"

],
"gitHead": "21521a131fc849e17f3e43375ce1a68a5a0fd7f9"
"dependencies": {
"mustache": "^4.2.0"
},
"devDependencies": {
"@types/mustache": "^4.2.5"
},
"gitHead": "477701e959d7020c1a49f9963fc30d1af5876001"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc