Nested generations / spans in traces
Hi everyone!
I'm trying to use the trace and observation IDs to create a nested set of observations instead of using the objects in the Python SDK. I was able to use
langfuse.generation(CreateGeneration(traceId=trace.id))
instead of trace.generation(CreateGeneration())
to create a generation inside a trace but I'm having trouble creating observations under another observation. I tried the following which didn't work. I was expecting the following code to create, a span inside that trace, and a generation inside the span. But instead it creates a span and a generation inside the trace. Would appreciate some guidance on this.
2 Replies
Hi Sara, great to have you here! Our pydantic interfaces are a bit confisung. You have to take
InitialGeneration
instead of CreateGeneration
. We are working on this as we remove pydantic interfaces from the SDK (https://github.com/langfuse/langfuse-python/pull/215)Oh I see! Thanks for the help Max! I'll give that a try