Langfuse icon

Langfuse

Log LLM traces, spans, generations, and scores to Langfuse, or query traces, prompts, datasets, sessions, and more via the Public API.

Ingestion → Generation Update

AI-generated

Summary

Update an existing Langfuse generation observation with optional details such as timing, model information, prompt metadata, token usage, and cost information. Requires an existing observation ID and optionally accepts a trace ID to associate the update within a trace.

Inputs

  • observationId (required) — The ID of the existing generation observation to update.
  • traceId — Trace ID to associate the update with a specific trace. If not provided, it attempts to auto-fill from the previous step's traceId output.
  • endTime — ISO 8601 end time timestamp for the generation update to mark completion time.
  • name — Human-readable name for the generation.
  • inputJson — JSON string representing the input payload of the generation.
  • outputJson — JSON string representing the output payload of the generation.
  • metadataJson — Additional JSON metadata to associate with the generation.
  • version — Optional version string stored on the generation.
  • level — Optional log or observation level.
  • statusMessage — Optional status message providing additional information about the generation update.
  • model — The model name used for the generation.
  • modelParametersJson — JSON string with model parameters used during the generation.
  • promptName — Name of the prompt linked to the generation.
  • promptVersion — Optional version string of the prompt linked to the generation.
  • promptLabelsJson — JSON array of prompt labels to associate as metadata for the generation.
  • promptTokens — Input token count used for the generation.
  • completionTokens — Output token count produced by the generation.
  • totalTokens — Total token count (input plus output) used for the generation.
  • usageDetailsJson — JSON object providing a detailed breakdown of token usage, overrides the individual token count fields.
  • costDetailsJson — JSON object providing a detailed cost breakdown by input, output, and total for the generation.
  • completionStartTime — Optional ISO 8601 timestamp indicating when the generation completion started.
  • eventId — Optional event ID for idempotency and deduplication.
  • parentObservationId — Optional parent observation ID for nesting within spans or larger observations.
  • timestamp — Optional ISO 8601 timestamp for the observation event; if blank, the current time is used.
  • failOnBatchErrors — Boolean to indicate whether the node should fail if Langfuse returns partial ingestion errors.

Output shape

a single record

The output includes the updated observation's data, including any generated or retained traceId and observationId, reflecting what was sent to Langfuse. Partial ingestion errors can be surfaced if 'failOnBatchErrors' is true, otherwise partial failures appear alongside successes.

Links

Discussion