Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1051,35 +1051,35 @@ REMEMBER: One tool per turn. No reasoning without tools. Exact answer format.
|
|
| 1051 |
"""
|
| 1052 |
|
| 1053 |
#. Initialize the LLM ()
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
-
|
| 1058 |
-
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
-
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
print("Initializing HuggingFace LLM...")
|
| 1070 |
-
|
| 1071 |
-
llm = HuggingFaceEndpoint(
|
| 1072 |
-
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", # Free on HF Inference API
|
| 1073 |
-
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
| 1074 |
-
|
| 1075 |
-
temperature=0.01,
|
| 1076 |
-
)
|
| 1077 |
-
chat_llm = ChatHuggingFace(llm=llm)
|
| 1078 |
-
print("β
HuggingFace LLM Endpoint initialized.")
|
| 1079 |
-
|
| 1080 |
-
# Bind tools to the LLM
|
| 1081 |
-
self.llm_with_tools = chat_llm.bind_tools(self.tools)
|
| 1082 |
-
print("β
Tools bound to LLM.")
|
| 1083 |
# print("Initializing Google Gemini LLM...")
|
| 1084 |
# try:
|
| 1085 |
# self.llm_with_tools = ChatGoogleGenerativeAI(
|
|
|
|
| 1051 |
"""
|
| 1052 |
|
| 1053 |
#. Initialize the LLM ()
|
| 1054 |
+
print("Initializing Groq LLM...")
|
| 1055 |
+
try:
|
| 1056 |
+
self.llm_with_tools = ChatGroq(
|
| 1057 |
+
temperature=0,
|
| 1058 |
+
groq_api_key=GROQ_API_KEY,
|
| 1059 |
+
model_name="llama-3.1-8b-instant",
|
| 1060 |
+
max_tokens=4096,
|
| 1061 |
+
timeout=60
|
| 1062 |
+
).bind_tools(self.tools, tool_choice="auto")
|
| 1063 |
+
print("β
LLM initialized without FORCED tool usage.")
|
| 1064 |
+
|
| 1065 |
+
except Exception as e:
|
| 1066 |
+
print(f"β Error initializing HuggingFace: {e}")
|
| 1067 |
+
raise
|
| 1068 |
+
print("Initializing LLM Endpoint...")
|
| 1069 |
+
# print("Initializing HuggingFace LLM...")
|
| 1070 |
+
#
|
| 1071 |
+
# llm = HuggingFaceEndpoint(
|
| 1072 |
+
# repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", # Free on HF Inference API
|
| 1073 |
+
# huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
| 1074 |
+
# max_new_tokens=4096,
|
| 1075 |
+
# temperature=0.01,
|
| 1076 |
+
# )
|
| 1077 |
+
# chat_llm = ChatHuggingFace(llm=llm)
|
| 1078 |
+
# print("β
HuggingFace LLM Endpoint initialized.")
|
| 1079 |
+
#
|
| 1080 |
+
# # Bind tools to the LLM
|
| 1081 |
+
# self.llm_with_tools = chat_llm.bind_tools(self.tools)
|
| 1082 |
+
# print("β
Tools bound to LLM.")
|
| 1083 |
# print("Initializing Google Gemini LLM...")
|
| 1084 |
# try:
|
| 1085 |
# self.llm_with_tools = ChatGoogleGenerativeAI(
|