Spaces:
Sleeping
Sleeping
Download test_env.py from SAFE44/humanbrowser: direct link, hf CLI and curl.
- Browser
- Download file 392 Bytes
-
https://huggingface.co/spaces/SAFE44/humanbrowser/resolve/main/test_env.py
- Command line
-
hf download hf://spaces/SAFE44/humanbrowser/test_env.py
-
curl -L -o test_env.py https://huggingface.co/spaces/SAFE44/humanbrowser/resolve/main/test_env.py
392 Bytes
| import os | |
| from langchain_groq import ChatGroq | |
| def test_api(): | |
| try: | |
| llm = ChatGroq(groq_api_key=os.getenv("GROQ_API_KEY")) | |
| res = llm.invoke("Hello, are you active?") | |
| print("✅ API Connection: Success") | |
| return True | |
| except Exception as e: | |
| print(f"❌ API Connection: Failed - {e}") | |
| return False | |
| if __name__ == "__main__": | |
| test_api() |