Sdm0 commited on
Commit
1ef6be4
·
verified ·
1 Parent(s): f9b55bf

app.py: use LANGSMITH_API_KEY first, fall back to LANGCHAIN_API_KEY

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -69,10 +69,14 @@ RECOMMENDATION_ICONS = {
69
 
70
  def _init_observability_ui() -> None:
71
  """Initialise observability backends from env vars for the Gradio UI."""
72
- # LangSmith: enable if key is in environment
73
- ls_key = os.environ.get("LANGCHAIN_API_KEY", "").strip()
 
 
 
74
  if ls_key and not is_langsmith_enabled():
75
- project = os.environ.get("LANGCHAIN_PROJECT", "opencodereview")
 
76
  enable_langsmith(ls_key, project)
77
  if is_langsmith_enabled():
78
  logger.info("Observability: LangSmith enabled for Gradio UI")
 
69
 
70
  def _init_observability_ui() -> None:
71
  """Initialise observability backends from env vars for the Gradio UI."""
72
+ # LangSmith: enable if key is in environment (check both modern and legacy names)
73
+ ls_key = (
74
+ os.environ.get("LANGSMITH_API_KEY", "").strip()
75
+ or os.environ.get("LANGCHAIN_API_KEY", "").strip()
76
+ )
77
  if ls_key and not is_langsmith_enabled():
78
+ project = os.environ.get("LANGSMITH_PROJECT",
79
+ os.environ.get("LANGCHAIN_PROJECT", "opencodereview"))
80
  enable_langsmith(ls_key, project)
81
  if is_langsmith_enabled():
82
  logger.info("Observability: LangSmith enabled for Gradio UI")