MariaFilipkowska commited on
Commit
a66300b
·
verified ·
1 Parent(s): d1baeea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -29,7 +29,7 @@ print("Loading LLM...")
29
  chat = ChatMistralAI(
30
  model="mistral-medium-2505",
31
  temperature=0.1,
32
- max_retries=3,
33
  mistral_api_key = os.getenv("Mistral")
34
  )
35
  print(f"Model {chat.model} downloaded!")
@@ -90,8 +90,12 @@ def extract_text_from_image(img_path: str) -> str:
90
  return ""
91
 
92
  def play_chess():
93
- return chess.Board()
 
94
 
 
 
 
95
  # Initialize the tool
96
  get_file_path_tool = Tool(
97
  name="file_path_retriever",
@@ -123,7 +127,13 @@ play_chess_tool = Tool(
123
  description="Sets a chess board."
124
  )
125
 
126
- tools = [get_file_path_tool, get_content_tool, extract_text_tool, search_web_tool, play_chess_tool]
 
 
 
 
 
 
127
  chat_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
128
 
129
 
 
29
  chat = ChatMistralAI(
30
  model="mistral-medium-2505",
31
  temperature=0.1,
32
+ max_retries=5,
33
  mistral_api_key = os.getenv("Mistral")
34
  )
35
  print(f"Model {chat.model} downloaded!")
 
90
  return ""
91
 
92
  def play_chess():
93
+ board = chess.Board()
94
+ return board
95
 
96
+ def run_code(code: str):
97
+ return exec(code)
98
+
99
  # Initialize the tool
100
  get_file_path_tool = Tool(
101
  name="file_path_retriever",
 
127
  description="Sets a chess board."
128
  )
129
 
130
+ run_code_tool = Tool(
131
+ name="run_code_retriever",
132
+ func=run_code,
133
+ description="Executes a python code."
134
+ )
135
+
136
+ tools = [get_file_path_tool, get_content_tool, extract_text_tool, search_web_tool, play_chess_tool, run_code_tool]
137
  chat_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
138
 
139