Daemontatox
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,7 @@ from threading import Thread
|
|
23 |
from langchain.chains import LLMChain
|
24 |
from langchain_core.prompts import PromptTemplate
|
25 |
from langchain_huggingface import HuggingFaceEndpoint
|
|
|
26 |
|
27 |
# Configure logging
|
28 |
logging.basicConfig(level=logging.INFO)
|
@@ -58,7 +59,7 @@ load_dotenv()
|
|
58 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
59 |
C_apikey = os.getenv("C_apikey")
|
60 |
OPENAPI_KEY = os.getenv("OPENAPI_KEY")
|
61 |
-
|
62 |
if not HF_TOKEN:
|
63 |
logger.error("HF_TOKEN is not set in the environment variables.")
|
64 |
exit(1)
|
@@ -101,11 +102,11 @@ retriever = db.as_retriever(
|
|
101 |
search_kwargs={"k": 5}
|
102 |
)
|
103 |
|
104 |
-
llm = ChatCerebras(
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
)
|
109 |
|
110 |
# llm = ChatOpenAI(
|
111 |
# model="meta-llama/Llama-3.3-70B-Instruct",
|
@@ -119,6 +120,18 @@ llm = ChatCerebras(
|
|
119 |
|
120 |
# )
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
template = """
|
123 |
You are a specialized friendly AI assistant for the Mawared HR System, designed to provide accurate and contextually relevant support based solely on the provided context and chat history.
|
124 |
|
|
|
23 |
from langchain.chains import LLMChain
|
24 |
from langchain_core.prompts import PromptTemplate
|
25 |
from langchain_huggingface import HuggingFaceEndpoint
|
26 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
27 |
|
28 |
# Configure logging
|
29 |
logging.basicConfig(level=logging.INFO)
|
|
|
59 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
60 |
C_apikey = os.getenv("C_apikey")
|
61 |
OPENAPI_KEY = os.getenv("OPENAPI_KEY")
|
62 |
+
GEMINI = os.getenv("GEMINI")
|
63 |
if not HF_TOKEN:
|
64 |
logger.error("HF_TOKEN is not set in the environment variables.")
|
65 |
exit(1)
|
|
|
102 |
search_kwargs={"k": 5}
|
103 |
)
|
104 |
|
105 |
+
#llm = ChatCerebras(
|
106 |
+
# model="llama-3.3-70b",
|
107 |
+
# api_key=C_apikey,
|
108 |
+
# streaming=True
|
109 |
+
#)
|
110 |
|
111 |
# llm = ChatOpenAI(
|
112 |
# model="meta-llama/Llama-3.3-70B-Instruct",
|
|
|
120 |
|
121 |
# )
|
122 |
|
123 |
+
|
124 |
+
llm = ChatGoogleGenerativeAI(
|
125 |
+
model="gemini-2.0-flash-thinking-exp-01-21",
|
126 |
+
temperature=0,
|
127 |
+
max_tokens=None,
|
128 |
+
timeout=None,
|
129 |
+
max_retries=2,
|
130 |
+
api_key=GEMINI,
|
131 |
+
stream=True,
|
132 |
+
|
133 |
+
)
|
134 |
+
|
135 |
template = """
|
136 |
You are a specialized friendly AI assistant for the Mawared HR System, designed to provide accurate and contextually relevant support based solely on the provided context and chat history.
|
137 |
|