The update event functions do not update output.
The only field it updates it end time I think. It would be nice if it could update the output after the execution.
@paris0120 This should be possible. Can you share an example of what you have tried?
public IngestionEvent updateGenerationEvent(LangfuseId id, Object output, ChatCompletionResponseUsage usage, ObservationLevel level) {
OffsetDateTime currentTime = OffsetDateTime.now();
String currentTimestamp = currentTime.toString();
OpenAiUsage openAiUsage = OpenAiUsage.builder()
.completionTokens(usage.getCompletion_tokens())
.promptTokens(usage.getPrompt_tokens())
.totalTokens(usage.getTotal_tokens())
.build();
IngestionUsage ingestionUsage = IngestionUsage.of(openAiUsage);
UpdateGenerationBody._FinalStage body = UpdateGenerationBody.builder()
.id(id.getEventId())
.traceId(id.getTraceId())
.parentObservationId(id.getParentEventId())
.output(output)
.endTime(currentTime)
.usage(ingestionUsage);
if (level != null) {
body.level(level);
}
UpdateGenerationEvent event = UpdateGenerationEvent
.builder()
.id(id.getEventId())
.timestamp(currentTimestamp)
.body(body.build())
.build();
return IngestionEvent.generationUpdate(event);
}
endtime is updated but not output
@paris0120 Are you using this with the langfuse cloud version? If yes, could you share the traceId you use? That would help me check the raw events that are received.
Alternatively, you could check in your S3/Minio bucket what is uploaded in /events/<projectId>/observation/<observationId>/<eventId>.json. There should be two files there one for the initial create and one for the update. Could you share both with redacted data in case it's sensitive?
No I have only one file there. It doesn't update the end time too.
Also why there is no way to update trace. It will be nice if we can update the output at least
@paris0120 Do you set different eventIds on the update? The id on the surrounding event must be different to avoid overwrites on the cloud storage.
Regarding the trace: You can just use the trace-create event multiple times and it will always perform upsert operations.
Hi Steffen, If don't use spring AI or langchain4j. Can langfuse monitor normal Springboot project. like I use simple api call to LLM. how the langfuse monitor this model. Do your have more example ? many thanks
@Namelesschz We don't have an example for java, but you could use the otel semantic conventions and add attributes on your traces to track LLM calls. You can find all attributes here: https://langfuse.com/docs/opentelemetry/get-started#property-mapping.
EDIT: Lets continue the example conversation in https://github.com/langfuse/langfuse-java/issues/8.