RalphThings commited on
Commit
3d6f977
·
verified ·
1 Parent(s): b3975f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -57,7 +57,7 @@ def analyze_sales_data(file_path: str) -> str:
57
  return f"Error processing sales data from {file_path}: {e}"
58
 
59
  @tool
60
- def find_chess_mate_move(fen: str, engine_path: str = "/usr/bin/stockfish") -> str:
61
  """
62
  Given a FEN string representing a chess position (Black to move),
63
  finds the best move that guarantees a win using Stockfish engine.
@@ -65,7 +65,7 @@ def find_chess_mate_move(fen: str, engine_path: str = "/usr/bin/stockfish") -> s
65
  Returns the move in algebraic notation (e.g., 'Qh4').
66
  """
67
  try:
68
- engine = chess.engine.SimpleEngine.popen_uci(engine_path)
69
  board = chess.Board(fen)
70
  if board.turn != chess.BLACK:
71
  return "Error: It's not Black's turn in the provided FEN."
@@ -452,7 +452,7 @@ SYSTEM_MESSAGE = """You are a concise AI assistant with access to the following
452
  - read_file(file_path: string) -> string
453
  - transcribe_audio(file_path: string) -> string
454
  - analyze_sales_data(file_path: string) -> string
455
- - find_chess_mate_move(fen: string, engine_path: string = "/usr/bin/stockfish") -> string
456
  When you need to use a tool, respond exactly with:
457
  Action: <tool_name>(<arg_name>=<value>, ...)
458
  Then wait for the tool’s output before continuing.
 
57
  return f"Error processing sales data from {file_path}: {e}"
58
 
59
  @tool
60
+ def find_chess_mate_move(fen: str) -> str:
61
  """
62
  Given a FEN string representing a chess position (Black to move),
63
  finds the best move that guarantees a win using Stockfish engine.
 
65
  Returns the move in algebraic notation (e.g., 'Qh4').
66
  """
67
  try:
68
+ engine = chess.engine.SimpleEngine.popen_uci("/usr/bin/stockfish")
69
  board = chess.Board(fen)
70
  if board.turn != chess.BLACK:
71
  return "Error: It's not Black's turn in the provided FEN."
 
452
  - read_file(file_path: string) -> string
453
  - transcribe_audio(file_path: string) -> string
454
  - analyze_sales_data(file_path: string) -> string
455
+ - find_chess_mate_move(fen: string) -> string
456
  When you need to use a tool, respond exactly with:
457
  Action: <tool_name>(<arg_name>=<value>, ...)
458
  Then wait for the tool’s output before continuing.