RalphThings commited on
Commit
1b89956
·
verified ·
1 Parent(s): f8e0991

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,7 +7,7 @@ from langchain_core.output_parsers import JsonOutputParser
7
  from langchain.agents import AgentExecutor, create_react_agent, initialize_agent, AgentType
8
  from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
9
  import traceback # For detailed error logging
10
- import timeout_decorator # Optional: for execute_code timeout (pip install timeout-decorator)
11
  import whisper
12
  import chess, chess.engine
13
  from bs4 import BeautifulSoup
@@ -264,7 +264,7 @@ def classify_vegetables(items: list) -> str:
264
 
265
  @tool
266
  # Optional: Add timeout to prevent runaway code execution
267
- @timeout_decorator.timeout(10, timeout_exception=TimeoutError) # Limit execution to 10 seconds
268
  def execute_code(code: str) -> str:
269
  """
270
  Executes a given Python code snippet and returns the value of the 'output' variable.
@@ -434,7 +434,7 @@ TOOLS = [
434
  classify_vegetables,
435
  execute_code,
436
  least_athletes_olympics,
437
- get_nasa_award_number,
438
  ]
439
 
440
  SYSTEM_MESSAGE = """You are a concise AI assistant with access to the following tools:
 
7
  from langchain.agents import AgentExecutor, create_react_agent, initialize_agent, AgentType
8
  from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
9
  import traceback # For detailed error logging
10
+ #import timeout_decorator # Optional: for execute_code timeout (pip install timeout-decorator)
11
  import whisper
12
  import chess, chess.engine
13
  from bs4 import BeautifulSoup
 
264
 
265
  @tool
266
  # Optional: Add timeout to prevent runaway code execution
267
+ #@timeout_decorator.timeout(10, timeout_exception=TimeoutError) # Limit execution to 10 seconds
268
  def execute_code(code: str) -> str:
269
  """
270
  Executes a given Python code snippet and returns the value of the 'output' variable.
 
434
  classify_vegetables,
435
  execute_code,
436
  least_athletes_olympics,
437
+ get_nasa_award_number
438
  ]
439
 
440
  SYSTEM_MESSAGE = """You are a concise AI assistant with access to the following tools: