webscout 8.2.9__py3-none-any.whl → 8.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of webscout might be problematic. Click here for more details.
- webscout/AIauto.py +6 -6
- webscout/AIbase.py +61 -1
- webscout/Extra/YTToolkit/ytapi/patterns.py +45 -45
- webscout/Extra/YTToolkit/ytapi/stream.py +1 -1
- webscout/Extra/YTToolkit/ytapi/video.py +10 -10
- webscout/Extra/autocoder/autocoder_utiles.py +1 -1
- webscout/Litlogger/formats.py +9 -0
- webscout/Litlogger/handlers.py +18 -0
- webscout/Litlogger/logger.py +43 -1
- webscout/Provider/AISEARCH/scira_search.py +3 -2
- webscout/Provider/Blackboxai.py +2 -0
- webscout/Provider/ChatSandbox.py +2 -1
- webscout/Provider/Deepinfra.py +1 -1
- webscout/Provider/HeckAI.py +1 -1
- webscout/Provider/LambdaChat.py +8 -1
- webscout/Provider/MCPCore.py +7 -3
- webscout/Provider/OPENAI/BLACKBOXAI.py +396 -113
- webscout/Provider/OPENAI/Cloudflare.py +31 -14
- webscout/Provider/OPENAI/FalconH1.py +457 -0
- webscout/Provider/OPENAI/FreeGemini.py +29 -13
- webscout/Provider/OPENAI/NEMOTRON.py +26 -14
- webscout/Provider/OPENAI/PI.py +427 -0
- webscout/Provider/OPENAI/Qwen3.py +161 -140
- webscout/Provider/OPENAI/README.md +3 -0
- webscout/Provider/OPENAI/TogetherAI.py +355 -0
- webscout/Provider/OPENAI/TwoAI.py +29 -12
- webscout/Provider/OPENAI/__init__.py +4 -1
- webscout/Provider/OPENAI/ai4chat.py +33 -23
- webscout/Provider/OPENAI/api.py +375 -24
- webscout/Provider/OPENAI/autoproxy.py +39 -0
- webscout/Provider/OPENAI/base.py +91 -12
- webscout/Provider/OPENAI/c4ai.py +31 -10
- webscout/Provider/OPENAI/chatgpt.py +56 -24
- webscout/Provider/OPENAI/chatgptclone.py +46 -16
- webscout/Provider/OPENAI/chatsandbox.py +7 -3
- webscout/Provider/OPENAI/copilot.py +26 -10
- webscout/Provider/OPENAI/deepinfra.py +29 -12
- webscout/Provider/OPENAI/e2b.py +358 -158
- webscout/Provider/OPENAI/exaai.py +13 -10
- webscout/Provider/OPENAI/exachat.py +10 -6
- webscout/Provider/OPENAI/flowith.py +7 -3
- webscout/Provider/OPENAI/freeaichat.py +10 -6
- webscout/Provider/OPENAI/glider.py +10 -6
- webscout/Provider/OPENAI/heckai.py +11 -8
- webscout/Provider/OPENAI/llmchatco.py +9 -7
- webscout/Provider/OPENAI/mcpcore.py +10 -7
- webscout/Provider/OPENAI/multichat.py +3 -1
- webscout/Provider/OPENAI/netwrck.py +10 -6
- webscout/Provider/OPENAI/oivscode.py +12 -9
- webscout/Provider/OPENAI/opkfc.py +31 -8
- webscout/Provider/OPENAI/scirachat.py +17 -10
- webscout/Provider/OPENAI/sonus.py +10 -6
- webscout/Provider/OPENAI/standardinput.py +18 -9
- webscout/Provider/OPENAI/textpollinations.py +14 -7
- webscout/Provider/OPENAI/toolbaz.py +16 -11
- webscout/Provider/OPENAI/typefully.py +14 -7
- webscout/Provider/OPENAI/typegpt.py +10 -6
- webscout/Provider/OPENAI/uncovrAI.py +22 -8
- webscout/Provider/OPENAI/venice.py +10 -6
- webscout/Provider/OPENAI/writecream.py +13 -10
- webscout/Provider/OPENAI/x0gpt.py +11 -9
- webscout/Provider/OPENAI/yep.py +12 -10
- webscout/Provider/PI.py +2 -1
- webscout/Provider/STT/__init__.py +3 -0
- webscout/Provider/STT/base.py +281 -0
- webscout/Provider/STT/elevenlabs.py +265 -0
- webscout/Provider/TTI/__init__.py +3 -1
- webscout/Provider/TTI/aiarta.py +399 -365
- webscout/Provider/TTI/base.py +74 -2
- webscout/Provider/TTI/fastflux.py +63 -30
- webscout/Provider/TTI/gpt1image.py +149 -0
- webscout/Provider/TTI/imagen.py +196 -0
- webscout/Provider/TTI/magicstudio.py +60 -29
- webscout/Provider/TTI/piclumen.py +43 -32
- webscout/Provider/TTI/pixelmuse.py +232 -225
- webscout/Provider/TTI/pollinations.py +43 -32
- webscout/Provider/TTI/together.py +287 -0
- webscout/Provider/TTI/utils.py +2 -1
- webscout/Provider/TTS/README.md +1 -0
- webscout/Provider/TTS/__init__.py +2 -1
- webscout/Provider/TTS/freetts.py +140 -0
- webscout/Provider/UNFINISHED/ChutesAI.py +314 -0
- webscout/Provider/UNFINISHED/fetch_together_models.py +95 -0
- webscout/Provider/__init__.py +3 -2
- webscout/Provider/granite.py +41 -6
- webscout/Provider/oivscode.py +37 -37
- webscout/Provider/scira_chat.py +3 -2
- webscout/Provider/scnet.py +1 -0
- webscout/Provider/toolbaz.py +0 -1
- webscout/litagent/Readme.md +12 -3
- webscout/litagent/agent.py +99 -62
- webscout/version.py +1 -1
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/METADATA +2 -1
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/RECORD +98 -87
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/WHEEL +1 -1
- webscout/Provider/ChatGPTGratis.py +0 -194
- webscout/Provider/TTI/artbit.py +0 -0
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/entry_points.txt +0 -0
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/licenses/LICENSE.md +0 -0
- {webscout-8.2.9.dist-info → webscout-8.3.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ElevenLabs STT provider with OpenAI-compatible interface.
|
|
3
|
+
|
|
4
|
+
This module provides an OpenAI Whisper API-compatible interface for ElevenLabs
|
|
5
|
+
speech-to-text transcription service.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import time
|
|
10
|
+
import uuid
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any, Dict, Generator, List, Optional, Union, BinaryIO
|
|
13
|
+
|
|
14
|
+
import requests
|
|
15
|
+
from webscout.litagent import LitAgent
|
|
16
|
+
from webscout import exceptions
|
|
17
|
+
|
|
18
|
+
from webscout.Provider.STT.base import (
|
|
19
|
+
BaseSTTTranscriptions, BaseSTTAudio, STTCompatibleProvider,
|
|
20
|
+
STTModels, TranscriptionResponse
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ElevenLabsTranscriptions(BaseSTTTranscriptions):
|
|
25
|
+
"""ElevenLabs transcriptions interface."""
|
|
26
|
+
|
|
27
|
+
def create(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
model: str,
|
|
31
|
+
file: Union[BinaryIO, str, Path],
|
|
32
|
+
language: Optional[str] = None,
|
|
33
|
+
prompt: Optional[str] = None,
|
|
34
|
+
response_format: str = "json",
|
|
35
|
+
temperature: Optional[float] = None,
|
|
36
|
+
timestamp_granularities: Optional[List[str]] = None,
|
|
37
|
+
stream: bool = False,
|
|
38
|
+
timeout: Optional[int] = None,
|
|
39
|
+
proxies: Optional[dict] = None,
|
|
40
|
+
**kwargs: Any
|
|
41
|
+
) -> Union[TranscriptionResponse, Generator[str, None, None]]:
|
|
42
|
+
"""Create a transcription using ElevenLabs API."""
|
|
43
|
+
# Always use file as file-like object
|
|
44
|
+
if isinstance(file, (str, Path)):
|
|
45
|
+
audio_file = open(str(file), "rb")
|
|
46
|
+
close_file = True
|
|
47
|
+
else:
|
|
48
|
+
audio_file = file
|
|
49
|
+
close_file = False
|
|
50
|
+
try:
|
|
51
|
+
if stream:
|
|
52
|
+
return self._create_stream(
|
|
53
|
+
audio_file=audio_file,
|
|
54
|
+
model=model,
|
|
55
|
+
language=language,
|
|
56
|
+
prompt=prompt,
|
|
57
|
+
response_format=response_format,
|
|
58
|
+
temperature=temperature,
|
|
59
|
+
timestamp_granularities=timestamp_granularities,
|
|
60
|
+
timeout=timeout,
|
|
61
|
+
proxies=proxies,
|
|
62
|
+
**kwargs
|
|
63
|
+
)
|
|
64
|
+
else:
|
|
65
|
+
result = self._create_non_stream(
|
|
66
|
+
audio_file=audio_file,
|
|
67
|
+
model=model,
|
|
68
|
+
language=language,
|
|
69
|
+
prompt=prompt,
|
|
70
|
+
response_format=response_format,
|
|
71
|
+
temperature=temperature,
|
|
72
|
+
timestamp_granularities=timestamp_granularities,
|
|
73
|
+
timeout=timeout,
|
|
74
|
+
proxies=proxies,
|
|
75
|
+
**kwargs
|
|
76
|
+
)
|
|
77
|
+
return result
|
|
78
|
+
finally:
|
|
79
|
+
if close_file:
|
|
80
|
+
audio_file.close()
|
|
81
|
+
|
|
82
|
+
def _create_non_stream(
|
|
83
|
+
self,
|
|
84
|
+
audio_file: BinaryIO,
|
|
85
|
+
model: str,
|
|
86
|
+
language: Optional[str] = None,
|
|
87
|
+
prompt: Optional[str] = None,
|
|
88
|
+
response_format: str = "json",
|
|
89
|
+
temperature: Optional[float] = None,
|
|
90
|
+
timestamp_granularities: Optional[List[str]] = None,
|
|
91
|
+
timeout: Optional[int] = None,
|
|
92
|
+
proxies: Optional[dict] = None,
|
|
93
|
+
**kwargs: Any
|
|
94
|
+
) -> TranscriptionResponse:
|
|
95
|
+
"""Create non-streaming transcription."""
|
|
96
|
+
try:
|
|
97
|
+
headers = {
|
|
98
|
+
'Accept': 'application/json, text/plain, */*',
|
|
99
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
100
|
+
'User-Agent': LitAgent().random()
|
|
101
|
+
}
|
|
102
|
+
api_url = self._client.api_url
|
|
103
|
+
if getattr(self._client, 'allow_unauthenticated', False):
|
|
104
|
+
if '?' in api_url:
|
|
105
|
+
api_url += '&allow_unauthenticated=1'
|
|
106
|
+
else:
|
|
107
|
+
api_url += '?allow_unauthenticated=1'
|
|
108
|
+
files = {
|
|
109
|
+
'file': audio_file,
|
|
110
|
+
'model_id': (None, self._client.model_id),
|
|
111
|
+
'tag_audio_events': (None, 'true' if self._client.tag_audio_events else 'false'),
|
|
112
|
+
'diarize': (None, 'true' if self._client.diarize else 'false')
|
|
113
|
+
}
|
|
114
|
+
if language:
|
|
115
|
+
files['language'] = (None, language)
|
|
116
|
+
response = requests.post(
|
|
117
|
+
api_url,
|
|
118
|
+
files=files,
|
|
119
|
+
headers=headers,
|
|
120
|
+
timeout=timeout or self._client.timeout,
|
|
121
|
+
proxies=proxies or getattr(self._client, "proxies", None)
|
|
122
|
+
)
|
|
123
|
+
if response.status_code != 200:
|
|
124
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
125
|
+
f"ElevenLabs API returned error: {response.status_code} - {response.text}"
|
|
126
|
+
)
|
|
127
|
+
result = response.json()
|
|
128
|
+
simple_result = {
|
|
129
|
+
"text": result.get("text", "")
|
|
130
|
+
}
|
|
131
|
+
return TranscriptionResponse(simple_result, response_format)
|
|
132
|
+
except Exception as e:
|
|
133
|
+
raise exceptions.FailedToGenerateResponseError(f"ElevenLabs transcription failed: {str(e)}")
|
|
134
|
+
|
|
135
|
+
def _create_stream(
|
|
136
|
+
self,
|
|
137
|
+
audio_file: BinaryIO,
|
|
138
|
+
model: str,
|
|
139
|
+
language: Optional[str] = None,
|
|
140
|
+
prompt: Optional[str] = None,
|
|
141
|
+
response_format: str = "json",
|
|
142
|
+
temperature: Optional[float] = None,
|
|
143
|
+
timestamp_granularities: Optional[List[str]] = None,
|
|
144
|
+
timeout: Optional[int] = None,
|
|
145
|
+
proxies: Optional[dict] = None,
|
|
146
|
+
**kwargs: Any
|
|
147
|
+
) -> Generator[str, None, None]:
|
|
148
|
+
"""Create streaming transcription using requests.post(..., stream=True)."""
|
|
149
|
+
headers = {
|
|
150
|
+
'Accept': 'application/json, text/plain, */*',
|
|
151
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
152
|
+
'User-Agent': LitAgent().random()
|
|
153
|
+
}
|
|
154
|
+
api_url = self._client.api_url
|
|
155
|
+
if getattr(self._client, 'allow_unauthenticated', False):
|
|
156
|
+
if '?' in api_url:
|
|
157
|
+
api_url += '&allow_unauthenticated=1'
|
|
158
|
+
else:
|
|
159
|
+
api_url += '?allow_unauthenticated=1'
|
|
160
|
+
files = {
|
|
161
|
+
'file': audio_file,
|
|
162
|
+
'model_id': (None, self._client.model_id),
|
|
163
|
+
'tag_audio_events': (None, 'true' if self._client.tag_audio_events else 'false'),
|
|
164
|
+
'diarize': (None, 'true' if self._client.diarize else 'false')
|
|
165
|
+
}
|
|
166
|
+
if language:
|
|
167
|
+
files['language'] = (None, language)
|
|
168
|
+
response = requests.post(
|
|
169
|
+
api_url,
|
|
170
|
+
files=files,
|
|
171
|
+
headers=headers,
|
|
172
|
+
timeout=timeout or self._client.timeout,
|
|
173
|
+
proxies=proxies or getattr(self._client, "proxies", None),
|
|
174
|
+
stream=True
|
|
175
|
+
)
|
|
176
|
+
if response.status_code != 200:
|
|
177
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
178
|
+
f"ElevenLabs API returned error: {response.status_code} - {response.text}"
|
|
179
|
+
)
|
|
180
|
+
# Stream the response, decode utf-8
|
|
181
|
+
for line in response.iter_lines(decode_unicode=True):
|
|
182
|
+
if line:
|
|
183
|
+
yield line
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class ElevenLabsAudio(BaseSTTAudio):
|
|
188
|
+
"""ElevenLabs audio interface."""
|
|
189
|
+
|
|
190
|
+
def _create_transcriptions(self, client) -> ElevenLabsTranscriptions:
|
|
191
|
+
return ElevenLabsTranscriptions(client)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class ElevenLabsSTT(STTCompatibleProvider):
|
|
195
|
+
"""
|
|
196
|
+
OpenAI-compatible client for ElevenLabs STT API.
|
|
197
|
+
|
|
198
|
+
Usage:
|
|
199
|
+
client = ElevenLabsSTT()
|
|
200
|
+
audio_file = open("audio.mp3", "rb")
|
|
201
|
+
transcription = client.audio.transcriptions.create(
|
|
202
|
+
model="scribe_v1",
|
|
203
|
+
file=audio_file,
|
|
204
|
+
response_format="text"
|
|
205
|
+
)
|
|
206
|
+
print(transcription.text)
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
AVAILABLE_MODELS = [
|
|
210
|
+
"scribe_v1",
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
def __init__(
|
|
214
|
+
self,
|
|
215
|
+
model_id: str = "scribe_v1",
|
|
216
|
+
allow_unauthenticated: bool = True,
|
|
217
|
+
tag_audio_events: bool = True,
|
|
218
|
+
diarize: bool = True,
|
|
219
|
+
timeout: int = 60,
|
|
220
|
+
proxies: Optional[dict] = None
|
|
221
|
+
):
|
|
222
|
+
"""Initialize ElevenLabs STT provider."""
|
|
223
|
+
self.model_id = model_id
|
|
224
|
+
self.allow_unauthenticated = allow_unauthenticated
|
|
225
|
+
self.tag_audio_events = tag_audio_events
|
|
226
|
+
self.diarize = diarize
|
|
227
|
+
self.timeout = timeout
|
|
228
|
+
self.proxies = proxies
|
|
229
|
+
|
|
230
|
+
# API configuration
|
|
231
|
+
self.api_url = "https://api.elevenlabs.io/v1/speech-to-text"
|
|
232
|
+
|
|
233
|
+
# Initialize interfaces
|
|
234
|
+
self.audio = ElevenLabsAudio(self)
|
|
235
|
+
self._models = STTModels(self.AVAILABLE_MODELS)
|
|
236
|
+
|
|
237
|
+
@property
|
|
238
|
+
def models(self):
|
|
239
|
+
"""Get models interface."""
|
|
240
|
+
return self._models
|
|
241
|
+
if __name__ == "__main__":
|
|
242
|
+
from rich import print
|
|
243
|
+
client = ElevenLabsSTT()
|
|
244
|
+
|
|
245
|
+
# Example audio file path - replace with your own
|
|
246
|
+
audio_file_path = r"C:\Users\koula\Downloads\audio_2025-05-12_22-30-47.ogg"
|
|
247
|
+
|
|
248
|
+
print("=== Non-streaming example ===")
|
|
249
|
+
with open(audio_file_path, "rb") as audio_file:
|
|
250
|
+
transcription = client.audio.transcriptions.create(
|
|
251
|
+
model="scribe_v1",
|
|
252
|
+
file=audio_file,
|
|
253
|
+
stream=False
|
|
254
|
+
)
|
|
255
|
+
print(transcription.text)
|
|
256
|
+
|
|
257
|
+
print("\n=== Streaming example ===")
|
|
258
|
+
with open(audio_file_path, "rb") as audio_file:
|
|
259
|
+
stream = client.audio.transcriptions.create(
|
|
260
|
+
model="scribe_v1",
|
|
261
|
+
file=audio_file,
|
|
262
|
+
stream=True
|
|
263
|
+
)
|
|
264
|
+
for chunk in stream:
|
|
265
|
+
print(chunk.strip())
|