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
@@ -0,0 +1,359 @@
1
+ import requests
2
+ import json
3
+ from typing import *
4
+
5
+ from webscout.AIutel import Optimizers
6
+ from webscout.AIutel import Conversation
7
+ from webscout.AIutel import AwesomePrompts
8
+ from webscout.AIbase import Provider
9
+ from webscout import exceptions
10
+
11
+ class TypeGPT(Provider):
12
+ """
13
+ A class to interact with the TypeGPT.net API. Improved to match webscout standards.
14
+ """
15
+ url = "https://chat.typegpt.net"
16
+ working = True
17
+ supports_message_history = True
18
+
19
+ models = [
20
+ # OpenAI Models
21
+ "gpt-3.5-turbo",
22
+ "gpt-3.5-turbo-202201",
23
+ "gpt-4o",
24
+ "gpt-4o-2024-05-13",
25
+ "o1-preview",
26
+
27
+ # Claude Models
28
+ "claude",
29
+ "claude-3-5-sonnet",
30
+ "claude-sonnet-3.5",
31
+ "claude-3-5-sonnet-20240620",
32
+
33
+ # Meta/LLaMA Models
34
+ "@cf/meta/llama-2-7b-chat-fp16",
35
+ "@cf/meta/llama-2-7b-chat-int8",
36
+ "@cf/meta/llama-3-8b-instruct",
37
+ "@cf/meta/llama-3.1-8b-instruct",
38
+ "@cf/meta-llama/llama-2-7b-chat-hf-lora",
39
+ "llama-3.1-405b",
40
+ "llama-3.1-70b",
41
+ "llama-3.1-8b",
42
+ "meta-llama/Llama-2-7b-chat-hf",
43
+ "meta-llama/Llama-3.1-70B-Instruct",
44
+ "meta-llama/Llama-3.1-8B-Instruct",
45
+ "meta-llama/Llama-3.2-11B-Vision-Instruct",
46
+ "meta-llama/Llama-3.2-1B-Instruct",
47
+ "meta-llama/Llama-3.2-3B-Instruct",
48
+ "meta-llama/Llama-3.2-90B-Vision-Instruct",
49
+ "meta-llama/Llama-Guard-3-8B",
50
+ "meta-llama/Meta-Llama-3-70B-Instruct",
51
+ "meta-llama/Meta-Llama-3-8B-Instruct",
52
+ "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
53
+ "meta-llama/Meta-Llama-3.1-8B-Instruct",
54
+ "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
55
+
56
+ # Mistral Models
57
+ "mistral",
58
+ "mistral-large",
59
+ "@cf/mistral/mistral-7b-instruct-v0.1",
60
+ "@cf/mistral/mistral-7b-instruct-v0.2-lora",
61
+ "@hf/mistralai/mistral-7b-instruct-v0.2",
62
+ "mistralai/Mistral-7B-Instruct-v0.2",
63
+ "mistralai/Mistral-7B-Instruct-v0.3",
64
+ "mistralai/Mixtral-8x22B-Instruct-v0.1",
65
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
66
+
67
+ # Qwen Models
68
+ "@cf/qwen/qwen1.5-0.5b-chat",
69
+ "@cf/qwen/qwen1.5-1.8b-chat",
70
+ "@cf/qwen/qwen1.5-7b-chat-awq",
71
+ "@cf/qwen/qwen1.5-14b-chat-awq",
72
+ "Qwen/Qwen2.5-3B-Instruct",
73
+ "Qwen/Qwen2.5-72B-Instruct",
74
+ "Qwen/Qwen2.5-Coder-32B-Instruct",
75
+
76
+ # Google/Gemini Models
77
+ "@cf/google/gemma-2b-it-lora",
78
+ "@cf/google/gemma-7b-it-lora",
79
+ "@hf/google/gemma-7b-it",
80
+ "google/gemma-1.1-2b-it",
81
+ "google/gemma-1.1-7b-it",
82
+ "gemini-pro",
83
+ "gemini-1.5-pro",
84
+ "gemini-1.5-pro-latest",
85
+ "gemini-1.5-flash",
86
+
87
+ # Cohere Models
88
+ "c4ai-aya-23-35b",
89
+ "c4ai-aya-23-8b",
90
+ "command",
91
+ "command-light",
92
+ "command-light-nightly",
93
+ "command-nightly",
94
+ "command-r",
95
+ "command-r-08-2024",
96
+ "command-r-plus",
97
+ "command-r-plus-08-2024",
98
+ "rerank-english-v2.0",
99
+ "rerank-english-v3.0",
100
+ "rerank-multilingual-v2.0",
101
+ "rerank-multilingual-v3.0",
102
+
103
+ # Microsoft Models
104
+ "@cf/microsoft/phi-2",
105
+ "microsoft/DialoGPT-medium",
106
+ "microsoft/Phi-3-medium-4k-instruct",
107
+ "microsoft/Phi-3-mini-4k-instruct",
108
+ "microsoft/Phi-3.5-mini-instruct",
109
+ "microsoft/WizardLM-2-8x22B",
110
+
111
+ # Yi Models
112
+ "01-ai/Yi-1.5-34B-Chat",
113
+ "01-ai/Yi-34B-Chat",
114
+
115
+ # Specialized Models and Tools
116
+ "@cf/deepseek-ai/deepseek-math-7b-base",
117
+ "@cf/deepseek-ai/deepseek-math-7b-instruct",
118
+ "@cf/defog/sqlcoder-7b-2",
119
+ "@cf/openchat/openchat-3.5-0106",
120
+ "@cf/thebloke/discolm-german-7b-v1-awq",
121
+ "@cf/tiiuae/falcon-7b-instruct",
122
+ "@cf/tinyllama/tinyllama-1.1b-chat-v1.0",
123
+ "@hf/nexusflow/starling-lm-7b-beta",
124
+ "@hf/nousresearch/hermes-2-pro-mistral-7b",
125
+ "@hf/thebloke/deepseek-coder-6.7b-base-awq",
126
+ "@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
127
+ "@hf/thebloke/llama-2-13b-chat-awq",
128
+ "@hf/thebloke/llamaguard-7b-awq",
129
+ "@hf/thebloke/neural-chat-7b-v3-1-awq",
130
+ "@hf/thebloke/openhermes-2.5-mistral-7b-awq",
131
+ "@hf/thebloke/zephyr-7b-beta-awq",
132
+ "AndroidDeveloper",
133
+ "AngularJSAgent",
134
+ "AzureAgent",
135
+ "BitbucketAgent",
136
+ "DigitalOceanAgent",
137
+ "DockerAgent",
138
+ "ElectronAgent",
139
+ "ErlangAgent",
140
+ "FastAPIAgent",
141
+ "FirebaseAgent",
142
+ "FlaskAgent",
143
+ "FlutterAgent",
144
+ "GitAgent",
145
+ "GitlabAgent",
146
+ "GoAgent",
147
+ "GodotAgent",
148
+ "GoogleCloudAgent",
149
+ "HTMLAgent",
150
+ "HerokuAgent",
151
+ "ImageGeneration",
152
+ "JavaAgent",
153
+ "JavaScriptAgent",
154
+ "MongoDBAgent",
155
+ "Next.jsAgent",
156
+ "PyTorchAgent",
157
+ "PythonAgent",
158
+ "ReactAgent",
159
+ "RepoMap",
160
+ "SwiftDeveloper",
161
+ "XcodeAgent",
162
+ "YoutubeAgent",
163
+ "blackboxai",
164
+ "blackboxai-pro",
165
+ "builderAgent",
166
+ "dify",
167
+ "flux",
168
+ "openchat/openchat-3.6-8b",
169
+ "rtist",
170
+ "searchgpt",
171
+ "sur",
172
+ "sur-mistral",
173
+ "unity"
174
+ ]
175
+
176
+ def __init__(
177
+ self,
178
+ is_conversation: bool = True,
179
+ max_tokens: int = 4000, # Set a reasonable default
180
+ timeout: int = 30,
181
+ intro: str = None,
182
+ filepath: str = None,
183
+ update_file: bool = True,
184
+ proxies: dict = {},
185
+ history_offset: int = 10250,
186
+ act: str = None,
187
+ model: str = "claude-3-5-sonnet-20240620",
188
+ system_prompt: str = "You are a helpful assistant.",
189
+ temperature: float = 0.5,
190
+ presence_penalty: int = 0,
191
+ frequency_penalty: int = 0,
192
+ top_p: float = 1,
193
+ ):
194
+ """Initializes the TypeGPT API client."""
195
+ if model not in self.models:
196
+ raise ValueError(f"Invalid model: {model}. Choose from: {', '.join(self.models)}")
197
+
198
+ self.session = requests.Session()
199
+ self.is_conversation = is_conversation
200
+ self.max_tokens_to_sample = max_tokens
201
+ self.api_endpoint = "https://chat.typegpt.net/api/openai/v1/chat/completions"
202
+ self.timeout = timeout
203
+ self.last_response = {}
204
+ self.model = model
205
+ self.system_prompt = system_prompt
206
+ self.temperature = temperature
207
+ self.presence_penalty = presence_penalty
208
+ self.frequency_penalty = frequency_penalty
209
+ self.top_p = top_p
210
+
211
+ self.headers = {
212
+ "authority": "chat.typegpt.net",
213
+ "accept": "application/json, text/event-stream",
214
+ "accept-language": "en-US,en;q=0.9",
215
+ "content-type": "application/json",
216
+ "origin": "https://chat.typegpt.net",
217
+ "referer": "https://chat.typegpt.net/",
218
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
219
+ }
220
+
221
+
222
+ self.__available_optimizers = (
223
+ method
224
+ for method in dir(Optimizers)
225
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
226
+ )
227
+ Conversation.intro = (
228
+ AwesomePrompts().get_act(
229
+ act, raise_not_found=True, default=None, case_insensitive=True
230
+ )
231
+ if act
232
+ else intro or Conversation.intro
233
+ )
234
+ self.conversation = Conversation(
235
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
236
+ )
237
+ self.conversation.history_offset = history_offset
238
+ self.session.proxies = proxies
239
+
240
+ def ask(
241
+ self,
242
+ prompt: str,
243
+ stream: bool = False,
244
+ raw: bool = False,
245
+ optimizer: str = None,
246
+ conversationally: bool = False,
247
+ ) -> Dict[str, Any] | Generator:
248
+ """Sends a prompt to the TypeGPT.net API and returns the response."""
249
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
250
+ if optimizer:
251
+ if optimizer in self.__available_optimizers:
252
+ conversation_prompt = getattr(Optimizers, optimizer)(
253
+ conversation_prompt if conversationally else prompt
254
+ )
255
+ else:
256
+ raise exceptions.FailedToGenerateResponseError(
257
+ f"Optimizer is not one of {self.__available_optimizers}"
258
+ )
259
+
260
+
261
+ payload = {
262
+ "messages": [
263
+ {"role": "system", "content": self.system_prompt},
264
+ {"role": "user", "content": conversation_prompt}
265
+ ],
266
+ "stream": stream,
267
+ "model": self.model,
268
+ "temperature": self.temperature,
269
+ "presence_penalty": self.presence_penalty,
270
+ "frequency_penalty": self.frequency_penalty,
271
+ "top_p": self.top_p,
272
+ "max_tokens": self.max_tokens_to_sample,
273
+ }
274
+ def for_stream():
275
+ response = self.session.post(
276
+ self.api_endpoint, headers=self.headers, json=payload, stream=True, timeout=self.timeout
277
+ )
278
+ if not response.ok:
279
+ raise exceptions.FailedToGenerateResponseError(
280
+ f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
281
+ )
282
+ message_load = ""
283
+ for line in response.iter_lines():
284
+ if line:
285
+ line = line.decode("utf-8")
286
+ if line.startswith("data: "):
287
+ line = line[6:] # Remove "data: " prefix
288
+ # Skip [DONE] message
289
+ if line.strip() == "[DONE]":
290
+ break
291
+
292
+ try:
293
+ data = json.loads(line)
294
+
295
+ # Extract and yield only new content
296
+ if 'choices' in data and len(data['choices']) > 0:
297
+ delta = data['choices'][0].get('delta', {})
298
+ if 'content' in delta:
299
+ new_content = delta['content']
300
+ message_load += new_content
301
+ # Yield only the new content
302
+ yield dict(text=new_content) if not raw else new_content
303
+ self.last_response = dict(text=message_load)
304
+
305
+ except json.JSONDecodeError:
306
+ continue
307
+ self.conversation.update_chat_history(prompt, self.get_message(self.last_response))
308
+
309
+ def for_non_stream():
310
+
311
+ response = self.session.post(self.api_endpoint, headers=self.headers, json=payload)
312
+ if not response.ok:
313
+ raise exceptions.FailedToGenerateResponseError(
314
+ f"Request failed - {response.status_code}: {response.text}"
315
+ )
316
+ self.last_response = response.json()
317
+ self.conversation.update_chat_history(prompt, self.get_message(self.last_response))
318
+ return self.last_response
319
+
320
+
321
+ return for_stream() if stream else for_non_stream()
322
+
323
+
324
+ def chat(
325
+ self,
326
+ prompt: str,
327
+ stream: bool = False,
328
+ optimizer: str = None,
329
+ conversationally: bool = False,
330
+ ) -> str | Generator[str, None, None]:
331
+ """Generate response `str` or stream."""
332
+
333
+ if stream:
334
+ gen = self.ask(
335
+ prompt, stream=True, optimizer=optimizer, conversationally=conversationally
336
+ )
337
+ for chunk in gen:
338
+ yield self.get_message(chunk) # Extract text from streamed chunks
339
+ else:
340
+ return self.get_message(self.ask(prompt, stream=False, optimizer=optimizer, conversationally=conversationally))
341
+
342
+ def get_message(self, response: Dict[str, Any]) -> str:
343
+ """Retrieves message from response."""
344
+ if isinstance(response, str): #Handle raw responses
345
+ return response
346
+ elif isinstance(response, dict):
347
+ assert isinstance(response, dict), "Response should be of dict data-type only"
348
+ return response.get("text", "") #Extract text from dictionary response
349
+ else:
350
+ raise TypeError("Invalid response type. Expected str or dict.")
351
+
352
+
353
+ if __name__ == "__main__":
354
+ from webscout import print
355
+
356
+ ai = TypeGPT()
357
+ response = ai.chat(input(">>> "), stream=True)
358
+ for chunks in response:
359
+ print(chunks, end="", flush=True)
webscout/__init__.py CHANGED
@@ -1,23 +1,28 @@
1
- from .webscout_search import WEBS
2
- from .webscout_search_async import AsyncWEBS
3
- from .version import __version__
4
- from .DWEBS import *
5
- from .transcriber import *
6
- from .requestsHTMLfix import *
7
- from .tempid import *
8
- from .LLM import VLM, LLM
9
- from .YTdownloader import *
10
- from .Bing_search import *
11
- from .YTdownloader import *
12
- from .Provider import *
13
- from .Provider.TTI import *
14
- from .Provider.TTS import *
15
- from .Extra import *
16
-
17
- from .Agents import *
18
-
19
- __repo__ = "https://github.com/OE-LUCIFER/Webscout"
20
-
21
-
22
- import logging
23
- logging.getLogger("webscout").addHandler(logging.NullHandler())
1
+ from .webscout_search import WEBS
2
+ from .webscout_search_async import AsyncWEBS
3
+ from .version import __version__
4
+ from .DWEBS import *
5
+ from .transcriber import *
6
+ from .requestsHTMLfix import *
7
+ from .tempid import *
8
+ from .LLM import VLM, LLM
9
+ from .YTdownloader import *
10
+ from .Bing_search import *
11
+ from .YTdownloader import *
12
+ from .Provider import *
13
+ from .Provider.TTI import *
14
+ from .Provider.TTS import *
15
+ from .Extra import *
16
+ from .Litlogger import *
17
+ from .Agents import *
18
+ from .optimizers import *
19
+ from .litprinter import *
20
+ from .swiftcli import *
21
+ from .litagent import LitAgent
22
+
23
+ agent = LitAgent()
24
+
25
+ __repo__ = "https://github.com/OE-LUCIFER/Webscout"
26
+
27
+ import logging
28
+ logging.getLogger("webscout").addHandler(logging.NullHandler())
webscout/__main__.py CHANGED
@@ -1,5 +1,5 @@
1
- """For using as 'python3 -m webscout'."""
2
- from .cli import cli
3
-
4
- if __name__ == "__main__":
5
- cli(prog_name="webscout")
1
+ """For using as 'python3 -m webscout'."""
2
+ from .cli import main
3
+
4
+ if __name__ == "__main__":
5
+ main()