bstraehle commited on
Commit
99e34f8
·
verified ·
1 Parent(s): adf9d94

Delete tools.py

Browse files
Files changed (1) hide show
  1. tools.py +0 -38
tools.py DELETED
@@ -1,38 +0,0 @@
1
- from crewai_tools import BaseTool
2
-
3
- STT_MODEL = "whisper-1"
4
-
5
- class AudioAnalysisTool(BaseTool):
6
- name: str ="Audio Analysis Tool"
7
- description: str = ("""
8
- Transcribe audio file using OpenAI's Whisper model.
9
-
10
- Args:
11
- question (str): Question to answer
12
- file_path (str): Path of the audio file to transcribe
13
-
14
- Returns:
15
- str: Transcribed text from the audio file
16
-
17
- Raises:
18
- FileNotFoundError: If audio file does not exist
19
- RuntimeError: If transcription fails
20
- """)
21
-
22
- def _run(question: str, file_path: str) -> str:
23
- if not os.path.exists(file_path):
24
- raise FileNotFoundError(f"Audio file not found: {file_path}")
25
-
26
- try:
27
- client = OpenAI()
28
- transcript = client.audio.transcriptions.create(
29
- file=open(file_path, "rb"),
30
- model=STT_MODEL,
31
- prompt=question,
32
- )
33
- return transcript.text
34
- except Exception as e:
35
- raise RuntimeError(f"Failed to transcribe audio: {str(e)}")
36
-
37
- def get_audio_analysis_tool():
38
- return AudioAnalysisTool()