amazon_product / test_langchain_key.py
d-e-e-k-11's picture
Upload folder using huggingface_hub
4416e3b verified
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)