File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,20 @@ def is_ci() -> bool:
3030 return "CI" in os .environ
3131
3232
33+ @lru_cache
34+ def is_langchain () -> bool :
35+ """Return True if running in a Langchain environment.
36+
37+ This checks for the presence of the 'langchain-airbyte' package.
38+
39+ TODO: A more robust check would inspect the call stack or another flag to see if we are actually
40+ being invoked via LangChain, vs being installed side-by-side.
41+
42+ This is cached for performance reasons.
43+ """
44+ return "langchain_airbyte" in sys .modules
45+
46+
3347@lru_cache
3448def is_colab () -> bool :
3549 return bool (get_colab_release_version ())
Original file line number Diff line number Diff line change @@ -104,8 +104,9 @@ def _setup_analytics() -> str | bool:
104104 if not _ANALYTICS_FILE .exists ():
105105 # This is a one-time message to inform the user that we are tracking anonymous usage stats.
106106 print (
107- "Anonymous usage reporting is enabled. For more information or to opt out, please"
108- " see https://docs.airbyte.io/pyairbyte/anonymized-usage-statistics"
107+ "Thank you for using PyAirbyte!\n "
108+ "Anonymous usage reporting is currently enabled. For more information, please"
109+ " see https://docs.airbyte.com/telemetry"
109110 )
110111
111112 if _ANALYTICS_FILE .exists ():
@@ -227,6 +228,7 @@ def one_way_hash(
227228def get_env_flags () -> dict [str , Any ]:
228229 flags : dict [str , bool | str ] = {
229230 "CI" : meta .is_ci (),
231+ "LANGCHAIN" : meta .is_langchain (),
230232 "NOTEBOOK_RUNTIME" : (
231233 "GOOGLE_COLAB"
232234 if meta .is_colab ()
You can’t perform that action at this time.
0 commit comments