gabejavitt commited on
Commit
94b6760
Β·
verified Β·
1 Parent(s): 48f10c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -15
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
- print("Initializing Google Gemini LLM...")
926
- try:
927
- self.llm_with_tools = ChatGoogleGenerativeAI(
928
- model="gemini-2.5-flash", # Latest model
929
- google_api_key=GOOGLE_API_KEY,
930
- temperature=0,
931
- max_output_tokens=8192,
932
- timeout=60,
933
- convert_system_message_to_human=True # Important for Gemini
934
- ).bind_tools(self.tools, tool_choice="auto")
935
- print("βœ… Gemini LLM initialized.")
936
- except Exception as e:
937
- print(f"❌ Error initializing Gemini: {e}")
938
- raise
 
 
 
 
 
 
 
 
 
 
 
 
 
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):