mirror of
https://github.com/open-webui/pipelines
synced 2025-06-25 09:36:35 +00:00
Merge pull request #128 from Meeeee6623/catch-langfuse-auth-error
Fix: Add proper exception handling to langfuse filter pipeline
This commit is contained in:
commit
3a48d80123
@ -15,6 +15,7 @@ import os
|
|||||||
from utils.pipelines.main import get_last_user_message, get_last_assistant_message
|
from utils.pipelines.main import get_last_user_message, get_last_assistant_message
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from langfuse import Langfuse
|
from langfuse import Langfuse
|
||||||
|
from langfuse.api.resources.commons.errors.unauthorized_error import UnauthorizedError
|
||||||
|
|
||||||
|
|
||||||
class Pipeline:
|
class Pipeline:
|
||||||
@ -79,13 +80,20 @@ class Pipeline:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def set_langfuse(self):
|
def set_langfuse(self):
|
||||||
self.langfuse = Langfuse(
|
try:
|
||||||
secret_key=self.valves.secret_key,
|
self.langfuse = Langfuse(
|
||||||
public_key=self.valves.public_key,
|
secret_key=self.valves.secret_key,
|
||||||
host=self.valves.host,
|
public_key=self.valves.public_key,
|
||||||
debug=False,
|
host=self.valves.host,
|
||||||
)
|
debug=False,
|
||||||
self.langfuse.auth_check()
|
)
|
||||||
|
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:
|
async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
|
||||||
print(f"inlet:{__name__}")
|
print(f"inlet:{__name__}")
|
||||||
|
Loading…
Reference in New Issue
Block a user