File size: 392 Bytes
c1cba9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()