Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -921,21 +921,34 @@ REMEMBER: One tool per turn. No reasoning without tools. Exact answer format.
|
|
| 921 |
# except Exception as e:
|
| 922 |
# print(f"β Error initializing HuggingFace: {e}")
|
| 923 |
# raise
|
| 924 |
-
#
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 939 |
|
| 940 |
# Agent Node with AGGRESSIVE tool forcing
|
| 941 |
def agent_node(state: AgentState):
|
|
|
|
| 921 |
# except Exception as e:
|
| 922 |
# print(f"β Error initializing HuggingFace: {e}")
|
| 923 |
# raise
|
| 924 |
+
# print("Initializing LLM Endpoint...")
|
| 925 |
+
llm = HuggingFaceEndpoint(
|
| 926 |
+
repo_id="Qwen/Qwen2.5-Coder-32B-Instruct", # Changed model
|
| 927 |
+
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
| 928 |
+
max_new_tokens=2048, # Increased token limit for potentially longer reasoning/tool use
|
| 929 |
+
temperature=0.01, # Keep temperature low for factual tasks
|
| 930 |
+
)
|
| 931 |
+
chat_llm = ChatHuggingFace(llm=llm)
|
| 932 |
+
print("β
LLM Endpoint initialized.")
|
| 933 |
+
|
| 934 |
+
# 6. Bind tools to the LLM
|
| 935 |
+
# Ensure the LLM knows how to format calls for the tools
|
| 936 |
+
self.llm_with_tools = chat_llm.bind_tools(self.tools)
|
| 937 |
+
print("β
Tools bound to LLM.")
|
| 938 |
+
# print("Initializing Google Gemini LLM...")
|
| 939 |
+
# try:
|
| 940 |
+
# self.llm_with_tools = ChatGoogleGenerativeAI(
|
| 941 |
+
# model="gemini-2.5-flash", # Latest model
|
| 942 |
+
# google_api_key=GOOGLE_API_KEY,
|
| 943 |
+
# temperature=0,
|
| 944 |
+
# max_output_tokens=8192,
|
| 945 |
+
# timeout=60,
|
| 946 |
+
# convert_system_message_to_human=True # Important for Gemini
|
| 947 |
+
# ).bind_tools(self.tools, tool_choice="auto")
|
| 948 |
+
# print("β
Gemini LLM initialized.")
|
| 949 |
+
# except Exception as e:
|
| 950 |
+
# print(f"β Error initializing Gemini: {e}")
|
| 951 |
+
# raise
|
| 952 |
|
| 953 |
# Agent Node with AGGRESSIVE tool forcing
|
| 954 |
def agent_node(state: AgentState):
|