Spaces:
Sleeping
Sleeping
Download script/langsmith_smoketest.py from Clare-AI/test_AI_Agent: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/spaces/Clare-AI/test_AI_Agent/resolve/d42a9b94de47fe07dd862f94c40573beec5fa0bf/script/langsmith_smoketest.py
- Command line
-
hf download hf://spaces/Clare-AI/test_AI_Agent@d42a9b94de47fe07dd862f94c40573beec5fa0bf/script/langsmith_smoketest.py
-
curl -L -o langsmith_smoketest.py https://huggingface.co/spaces/Clare-AI/test_AI_Agent/resolve/d42a9b94de47fe07dd862f94c40573beec5fa0bf/script/langsmith_smoketest.py
806 Bytes
| # langsmith_smoketest.py | |
| import os | |
| from langsmith import traceable | |
| # 这个只是打印一下当前的 LangSmith 配置,方便 debug | |
| def print_langsmith_env(): | |
| keys = ["LANGSMITH_TRACING", "LANGSMITH_API_KEY", "LANGSMITH_PROJECT", "LANGSMITH_ENDPOINT"] | |
| print("=== LangSmith env check ===") | |
| for k in keys: | |
| v = os.getenv(k) | |
| print(f"{k} = {bool(v)} ({'set' if v else 'NOT set'})") | |
| print("===========================") | |
| def fake_chain(x: int, y: int) -> int: | |
| """ | |
| 一个假的小链:只做加法,但会被 LangSmith 记录。 | |
| """ | |
| z = x + y | |
| return z | |
| if __name__ == "__main__": | |
| print_langsmith_env() | |
| result = fake_chain(1, 2) | |
| print(f"Result of fake_chain(1, 2) = {result}") | |