Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
load_dotenv()
|
| 6 |
+
google_api_key = os.getenv("GEMINI_API_KEY")
|
| 7 |
+
model ="gemini-2.5-flash-lite"
|
| 8 |
+
|
| 9 |
+
def run_hello_langchain():
|
| 10 |
+
"""
|
| 11 |
+
Instantiates a ChatGoogleGenerativeAI model.
|
| 12 |
+
Invokes it with a simple prompt.
|
| 13 |
+
Prints the model's response.
|
| 14 |
+
"""
|
| 15 |
+
llm = ChatGoogleGenerativeAI(model=model, google_api_key=google_api_key)
|
| 16 |
+
response = llm.invoke("explain RLHF in 2 lines!")
|
| 17 |
+
print(response.content)
|
| 18 |
+
|
| 19 |
+
run_hello_langchain()
|
| 20 |
+
|