mirror of
https://github.com/open-webui/pipelines
synced 2025-06-25 09:36:35 +00:00
Add proper exception handling to langfuse filter pipeline
This commit is contained in:
parent
1b3bfe902a
commit
5e73b279d5
@ -15,6 +15,7 @@ import os
|
||||
from utils.pipelines.main import get_last_user_message, get_last_assistant_message
|
||||
from pydantic import BaseModel
|
||||
from langfuse import Langfuse
|
||||
from langfuse.api.resources.commons.errors.unauthorized_error import UnauthorizedError
|
||||
|
||||
|
||||
class Pipeline:
|
||||
@ -79,6 +80,7 @@ class Pipeline:
|
||||
pass
|
||||
|
||||
def set_langfuse(self):
|
||||
try:
|
||||
self.langfuse = Langfuse(
|
||||
secret_key=self.valves.secret_key,
|
||||
public_key=self.valves.public_key,
|
||||
@ -86,6 +88,12 @@ class Pipeline:
|
||||
debug=False,
|
||||
)
|
||||
self.langfuse.auth_check()
|
||||
except UnauthorizedError:
|
||||
print(
|
||||
"Langfuse credentials incorrect. Please re-enter your Langfuse credentials in the pipeline settings."
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Langfuse error: {e} Please re-enter your Langfuse credentials in the pipeline settings.")
|
||||
|
||||
async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
|
||||
print(f"inlet:{__name__}")
|
||||
|
Loading…
Reference in New Issue
Block a user