Skip to content

Intercept Langfuse traces before they are sent to LangFuse #12572

Closed Answered by dosubot bot
anirbanbasu asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @anirbanbasu! Great to see you diving into another adventure with LlamaIndex. How's the coding journey been treating you lately?

Sure, you can use the on_event_start and on_event_end methods to intercept the event recording process and add additional information to the traces. Here's how you can achieve this:

First, you need to create a custom callback handler by subclassing LlamaIndexCallbackHandler. In this custom handler, you can override the on_event_start and on_event_end methods to add your custom logic. Here's an example:

from llama_index.core.callbacks import CallbackManager
from langfuse.llama_index import LlamaIndexCallbackHandler

class CustomLangfuseCallbackHandler(LlamaI…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by anirbanbasu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant