JabrilJacobs commited on
Commit
482af65
·
verified ·
1 Parent(s): 1e61012

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -43
app.py CHANGED
@@ -33,48 +33,6 @@ class BasicAgent:
33
  class NewAgent:
34
  def __init__(self):
35
  print("NewAgent initialized.")
36
- # # Initialize the web search tool
37
- # search_tool = DuckDuckGoSearchRun()
38
- # # Initialize the Hub stats tool
39
- # hub_stats_tool = Tool(
40
- # name="get_hub_stats",
41
- # func=get_hub_stats,
42
- # description="Fetches the most downloaded model from a specific author on the Hugging Face Hub."
43
- # )
44
- # # Generate the chat interface, including the tools
45
- # tools = [
46
- # search_tool,
47
- # # weather_info_tool,
48
- # hub_stats_tool,
49
- # ]
50
- # llm = ChatOpenAI(model="gpt-4o")
51
- # llm_with_tools = llm.bind_tools(tools, parallel_tool_calls=False)
52
-
53
- # # Generate the AgentState and Agent graph
54
- # class AgentState(TypedDict):
55
- # messages: Annotated[list[AnyMessage], add_messages]
56
- # def assistant(state: AgentState):
57
- # sys_msg = SystemMessage(content=f"You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.")
58
- # return {
59
- # "messages": [llm_with_tools.invoke([sys_msg] + state["messages"])],
60
- # }
61
-
62
- # ## The graph
63
- # builder = StateGraph(AgentState)
64
- # # Define nodes: these do the work
65
- # builder.add_node("assistant", assistant)
66
- # builder.add_node("tools", ToolNode(tools))
67
- # # Define edges: these determine how the control flow moves
68
- # builder.add_edge(START, "assistant")
69
- # builder.add_conditional_edges(
70
- # "assistant",
71
- # # If the latest message requires a tool, route to tools
72
- # # Otherwise, provide a direct response
73
- # tools_condition,
74
- # )
75
- # builder.add_edge("tools", "assistant")
76
- # alfred = builder.compile()
77
-
78
  def __call__(self, question: str) -> str:
79
  print(f"Agent received question (first 50 chars): {question[:50]}...")
80
 
@@ -92,7 +50,8 @@ class NewAgent:
92
  # weather_info_tool,
93
  hub_stats_tool,
94
  ]
95
- llm = ChatOpenAI(model="gpt-4o")
 
96
  llm_with_tools = llm.bind_tools(tools, parallel_tool_calls=False)
97
 
98
  # Generate the AgentState and Agent graph
 
33
  class NewAgent:
34
  def __init__(self):
35
  print("NewAgent initialized.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  def __call__(self, question: str) -> str:
37
  print(f"Agent received question (first 50 chars): {question[:50]}...")
38
 
 
50
  # weather_info_tool,
51
  hub_stats_tool,
52
  ]
53
+ # llm = ChatOpenAI(model="gpt-4o")
54
+ llm = ChatOpenAI(model="gpt-4.1")
55
  llm_with_tools = llm.bind_tools(tools, parallel_tool_calls=False)
56
 
57
  # Generate the AgentState and Agent graph