Protected
_eventsProtected
Optional
_flushProtected
_retryBatched 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. 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.
Protected
isProtected
publicProtected
sdkProtected
secretProtected
_fetchProtected
_getProtected
_getProtected
_parseProtected
awaitProtected
constructCreates a dataset. Upserts the dataset if it already exists.
Can be either a string (name) or an object with name, description and metadata
A promise that resolves to the response of the create operation.
Creates a dataset item. Upserts the item if it already exists.
The body of the dataset item to be created.
A promise that resolves to the response of the create operation.
Protected
enqueueProtected
eventOptional
query: GetLangfuseObservationsQueryOptional
query: GetLangfuseSessionsQueryOptional
query: GetLangfuseTracesQueryProtected
findAsynchronously flushes all events that are not yet sent to the server. This function always resolves, even if there were errors when flushing. Errors are emitted as "error" events and the promise resolves.
A promise that resolves when the flushing is completed.
Protected
generationProtected
getOptional
options: { Optional
query: { Optional
limit?: null | numberOptional
page?: null | numberOptional
version: numberOptional
options: { Optional
cacheOptional
fallback?: stringOptional
fetchOptional
label?: stringOptional
maxOptional
type?: "text"Optional
version: numberOptional
options: { Optional
cacheOptional
fallback?: Omit<{ Optional
fetchOptional
label?: stringOptional
maxProtected
parseProtected
processProtected
processReplaces the media reference strings in an object with base64 data URIs for the media content.
This method recursively traverses an object (up to a maximum depth of 10) looking for media reference strings in the format "@@@langfuseMedia:...@@@". When found, it fetches the actual media content using the provided Langfuse client and replaces the reference string with a base64 data URI.
If fetching media content fails for a reference string, a warning is logged and the reference string is left unchanged.
Configuration object
A deep copy of the input object with all media references replaced with base64 data URIs where possible
const obj = {
image: "@@@langfuseMedia:type=image/jpeg|id=123|source=bytes@@@",
nested: {
pdf: "@@@langfuseMedia:type=application/pdf|id=456|source=bytes@@@"
}
};
const result = await LangfuseMedia.resolveMediaReferences({
obj,
langfuseClient
});
// Result:
// {
// image: "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
// nested: {
// pdf: "data:application/pdf;base64,JVBERi0xLjcK..."
// }
// }
Protected
scoreProtected
spanOptional
body: Omit<{ Protected
trace** Handlers for each object type *
Protected
truncateTruncates the event body if its byte size exceeds the specified maximum byte size. Emits a warning event if truncation occurs. The fields that may be truncated are: "input", "output", and "metadata". The fields are truncated in the order of their size, from largest to smallest until the total byte size is within the limit.
Protected
updateProtected
update
Description
Create a comment. Comments may be attached to different object types (trace, observation, session, prompt).
Tags
Comments
Name
CommentsCreate
Request
POST:/api/public/comments
Secure