Skip to content

Commit 493f0f1

Browse files
added new code
1 parent d92e65c commit 493f0f1

File tree

9 files changed

+474
-138
lines changed

9 files changed

+474
-138
lines changed

AD-HOC/test.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
1-
def func(a):
2-
return 3
3-
print(func(5))
1+
from dotenv import load_dotenv
2+
import os
3+
import time
4+
from langchain_google_genai import ChatGoogleGenerativeAI
45

6+
load_dotenv() # This loads variables from .env file
7+
GOOGLE_API_KEY = 'AIzaSyBFEkKZB6tm_ojt5H6XNobOyDugMlFm9bw'
58

6-
print(func(1))
9+
# Debug: Check if the key is loaded
10+
print(f"GOOGLE_API_KEY loaded: {GOOGLE_API_KEY is not None}")
11+
print(f"GOOGLE_API_KEY value: {GOOGLE_API_KEY[:10] if GOOGLE_API_KEY else 'None'}...")
12+
13+
if GOOGLE_API_KEY:
14+
google_genai = ChatGoogleGenerativeAI(model="gemini-2.5-flash-lite",api_key=GOOGLE_API_KEY)
15+
print("ChatGoogleGenerativeAI initialized successfully!")
16+
17+
# Ask a question using the model
18+
print("\n" + "="*50)
19+
print("ASKING A QUESTION TO GEMINI")
20+
print("="*50)
21+
22+
question = "What are the symptoms of jaundice in newborns? answer in around 100-150 words"
23+
print(f"Question: {question}")
24+
print("\nAnswer:")
25+
26+
try:
27+
a=time.time()
28+
response = google_genai.invoke(question)
29+
b=time.time()
30+
print(f"Time taken: {b-a} seconds")
31+
print(response.content)
32+
except Exception as e:
33+
print(f"Error asking question: {e}")
34+
35+
else:
36+
print("ERROR: GOOGLE_API_KEY not found in environment variables!")
37+
print("Make sure you have GOOGLE_API_KEY=your_key_here in your .env file")
Binary file not shown.

FASTAPI-DEPLOYMENT/rhl_fastapi_v2_modify.py

Lines changed: 432 additions & 133 deletions
Large diffs are not rendered by default.

chat_history.db

280 KB
Binary file not shown.

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
fastapi
22
uvicorn[standard]
33
langchain
4+
langchain-core
45
langchain-openai
56
langchain-pinecone
67
langchain-huggingface
@@ -11,4 +12,5 @@ fitz
1112
frontend
1213
unstructured
1314
pdfminer
14-
aiosqlite
15+
aiosqlite
16+
langchain-google-genai

test_chitchat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test_gemini_chitchat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test_gemini_judge.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test_hybrid_timing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)