MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / getLangSmithEnvConfig

Function getLangSmithEnvConfig

packages/components/src/tracingEnv.ts:57–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 * next to the manually-emitted parent/child RunTree.
56 */
57export const getLangSmithEnvConfig = (): { apiKey: string; endpoint?: string; projectName?: string } | undefined => {
58 const tracingFlag = getEnvironmentVariable('LANGSMITH_TRACING') ?? getEnvironmentVariable('LANGCHAIN_TRACING_V2')
59 if (tracingFlag !== 'true') return undefined
60
61 const apiKey = getEnvironmentVariable('LANGSMITH_API_KEY') ?? getEnvironmentVariable('LANGCHAIN_API_KEY')
62 if (!apiKey) return undefined
63
64 const endpoint = getEnvironmentVariable('LANGSMITH_ENDPOINT') ?? getEnvironmentVariable('LANGCHAIN_ENDPOINT')
65 const projectName = getEnvironmentVariable('LANGSMITH_PROJECT') ?? getEnvironmentVariable('LANGCHAIN_PROJECT')
66
67 // the four LangChain tracing-flag env vars are deleted from `process.env`. Flowise owns tracing
68 // emission from this point on; leaving the flags set would letLangChain's auto-tracer fire on
69 // every `.invoke()`/`.call()` and produce orphan top-level runs next to the manually-emitted
70 // parent/child RunTree.
71 for (const k of LANGCHAIN_TRACING_FLAG_VARS) delete process.env[k]
72
73 return { apiKey, endpoint, projectName }
74}
75
76export const TRACING_ENV_PROVIDERS: TracingEnvProvider[] = [
77 {

Callers 1

tracingEnv.test.tsFile · 0.90

Calls 1

getEnvironmentVariableFunction · 0.90

Tested by

no test coverage detected