Skip to content

Commit 8976eb9

Browse files
new: replace LANGFUSE env var by wdoc's LANGFUSE var twice instead of just at runtime, just in case
Signed-off-by: thiswillbeyourgithub <[email protected]>
1 parent 6df8cbf commit 8976eb9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

wdoc/utils/env.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,13 @@ def __getattribute__(self, name):
198198
# if not k.startswith("WDOC_"):
199199
# continue
200200
assert is_bearable(v, env.__dataclass_fields__[k].type), v
201+
202+
# If langfuse env variables are set AND WDOC_LANGFUSE_PUBLIC_KEY etc are set: we replace langfuse's env variable to make sure any underlyng lib use wdoc's instead
203+
for k in [
204+
"LANGFUSE_PUBLIC_KEY",
205+
"LANGFUSE_SECRET_KEY",
206+
"LANGFUSE_HOST",
207+
]:
208+
newk = "WDOC_" + k
209+
if newk in os.environ and os.environ[newk]:
210+
os.environ[k] = os.environ[newk]

wdoc/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ def thinking_answer_parser(output: str, strict: bool = False) -> dict:
971971
@optional_typecheck
972972
def create_langfuse_callback(version: str) -> None:
973973
assert not is_private
974-
# replace langfuse's env variable if set for wdoc
974+
# replace langfuse's env variable if set for wdoc, this is already done in env.py but doing it here also at runtime
975975
for k in [
976976
"LANGFUSE_PUBLIC_KEY",
977977
"LANGFUSE_SECRET_KEY",

0 commit comments

Comments
 (0)