BoddyGus commited on
Commit
f443f9b
·
verified ·
1 Parent(s): 24921d4

Updating app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -36,17 +36,24 @@ class BasicAgent:
36
  "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. "
37
  "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."
38
  )
39
- # Initialize the DuckDuckGo search tool
40
- search_tool = DuckDuckGoSearchRun()
41
- tools = [search_tool]
42
-
43
- llm = HuggingFaceEndpoint(
44
- repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
45
- huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
46
  )
47
-
48
- chat = ChatHuggingFace(llm=llm, verbose=True)
49
- tools = [search_tool]
 
 
 
 
 
 
 
 
 
50
  chat_with_tools = chat.bind_tools(tools)
51
 
52
  class AgentState(TypedDict):
@@ -64,6 +71,7 @@ class BasicAgent:
64
  builder.add_conditional_edges("assistant", tools_condition)
65
  builder.add_edge("tools", "assistant")
66
  self.alfred = builder.compile()
 
67
 
68
  def __call__(self, question: str) -> str:
69
  messages = [
 
36
  "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. "
37
  "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."
38
  )
39
+ chat = ChatOpenAI(
40
+ model = 'gpt-4o-mini',
41
+ temperature = 0,
42
+ openai_api_key = OPENAI_KEY,
43
+ max_tokens = 4096
 
 
44
  )
45
+ search = GoogleSerperAPIWrapper()
46
+ wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
47
+ tools = [Tool(
48
+ name="Web_Search",
49
+ func=search.run,
50
+ description="useful for when you need to ask with search",
51
+ ),
52
+ Tool(
53
+ name="wikipedia_search",
54
+ func=wikipedia.run,
55
+ description="useful for when you need to ask with Wikipedia",
56
+ )]
57
  chat_with_tools = chat.bind_tools(tools)
58
 
59
  class AgentState(TypedDict):
 
71
  builder.add_conditional_edges("assistant", tools_condition)
72
  builder.add_edge("tools", "assistant")
73
  self.alfred = builder.compile()
74
+
75
 
76
  def __call__(self, question: str) -> str:
77
  messages = [