Tesvia commited on
Commit
b251ad0
·
verified ·
1 Parent(s): b9d139a

Upload 2 files

Browse files
Files changed (1) hide show
  1. tools.py +12 -12
tools.py CHANGED
@@ -15,9 +15,9 @@ class PythonRunTool(Tool):
15
  "+ repr() of the last expression (or _result variable)."
16
  )
17
  inputs = {
18
- "code": {"type": str, "description": "Python code to execute", "required": True}
19
  }
20
- output_type = "str"
21
 
22
  def forward(self, code: str) -> str:
23
  buf, ns = io.StringIO(), {}
@@ -39,9 +39,9 @@ class ExcelLoaderTool(Tool):
39
  "rows as a list of dictionaries with string keys."
40
  )
41
  inputs = {
42
- "path": {"type": str, "description": "Path to .csv/.xls/.xlsx file", "required": True},
43
  "sheet": {
44
- "type": str,
45
  "description": "Sheet name or index (optional, required for Excel files only)",
46
  "required": False,
47
  "default": "",
@@ -69,10 +69,10 @@ class YouTubeTranscriptTool(Tool):
69
  name = "youtube_transcript"
70
  description = "Return the subtitles of a YouTube URL using youtube-transcript-api."
71
  inputs = {
72
- "url": {"type": str, "description": "YouTube URL", "required": True},
73
- "lang": {"type": str, "description": "Transcript language (default: en)", "required": False, "default": "en"}
74
  }
75
- output_type = "str"
76
 
77
  def forward(self, url: str, lang: str = "en") -> str:
78
  from urllib.parse import urlparse, parse_qs
@@ -86,10 +86,10 @@ class AudioTranscriptionTool(Tool):
86
  name = "transcribe_audio"
87
  description = "Transcribe an audio file with OpenAI Whisper, returns plain text."
88
  inputs = {
89
- "path": {"type": str, "description": "Path to audio file", "required": True},
90
- "model": {"type": str, "description": "Model name for transcription (default: whisper-1)", "required": False, "default": "whisper-1"}
91
  }
92
- output_type = "str"
93
 
94
  def forward(self, path: str, model: str = "whisper-1") -> str:
95
  import openai
@@ -105,9 +105,9 @@ class SimpleOCRTool(Tool):
105
  name = "image_ocr"
106
  description = "Return any text spotted in an image via pytesseract OCR."
107
  inputs = {
108
- "path": {"type": str, "description": "Path to image file", "required": True}
109
  }
110
- output_type = "str"
111
 
112
  def forward(self, path: str) -> str:
113
  from PIL import Image
 
15
  "+ repr() of the last expression (or _result variable)."
16
  )
17
  inputs = {
18
+ "code": {"type": "string", "description": "Python code to execute", "required": True}
19
  }
20
+ output_type = "string"
21
 
22
  def forward(self, code: str) -> str:
23
  buf, ns = io.StringIO(), {}
 
39
  "rows as a list of dictionaries with string keys."
40
  )
41
  inputs = {
42
+ "path": {"type": "string", "description": "Path to .csv/.xls/.xlsx file", "required": True},
43
  "sheet": {
44
+ "type": "string",
45
  "description": "Sheet name or index (optional, required for Excel files only)",
46
  "required": False,
47
  "default": "",
 
69
  name = "youtube_transcript"
70
  description = "Return the subtitles of a YouTube URL using youtube-transcript-api."
71
  inputs = {
72
+ "url": {"type": "string", "description": "YouTube URL", "required": True},
73
+ "lang": {"type": "string", "description": "Transcript language (default: en)", "required": False, "default": "en"}
74
  }
75
+ output_type = "string"
76
 
77
  def forward(self, url: str, lang: str = "en") -> str:
78
  from urllib.parse import urlparse, parse_qs
 
86
  name = "transcribe_audio"
87
  description = "Transcribe an audio file with OpenAI Whisper, returns plain text."
88
  inputs = {
89
+ "path": {"type": "string", "description": "Path to audio file", "required": True},
90
+ "model": {"type": "string", "description": "Model name for transcription (default: whisper-1)", "required": False, "default": "whisper-1"}
91
  }
92
+ output_type = "string"
93
 
94
  def forward(self, path: str, model: str = "whisper-1") -> str:
95
  import openai
 
105
  name = "image_ocr"
106
  description = "Return any text spotted in an image via pytesseract OCR."
107
  inputs = {
108
+ "path": {"type": "string", "description": "Path to image file", "required": True}
109
  }
110
+ output_type = "string"
111
 
112
  def forward(self, path: str) -> str:
113
  from PIL import Image