Protected
_eventsProtected
Optional
_flushProtected
_retryProtected
isProtected
_fetchProtected
_getProtected
_getProtected
_parseProtected
awaitCan 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
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
Creates a dataset. Upserts the dataset if it already exists.