Skip to content

Commit

Permalink
Merge pull request #148 from wri/reactivate-langfuse
Browse files Browse the repository at this point in the history
Reactivate langfuse handler
  • Loading branch information
yellowcap authored Feb 28, 2025
2 parents 8582c04 + 332595c commit ef949e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from fastapi.responses import Response, StreamingResponse
from langchain_core.messages import HumanMessage
from langgraph.types import Command
from langfuse.callback import CallbackHandler

from zeno.agents.distalert.graph import graph as dist_alert
from zeno.agents.kba.graph import graph as kba
Expand All @@ -20,7 +21,10 @@


app = FastAPI()
# # langfuse_handler = CallbackHandler()

callbacks = []
if "LANGFUSE_PUBLIC_KEY" in os.environ:
callbacks.append(CallbackHandler())

app.add_middleware(
CORSMiddleware,
Expand All @@ -45,7 +49,7 @@ def event_stream_alerts(
thread_id = str(uuid.uuid4())

config = {
# "callbacks": [langfuse_handler],
"callbacks": callbacks,
"configurable": {"thread_id": thread_id},
}

Expand Down

0 comments on commit ef949e2

Please sign in to comment.