File size: 452 Bytes
4416e3b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import os
from dotenv import load_dotenv
from langchain_google_genai import ChatGoogleGenerativeAI
load_dotenv(override=True)
api_key = os.getenv("GOOGLE_API_KEY")
print(f"Testing LangChain with Key: {api_key}")
try:
llm = ChatGoogleGenerativeAI(model="gemini-flash-latest", google_api_key=api_key)
res = llm.invoke("Hello")
print("LangChain Success:", res.content)
except Exception as e:
print("LangChain ERROR:", e)
|