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.

Files changed (97) hide show
  1. webscout/AIauto.py +191 -176
  2. webscout/AIbase.py +112 -239
  3. webscout/AIutel.py +488 -1130
  4. webscout/Agents/functioncall.py +248 -198
  5. webscout/Bing_search.py +250 -153
  6. webscout/DWEBS.py +454 -178
  7. webscout/Extra/__init__.py +2 -1
  8. webscout/Extra/autocoder/__init__.py +9 -0
  9. webscout/Extra/autocoder/autocoder_utiles.py +121 -0
  10. webscout/Extra/autocoder/rawdog.py +681 -0
  11. webscout/Extra/autollama.py +246 -195
  12. webscout/Extra/gguf.py +441 -226
  13. webscout/Extra/weather.py +172 -67
  14. webscout/LLM.py +442 -100
  15. webscout/Litlogger/__init__.py +681 -0
  16. webscout/Local/formats.py +4 -2
  17. webscout/Provider/Amigo.py +19 -10
  18. webscout/Provider/Andi.py +0 -33
  19. webscout/Provider/Blackboxai.py +4 -204
  20. webscout/Provider/DARKAI.py +1 -1
  21. webscout/Provider/EDITEE.py +1 -1
  22. webscout/Provider/Llama3.py +1 -1
  23. webscout/Provider/Marcus.py +137 -0
  24. webscout/Provider/NinjaChat.py +1 -1
  25. webscout/Provider/PI.py +221 -207
  26. webscout/Provider/Perplexity.py +598 -598
  27. webscout/Provider/RoboCoders.py +206 -0
  28. webscout/Provider/TTI/AiForce/__init__.py +22 -0
  29. webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
  30. webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
  31. webscout/Provider/TTI/Nexra/__init__.py +22 -0
  32. webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
  33. webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
  34. webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
  35. webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
  36. webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
  37. webscout/Provider/TTI/__init__.py +3 -4
  38. webscout/Provider/TTI/artbit/__init__.py +22 -0
  39. webscout/Provider/TTI/artbit/async_artbit.py +184 -0
  40. webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
  41. webscout/Provider/TTI/blackbox/__init__.py +4 -0
  42. webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
  43. webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
  44. webscout/Provider/TTI/deepinfra/__init__.py +4 -0
  45. webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
  46. webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
  47. webscout/Provider/TTI/huggingface/__init__.py +22 -0
  48. webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
  49. webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
  50. webscout/Provider/TTI/imgninza/__init__.py +4 -0
  51. webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
  52. webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
  53. webscout/Provider/TTI/talkai/__init__.py +4 -0
  54. webscout/Provider/TTI/talkai/async_talkai.py +229 -0
  55. webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
  56. webscout/Provider/__init__.py +146 -132
  57. webscout/Provider/askmyai.py +158 -0
  58. webscout/Provider/cerebras.py +227 -206
  59. webscout/Provider/geminiapi.py +208 -198
  60. webscout/Provider/llama3mitril.py +180 -0
  61. webscout/Provider/llmchat.py +203 -0
  62. webscout/Provider/mhystical.py +176 -0
  63. webscout/Provider/perplexitylabs.py +265 -0
  64. webscout/Provider/talkai.py +196 -0
  65. webscout/Provider/twitterclone.py +251 -244
  66. webscout/Provider/typegpt.py +359 -0
  67. webscout/__init__.py +28 -23
  68. webscout/__main__.py +5 -5
  69. webscout/cli.py +327 -347
  70. webscout/conversation.py +227 -0
  71. webscout/exceptions.py +161 -29
  72. webscout/litagent/__init__.py +172 -0
  73. webscout/litprinter/__init__.py +831 -0
  74. webscout/optimizers.py +270 -0
  75. webscout/prompt_manager.py +279 -0
  76. webscout/swiftcli/__init__.py +810 -0
  77. webscout/transcriber.py +479 -551
  78. webscout/update_checker.py +125 -0
  79. webscout/version.py +1 -1
  80. webscout-6.4.dist-info/LICENSE.md +211 -0
  81. {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/METADATA +34 -55
  82. webscout-6.4.dist-info/RECORD +154 -0
  83. webscout/Provider/TTI/AIuncensored.py +0 -103
  84. webscout/Provider/TTI/Nexra.py +0 -120
  85. webscout/Provider/TTI/PollinationsAI.py +0 -138
  86. webscout/Provider/TTI/WebSimAI.py +0 -142
  87. webscout/Provider/TTI/aiforce.py +0 -160
  88. webscout/Provider/TTI/artbit.py +0 -141
  89. webscout/Provider/TTI/deepinfra.py +0 -148
  90. webscout/Provider/TTI/huggingface.py +0 -155
  91. webscout/models.py +0 -23
  92. webscout-6.2b0.dist-info/LICENSE.md +0 -50
  93. webscout-6.2b0.dist-info/RECORD +0 -118
  94. /webscout/{g4f.py → gpt4free.py} +0 -0
  95. {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/WHEEL +0 -0
  96. {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/entry_points.txt +0 -0
  97. {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 typing import AsyncGenerator, List, Union, Generator
4
-
5
- class Provider(ABC):
6
- """Base class for text-based AI providers"""
7
-
8
- @abstractmethod
9
- def ask(
10
- self,
11
- prompt: str,
12
- stream: bool = False,
13
- raw: bool = False,
14
- optimizer: str = None,
15
- conversationally: bool = False,
16
- ) -> dict:
17
- """Chat with AI
18
-
19
- Args:
20
- prompt (str): Prompt to be sent
21
- stream (bool, optional): Flag for streaming response. Defaults to False.
22
- raw (bool, optional): Stream back raw response as received
23
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`
24
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
25
- Returns:
26
- dict : {}
27
- ```json
28
- {
29
- "completion": "\nNext: domestic cat breeds with short hair >>",
30
- "stop_reason": null,
31
- "truncated": false,
32
- "stop": null,
33
- "model": "llama-2-13b-chat",
34
- "log_id": "cmpl-3kYiYxSNDvgMShSzFooz6t",
35
- "exception": null
36
- }
37
- ```
38
- """
39
- raise NotImplementedError("Method needs to be implemented in subclass")
40
-
41
- @abstractmethod
42
- def chat(
43
- self,
44
- prompt: str,
45
- stream: bool = False,
46
- optimizer: str = None,
47
- conversationally: bool = False,
48
- ) -> str:
49
- """Generate response `str`
50
- Args:
51
- prompt (str): Prompt to be sent
52
- stream (bool, optional): Flag for streaming response. Defaults to False.
53
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`
54
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
55
- Returns:
56
- str: Response generated
57
- """
58
- raise NotImplementedError("Method needs to be implemented in subclass")
59
-
60
- @abstractmethod
61
- def get_message(self, response: dict) -> str:
62
- """Retrieves message only from response
63
-
64
- Args:
65
- response (dict): Response generated by `self.ask`
66
-
67
- Returns:
68
- str: Message extracted
69
- """
70
- raise NotImplementedError("Method needs to be implemented in subclass")
71
-
72
- class AsyncProvider(ABC):
73
- """Asynchronous base class for text-based AI providers"""
74
-
75
- @abstractmethod
76
- async def ask(
77
- self,
78
- prompt: str,
79
- stream: bool = False,
80
- raw: bool = False,
81
- optimizer: str = None,
82
- conversationally: bool = False,
83
- ) -> dict:
84
- """Asynchronously chat with AI
85
-
86
- Args:
87
- prompt (str): Prompt to be sent
88
- stream (bool, optional): Flag for streaming response. Defaults to False.
89
- raw (bool, optional): Stream back raw response as received
90
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`
91
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
92
- Returns:
93
- dict : {}
94
- ```json
95
- {
96
- "completion": "\nNext: domestic cat breeds with short hair >>",
97
- "stop_reason": null,
98
- "truncated": false,
99
- "stop": null,
100
- "model": "llama-2-13b-chat",
101
- "log_id": "cmpl-3kYiYxSNDvgMShSzFooz6t",
102
- "exception": null
103
- }
104
- ```
105
- """
106
- raise NotImplementedError("Method needs to be implemented in subclass")
107
-
108
- @abstractmethod
109
- async def chat(
110
- self,
111
- prompt: str,
112
- stream: bool = False,
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")