Hi guys, I’m tearing my hair out here.
I’m running this code in Colab notebook cell and it throws the error you can see in the comment. I tried contacting the endpoint with curl and it responds, so clearly the problem is with tracing not being activated.
Any ideas?
os.environ["LANGCHAIN_API_KEY"] = "..."
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
os.environ["LANGCHAIN_TRACING"] = "true"
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "default"
from langsmith import traceable
from langsmith.run_helpers import get_current_run_tree
@traceable
def test_fn(x):
run = get_current_run_tree()
print("Run ID inside function:", run.id)
return x * 2
test_fn(21) # AttributeError: 'NoneType' object has no attribute 'id'