fix(presidio_pii_masking.py): fix presidio unset url check + add same check for langfuse

This commit is contained in:
Krrish Dholakia 2024-07-06 17:50:55 -07:00
parent d57d3df1d6
commit 1193ee8803
4 changed files with 84 additions and 69 deletions

View file

@ -32,6 +32,12 @@ class LangFuseLogger:
self.langfuse_host = langfuse_host or os.getenv(
"LANGFUSE_HOST", "https://cloud.langfuse.com"
)
if not (
self.langfuse_host.startswith("http://")
or self.langfuse_host.startswith("https://")
):
# add http:// if unset, assume communicating over private network - e.g. render
self.langfuse_host = "http://" + self.langfuse_host
self.langfuse_release = os.getenv("LANGFUSE_RELEASE")
self.langfuse_debug = os.getenv("LANGFUSE_DEBUG")