Skip to content

Langfuse-Not recording llamaindex response. Please help #14251

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

You must be logged in to vote

To ensure that RAGStringQueryEngine records traces in Langfuse, you need to explicitly connect it to the CallbackManager. Here is the updated code snippet:

import os

os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_HOST"] = "https://cloud.langfuse.com"
os.environ["OPENAI_API_KEY"] = "sk-..."

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

langfuse_callback_handler = LlamaIndexCallbackHandler()
Settings.callback_manager = CallbackManager([langfuse_callback_handler])

# Ensure the query engine uses the callback manager

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@mraguth
Comment options

@dosubot
Comment options

Comment options

You must be logged in to vote
3 replies
@dosubot
Comment options

Answer selected by mraguth
@mraguth
Comment options

@dosubot
Comment options

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