bstraehle commited on
Commit
d8cd338
·
verified ·
1 Parent(s): 3df3a3a

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +9 -5
crew.py CHANGED
@@ -37,14 +37,15 @@ def run_crew(question, file_path):
37
  # Custom tools
38
 
39
  @tool("Audio Analysis Tool")
40
- def audio_analysis_tool(file_path: str) -> str:
41
- """Transcribe audio file using OpenAI's Whisper model.
42
 
43
  Args:
44
- file_path (str): Path of the audio file to transcribe
 
45
 
46
  Returns:
47
- str: Transcribed text from the audio file
48
 
49
  Raises:
50
  FileNotFoundError: If audio file does not exist
@@ -54,10 +55,13 @@ def run_crew(question, file_path):
54
 
55
  try:
56
  client = OpenAI()
 
57
  transcript = client.audio.transcriptions.create(
58
  file=open(file_path, "rb"),
59
- model=STT_MODEL
 
60
  )
 
61
  return transcript.text
62
  except Exception as e:
63
  raise RuntimeError(f"Failed to transcribe audio: {str(e)}")
 
37
  # Custom tools
38
 
39
  @tool("Audio Analysis Tool")
40
+ def audio_analysis_tool(question: str, file_path: str) -> str:
41
+ """Transcribe the audio file and answer the question.
42
 
43
  Args:
44
+ question (str): Question about the audio file
45
+ file_path (str): Path of audio the file
46
 
47
  Returns:
48
+ str: Answer to the question about the audio file
49
 
50
  Raises:
51
  FileNotFoundError: If audio file does not exist
 
55
 
56
  try:
57
  client = OpenAI()
58
+
59
  transcript = client.audio.transcriptions.create(
60
  file=open(file_path, "rb"),
61
+ model=STT_MODEL,
62
+ prompt=question
63
  )
64
+
65
  return transcript.text
66
  except Exception as e:
67
  raise RuntimeError(f"Failed to transcribe audio: {str(e)}")