fix: don't init langwatch if not configure (#6749)
* fix: don't init langwatch if not configure; * feat: return langfuse callback for tracing * fix: move condition to setup_langwatch * fix: typo --------- Co-authored-by: tianzhipeng-jk <tianzhipeng-jk@360shuke.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
feff8b681e
commit
4ef4c93bac
2 changed files with 5 additions and 2 deletions
|
|
@ -133,7 +133,7 @@ class LangFuseTracer(BaseTracer):
|
||||||
def get_langchain_callback(self) -> BaseCallbackHandler | None:
|
def get_langchain_callback(self) -> BaseCallbackHandler | None:
|
||||||
if not self._ready:
|
if not self._ready:
|
||||||
return None
|
return None
|
||||||
return None # self._callback
|
return self._callback
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_config() -> dict:
|
def _get_config() -> dict:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
from typing import TYPE_CHECKING, Any, cast
|
from typing import TYPE_CHECKING, Any, cast
|
||||||
|
|
||||||
import nanoid
|
import nanoid
|
||||||
|
|
@ -31,7 +32,7 @@ class LangWatchTracer(BaseTracer):
|
||||||
self.flow_id = trace_name.split(" - ")[-1]
|
self.flow_id = trace_name.split(" - ")[-1]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._ready = self.setup_langwatch()
|
self._ready: bool = self.setup_langwatch()
|
||||||
if not self._ready:
|
if not self._ready:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -58,6 +59,8 @@ class LangWatchTracer(BaseTracer):
|
||||||
return self._ready
|
return self._ready
|
||||||
|
|
||||||
def setup_langwatch(self) -> bool:
|
def setup_langwatch(self) -> bool:
|
||||||
|
if "LANGWATCH_API_KEY" not in os.environ:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
import langwatch
|
import langwatch
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue