webscout 6.2b0__py3-none-any.whl → 6.4__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 +191 -176
- webscout/AIbase.py +112 -239
- webscout/AIutel.py +488 -1130
- webscout/Agents/functioncall.py +248 -198
- webscout/Bing_search.py +250 -153
- webscout/DWEBS.py +454 -178
- webscout/Extra/__init__.py +2 -1
- webscout/Extra/autocoder/__init__.py +9 -0
- webscout/Extra/autocoder/autocoder_utiles.py +121 -0
- webscout/Extra/autocoder/rawdog.py +681 -0
- webscout/Extra/autollama.py +246 -195
- webscout/Extra/gguf.py +441 -226
- webscout/Extra/weather.py +172 -67
- webscout/LLM.py +442 -100
- webscout/Litlogger/__init__.py +681 -0
- webscout/Local/formats.py +4 -2
- webscout/Provider/Amigo.py +19 -10
- webscout/Provider/Andi.py +0 -33
- webscout/Provider/Blackboxai.py +4 -204
- webscout/Provider/DARKAI.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/Llama3.py +1 -1
- webscout/Provider/Marcus.py +137 -0
- webscout/Provider/NinjaChat.py +1 -1
- webscout/Provider/PI.py +221 -207
- webscout/Provider/Perplexity.py +598 -598
- webscout/Provider/RoboCoders.py +206 -0
- webscout/Provider/TTI/AiForce/__init__.py +22 -0
- webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
- webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
- webscout/Provider/TTI/Nexra/__init__.py +22 -0
- webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
- webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
- webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
- webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
- webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
- webscout/Provider/TTI/__init__.py +3 -4
- webscout/Provider/TTI/artbit/__init__.py +22 -0
- webscout/Provider/TTI/artbit/async_artbit.py +184 -0
- webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
- webscout/Provider/TTI/blackbox/__init__.py +4 -0
- webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
- webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
- webscout/Provider/TTI/deepinfra/__init__.py +4 -0
- webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
- webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
- webscout/Provider/TTI/huggingface/__init__.py +22 -0
- webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
- webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
- webscout/Provider/TTI/imgninza/__init__.py +4 -0
- webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
- webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
- webscout/Provider/TTI/talkai/__init__.py +4 -0
- webscout/Provider/TTI/talkai/async_talkai.py +229 -0
- webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
- webscout/Provider/__init__.py +146 -132
- webscout/Provider/askmyai.py +158 -0
- webscout/Provider/cerebras.py +227 -206
- webscout/Provider/geminiapi.py +208 -198
- webscout/Provider/llama3mitril.py +180 -0
- webscout/Provider/llmchat.py +203 -0
- webscout/Provider/mhystical.py +176 -0
- webscout/Provider/perplexitylabs.py +265 -0
- webscout/Provider/talkai.py +196 -0
- webscout/Provider/twitterclone.py +251 -244
- webscout/Provider/typegpt.py +359 -0
- webscout/__init__.py +28 -23
- webscout/__main__.py +5 -5
- webscout/cli.py +327 -347
- webscout/conversation.py +227 -0
- webscout/exceptions.py +161 -29
- webscout/litagent/__init__.py +172 -0
- webscout/litprinter/__init__.py +831 -0
- webscout/optimizers.py +270 -0
- webscout/prompt_manager.py +279 -0
- webscout/swiftcli/__init__.py +810 -0
- webscout/transcriber.py +479 -551
- webscout/update_checker.py +125 -0
- webscout/version.py +1 -1
- webscout-6.4.dist-info/LICENSE.md +211 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/METADATA +34 -55
- webscout-6.4.dist-info/RECORD +154 -0
- webscout/Provider/TTI/AIuncensored.py +0 -103
- webscout/Provider/TTI/Nexra.py +0 -120
- webscout/Provider/TTI/PollinationsAI.py +0 -138
- webscout/Provider/TTI/WebSimAI.py +0 -142
- webscout/Provider/TTI/aiforce.py +0 -160
- webscout/Provider/TTI/artbit.py +0 -141
- webscout/Provider/TTI/deepinfra.py +0 -148
- webscout/Provider/TTI/huggingface.py +0 -155
- webscout/models.py +0 -23
- webscout-6.2b0.dist-info/LICENSE.md +0 -50
- webscout-6.2b0.dist-info/RECORD +0 -118
- /webscout/{g4f.py → gpt4free.py} +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/WHEEL +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/entry_points.txt +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/top_level.txt +0 -0
webscout/AIbase.py
CHANGED
|
@@ -1,240 +1,113 @@
|
|
|
1
|
-
from abc import ABC
|
|
2
|
-
from abc import abstractmethod
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
optimizer: str = None,
|
|
114
|
-
conversationally: bool = False,
|
|
115
|
-
) -> str:
|
|
116
|
-
"""Asynchronously generate response `str`
|
|
117
|
-
Args:
|
|
118
|
-
prompt (str): Prompt to be sent
|
|
119
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
120
|
-
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`
|
|
121
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
122
|
-
Returns:
|
|
123
|
-
str: Response generated
|
|
124
|
-
"""
|
|
125
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
126
|
-
|
|
127
|
-
@abstractmethod
|
|
128
|
-
async def get_message(self, response: dict) -> str:
|
|
129
|
-
"""Asynchronously retrieves message only from response
|
|
130
|
-
|
|
131
|
-
Args:
|
|
132
|
-
response (dict): Response generated by `self.ask`
|
|
133
|
-
|
|
134
|
-
Returns:
|
|
135
|
-
str: Message extracted
|
|
136
|
-
"""
|
|
137
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
138
|
-
|
|
139
|
-
class TTSProvider(ABC):
|
|
140
|
-
"""Base class for text-to-speech providers"""
|
|
141
|
-
|
|
142
|
-
@abstractmethod
|
|
143
|
-
def tts(self, text: str) -> Union[bytes, str, Generator[bytes, None, None]]:
|
|
144
|
-
"""
|
|
145
|
-
Converts text to speech.
|
|
146
|
-
|
|
147
|
-
Args:
|
|
148
|
-
text (str): The text to be converted to speech.
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
Union[bytes, str, Generator[bytes, None, None]]:
|
|
152
|
-
- The raw audio bytes if the provider supports returning audio directly.
|
|
153
|
-
- The filename of the saved audio file if the provider saves the audio to a file.
|
|
154
|
-
- A generator yielding chunks of audio bytes if the provider supports streaming audio.
|
|
155
|
-
"""
|
|
156
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
157
|
-
|
|
158
|
-
class AsyncTTSProvider(ABC):
|
|
159
|
-
"""Asynchronous base class for text-to-speech providers"""
|
|
160
|
-
|
|
161
|
-
@abstractmethod
|
|
162
|
-
async def tts(self, text: str) -> Union[bytes, str, AsyncGenerator[bytes, None]]:
|
|
163
|
-
"""
|
|
164
|
-
Asynchronously converts text to speech.
|
|
165
|
-
|
|
166
|
-
Args:
|
|
167
|
-
text (str): The text to be converted to speech.
|
|
168
|
-
|
|
169
|
-
Returns:
|
|
170
|
-
Union[bytes, str, AsyncGenerator[bytes, None]]:
|
|
171
|
-
- The raw audio bytes if the provider supports returning audio directly.
|
|
172
|
-
- The filename of the saved audio file if the provider saves the audio to a file.
|
|
173
|
-
- An asynchronous generator yielding chunks of audio bytes if the provider supports streaming audio.
|
|
174
|
-
"""
|
|
175
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
176
|
-
|
|
177
|
-
class ImageProvider(ABC):
|
|
178
|
-
"""Base class for text-to-image providers"""
|
|
179
|
-
|
|
180
|
-
@abstractmethod
|
|
181
|
-
def generate(self, prompt: str, amount: int = 1) -> List[bytes]:
|
|
182
|
-
"""Generates images from a text prompt.
|
|
183
|
-
|
|
184
|
-
Args:
|
|
185
|
-
prompt (str): The text prompt describing the desired image.
|
|
186
|
-
amount (int, optional): The number of images to generate. Defaults to 1.
|
|
187
|
-
|
|
188
|
-
Returns:
|
|
189
|
-
List[bytes]: A list of generated images in bytes format.
|
|
190
|
-
"""
|
|
191
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
192
|
-
|
|
193
|
-
@abstractmethod
|
|
194
|
-
def save(self, response: List[bytes], name: str = None, dir: str = None) -> List[str]:
|
|
195
|
-
"""Saves the generated images to files.
|
|
196
|
-
|
|
197
|
-
Args:
|
|
198
|
-
response (List[bytes]): The list of generated images in bytes format.
|
|
199
|
-
name (str, optional): The base filename for the images. Defaults to None.
|
|
200
|
-
dir (str, optional): The directory to save the images. Defaults to None.
|
|
201
|
-
|
|
202
|
-
Returns:
|
|
203
|
-
List[str]: A list of the saved filenames.
|
|
204
|
-
"""
|
|
205
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
206
|
-
|
|
207
|
-
class AsyncImageProvider(ABC):
|
|
208
|
-
"""Base class for asynchronous text-to-image providers"""
|
|
209
|
-
|
|
210
|
-
@abstractmethod
|
|
211
|
-
async def generate(self, prompt: str, amount: int = 1) -> Union[AsyncGenerator[bytes, None], List[bytes]]:
|
|
212
|
-
"""Asynchronously generates images from a text prompt.
|
|
213
|
-
|
|
214
|
-
Args:
|
|
215
|
-
prompt (str): The text prompt describing the desired image.
|
|
216
|
-
amount (int, optional): The number of images to generate. Defaults to 1.
|
|
217
|
-
|
|
218
|
-
Returns:
|
|
219
|
-
Union[AsyncGenerator[bytes, None], List[bytes]]:
|
|
220
|
-
- An asynchronous generator yielding image bytes.
|
|
221
|
-
- A list of image bytes if not streaming.
|
|
222
|
-
"""
|
|
223
|
-
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
224
|
-
|
|
225
|
-
@abstractmethod
|
|
226
|
-
async def save(self, response: Union[AsyncGenerator[bytes, None], List[bytes]],
|
|
227
|
-
name: str = None, dir: str = None) -> List[str]:
|
|
228
|
-
"""Asynchronously saves the generated images to files.
|
|
229
|
-
|
|
230
|
-
Args:
|
|
231
|
-
response (Union[AsyncGenerator[bytes, None], List[bytes]]):
|
|
232
|
-
- The asynchronous generator yielding images in bytes format (if streaming).
|
|
233
|
-
- The list of generated images in bytes format (if not streaming).
|
|
234
|
-
name (str, optional): The base filename for the images. Defaults to None.
|
|
235
|
-
dir (str, optional): The directory to save the images. Defaults to None.
|
|
236
|
-
|
|
237
|
-
Returns:
|
|
238
|
-
List[str]: A list of the saved filenames.
|
|
239
|
-
"""
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from abc import abstractmethod
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import AsyncGenerator, List, Union, Generator, Optional
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
# Type aliases for better readability
|
|
8
|
+
Response: TypeAlias = dict[str, Union[str, bool, None]]
|
|
9
|
+
ImageData: TypeAlias = Union[bytes, str, Generator[bytes, None, None]]
|
|
10
|
+
AsyncImageData: TypeAlias = Union[bytes, str, AsyncGenerator[bytes, None]]
|
|
11
|
+
|
|
12
|
+
class AIProviderError(Exception):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
class Provider(ABC):
|
|
16
|
+
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def ask(
|
|
19
|
+
self,
|
|
20
|
+
prompt: str,
|
|
21
|
+
stream: bool = False,
|
|
22
|
+
raw: bool = False,
|
|
23
|
+
optimizer: Optional[str] = None,
|
|
24
|
+
conversationally: bool = False,
|
|
25
|
+
) -> Response:
|
|
26
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def chat(
|
|
30
|
+
self,
|
|
31
|
+
prompt: str,
|
|
32
|
+
stream: bool = False,
|
|
33
|
+
optimizer: Optional[str] = None,
|
|
34
|
+
conversationally: bool = False,
|
|
35
|
+
) -> str:
|
|
36
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
37
|
+
|
|
38
|
+
@abstractmethod
|
|
39
|
+
def get_message(self, response: Response) -> str:
|
|
40
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
41
|
+
|
|
42
|
+
class AsyncProvider(ABC):
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
async def ask(
|
|
46
|
+
self,
|
|
47
|
+
prompt: str,
|
|
48
|
+
stream: bool = False,
|
|
49
|
+
raw: bool = False,
|
|
50
|
+
optimizer: Optional[str] = None,
|
|
51
|
+
conversationally: bool = False,
|
|
52
|
+
) -> Response:
|
|
53
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
async def chat(
|
|
57
|
+
self,
|
|
58
|
+
prompt: str,
|
|
59
|
+
stream: bool = False,
|
|
60
|
+
optimizer: Optional[str] = None,
|
|
61
|
+
conversationally: bool = False,
|
|
62
|
+
) -> str:
|
|
63
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
async def get_message(self, response: Response) -> str:
|
|
67
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
68
|
+
|
|
69
|
+
class TTSProvider(ABC):
|
|
70
|
+
|
|
71
|
+
@abstractmethod
|
|
72
|
+
def tts(self, text: str) -> ImageData:
|
|
73
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
74
|
+
|
|
75
|
+
class AsyncTTSProvider(ABC):
|
|
76
|
+
|
|
77
|
+
@abstractmethod
|
|
78
|
+
async def tts(self, text: str) -> AsyncImageData:
|
|
79
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
80
|
+
|
|
81
|
+
class ImageProvider(ABC):
|
|
82
|
+
|
|
83
|
+
@abstractmethod
|
|
84
|
+
def generate(self, prompt: str, amount: int = 1) -> List[bytes]:
|
|
85
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
86
|
+
|
|
87
|
+
@abstractmethod
|
|
88
|
+
def save(
|
|
89
|
+
self,
|
|
90
|
+
response: List[bytes],
|
|
91
|
+
name: Optional[str] = None,
|
|
92
|
+
dir: Optional[Union[str, Path]] = None
|
|
93
|
+
) -> List[str]:
|
|
94
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
95
|
+
|
|
96
|
+
class AsyncImageProvider(ABC):
|
|
97
|
+
|
|
98
|
+
@abstractmethod
|
|
99
|
+
async def generate(
|
|
100
|
+
self,
|
|
101
|
+
prompt: str,
|
|
102
|
+
amount: int = 1
|
|
103
|
+
) -> Union[AsyncGenerator[bytes, None], List[bytes]]:
|
|
104
|
+
raise NotImplementedError("Method needs to be implemented in subclass")
|
|
105
|
+
|
|
106
|
+
@abstractmethod
|
|
107
|
+
async def save(
|
|
108
|
+
self,
|
|
109
|
+
response: Union[AsyncGenerator[bytes, None], List[bytes]],
|
|
110
|
+
name: Optional[str] = None,
|
|
111
|
+
dir: Optional[Union[str, Path]] = None
|
|
112
|
+
) -> List[str]:
|
|
240
113
|
raise NotImplementedError("Method needs to be implemented in subclass")
|