Replies: 2 comments
-
|
Based on the available sources, there are known context propagation issues with the Issue with NestingThe LangChain Recommended ApproachThe recommended way to ensure correct span context and nesting is to use the Here's how you could restructure your code: from langfuse import observe
@observe()
def call_moderation_model(streaming_response):
# This will automatically create a span and set it as current
ChatBedrockConverse(streaming_response)Alternative: Explicit Context PassingIf you need to work within the current structure, you can explicitly pass from langfuse import get_client
langfuse = get_client()
def call_moderation_model(streaming_response):
with langfuse.start_as_current_span(name="critic.orchestrator.evaluate") as span:
# Initialize handler within the span context
langfuse_handler = CallbackHandler()
# Your LangChain call will now be nested under this span
ChatBedrockConverse(
streaming_response,
callbacks=[langfuse_handler]
)Known LimitationsThe current For customizing span names, the sources don't provide a direct method when using the 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
i added @observe to the
|
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Describe your question
Hello
I have a use case where I have a streaming LLM call. On some X amount of chunks I run it through a LLM Moderation call such that it looks like the the following
This is a state in langgraph and I use the callback handler to automatically observe it. The issue is that the traces now look like this.
I have 3 moderation models running creating 3 bedrock spans. Is there a way I can customize it in such a way I can customize the name of the bedrock span?
The bedrock calls appear outside of the
critic.orchestrator.evaluateeven though they were executed within the span. How do i make it so its a sub span of thecritic.orchestrator.evaluatecall.Langfuse Cloud or Self-Hosted?
Self-Hosted
If Self-Hosted
3.131
If Langfuse Cloud
No response
SDK and integration versions
No response
Pre-Submission Checklist
Beta Was this translation helpful? Give feedback.
All reactions