webscout 7.6__py3-none-any.whl → 7.8__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 (124) hide show
  1. webscout/AIutel.py +2 -1
  2. webscout/Bard.py +14 -11
  3. webscout/DWEBS.py +431 -415
  4. webscout/Extra/autocoder/autocoder_utiles.py +183 -47
  5. webscout/Extra/autocoder/rawdog.py +848 -649
  6. webscout/Extra/gguf.py +682 -652
  7. webscout/Provider/AI21.py +1 -1
  8. webscout/Provider/AISEARCH/DeepFind.py +2 -2
  9. webscout/Provider/AISEARCH/ISou.py +2 -23
  10. webscout/Provider/AISEARCH/felo_search.py +6 -6
  11. webscout/Provider/AISEARCH/genspark_search.py +1 -1
  12. webscout/Provider/Aitopia.py +292 -0
  13. webscout/Provider/AllenAI.py +5 -22
  14. webscout/Provider/Andi.py +3 -3
  15. webscout/Provider/C4ai.py +1 -1
  16. webscout/Provider/ChatGPTClone.py +226 -0
  17. webscout/Provider/ChatGPTES.py +3 -5
  18. webscout/Provider/ChatGPTGratis.py +4 -4
  19. webscout/Provider/Chatify.py +2 -2
  20. webscout/Provider/Cloudflare.py +3 -2
  21. webscout/Provider/DARKAI.py +3 -2
  22. webscout/Provider/DeepSeek.py +2 -2
  23. webscout/Provider/Deepinfra.py +1 -1
  24. webscout/Provider/EDITEE.py +1 -1
  25. webscout/Provider/ElectronHub.py +178 -96
  26. webscout/Provider/ExaChat.py +310 -0
  27. webscout/Provider/Free2GPT.py +2 -2
  28. webscout/Provider/Gemini.py +5 -19
  29. webscout/Provider/GithubChat.py +1 -1
  30. webscout/Provider/Glider.py +12 -8
  31. webscout/Provider/Groq.py +3 -3
  32. webscout/Provider/HF_space/qwen_qwen2.py +1 -1
  33. webscout/Provider/HeckAI.py +1 -1
  34. webscout/Provider/HuggingFaceChat.py +1 -1
  35. webscout/Provider/Hunyuan.py +272 -0
  36. webscout/Provider/Jadve.py +3 -3
  37. webscout/Provider/Koboldai.py +3 -3
  38. webscout/Provider/LambdaChat.py +391 -0
  39. webscout/Provider/Llama.py +3 -5
  40. webscout/Provider/Llama3.py +4 -12
  41. webscout/Provider/Marcus.py +3 -3
  42. webscout/Provider/OLLAMA.py +260 -36
  43. webscout/Provider/Openai.py +7 -3
  44. webscout/Provider/PI.py +1 -1
  45. webscout/Provider/Perplexitylabs.py +1 -1
  46. webscout/Provider/Phind.py +1 -1
  47. webscout/Provider/PizzaGPT.py +1 -1
  48. webscout/Provider/QwenLM.py +4 -7
  49. webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +21 -46
  50. webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +37 -49
  51. webscout/Provider/TTI/ImgSys/__init__.py +23 -0
  52. webscout/Provider/TTI/ImgSys/async_imgsys.py +202 -0
  53. webscout/Provider/TTI/ImgSys/sync_imgsys.py +195 -0
  54. webscout/Provider/TTI/__init__.py +3 -1
  55. webscout/Provider/TTI/artbit/async_artbit.py +4 -33
  56. webscout/Provider/TTI/artbit/sync_artbit.py +4 -32
  57. webscout/Provider/TTI/fastflux/async_fastflux.py +6 -2
  58. webscout/Provider/TTI/fastflux/sync_fastflux.py +7 -2
  59. webscout/Provider/TTI/huggingface/async_huggingface.py +1 -1
  60. webscout/Provider/TTI/huggingface/sync_huggingface.py +1 -1
  61. webscout/Provider/TTI/pixelmuse/__init__.py +4 -0
  62. webscout/Provider/TTI/pixelmuse/async_pixelmuse.py +249 -0
  63. webscout/Provider/TTI/pixelmuse/sync_pixelmuse.py +182 -0
  64. webscout/Provider/TTI/talkai/sync_talkai.py +1 -1
  65. webscout/Provider/TTS/utils.py +1 -1
  66. webscout/Provider/TeachAnything.py +1 -1
  67. webscout/Provider/TextPollinationsAI.py +4 -4
  68. webscout/Provider/TwoAI.py +1 -2
  69. webscout/Provider/Venice.py +4 -2
  70. webscout/Provider/VercelAI.py +234 -0
  71. webscout/Provider/WebSim.py +228 -0
  72. webscout/Provider/WiseCat.py +10 -12
  73. webscout/Provider/Youchat.py +1 -1
  74. webscout/Provider/__init__.py +22 -1
  75. webscout/Provider/ai4chat.py +1 -1
  76. webscout/Provider/aimathgpt.py +2 -6
  77. webscout/Provider/akashgpt.py +1 -1
  78. webscout/Provider/askmyai.py +4 -4
  79. webscout/Provider/asksteve.py +203 -0
  80. webscout/Provider/bagoodex.py +2 -2
  81. webscout/Provider/cerebras.py +1 -1
  82. webscout/Provider/chatglm.py +4 -4
  83. webscout/Provider/cleeai.py +1 -0
  84. webscout/Provider/copilot.py +427 -415
  85. webscout/Provider/elmo.py +1 -1
  86. webscout/Provider/flowith.py +14 -3
  87. webscout/Provider/freeaichat.py +57 -31
  88. webscout/Provider/gaurish.py +3 -5
  89. webscout/Provider/geminiprorealtime.py +1 -1
  90. webscout/Provider/granite.py +4 -4
  91. webscout/Provider/hermes.py +5 -5
  92. webscout/Provider/julius.py +1 -1
  93. webscout/Provider/koala.py +1 -1
  94. webscout/Provider/labyrinth.py +239 -0
  95. webscout/Provider/learnfastai.py +28 -15
  96. webscout/Provider/lepton.py +1 -1
  97. webscout/Provider/llama3mitril.py +4 -4
  98. webscout/Provider/llamatutor.py +1 -1
  99. webscout/Provider/llmchat.py +3 -3
  100. webscout/Provider/meta.py +1 -1
  101. webscout/Provider/multichat.py +10 -10
  102. webscout/Provider/promptrefine.py +1 -1
  103. webscout/Provider/searchchat.py +293 -0
  104. webscout/Provider/sonus.py +208 -0
  105. webscout/Provider/talkai.py +2 -2
  106. webscout/Provider/turboseek.py +1 -1
  107. webscout/Provider/tutorai.py +1 -1
  108. webscout/Provider/typegpt.py +6 -43
  109. webscout/Provider/uncovr.py +299 -0
  110. webscout/Provider/x0gpt.py +1 -1
  111. webscout/__init__.py +36 -36
  112. webscout/cli.py +293 -283
  113. webscout/litagent/agent.py +14 -9
  114. webscout/tempid.py +11 -11
  115. webscout/utils.py +2 -2
  116. webscout/version.py +1 -1
  117. webscout/webscout_search.py +1282 -1223
  118. webscout/webscout_search_async.py +813 -692
  119. {webscout-7.6.dist-info → webscout-7.8.dist-info}/METADATA +76 -44
  120. {webscout-7.6.dist-info → webscout-7.8.dist-info}/RECORD +124 -106
  121. {webscout-7.6.dist-info → webscout-7.8.dist-info}/LICENSE.md +0 -0
  122. {webscout-7.6.dist-info → webscout-7.8.dist-info}/WHEEL +0 -0
  123. {webscout-7.6.dist-info → webscout-7.8.dist-info}/entry_points.txt +0 -0
  124. {webscout-7.6.dist-info → webscout-7.8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,226 @@
1
+ import time
2
+ import uuid
3
+ import cloudscraper
4
+ import json
5
+ import re
6
+ from typing import Any, Dict, Optional, Generator, Union
7
+ from dataclasses import dataclass, asdict
8
+ from datetime import date
9
+
10
+ from webscout.AIutel import Optimizers
11
+ from webscout.AIutel import Conversation
12
+ from webscout.AIutel import AwesomePrompts
13
+ from webscout.AIbase import Provider
14
+ from webscout import WEBS, exceptions
15
+ from webscout.litagent import LitAgent
16
+
17
+ class ChatGPTClone(Provider):
18
+ """
19
+ ChatGPTClone is a provider class for interacting with the ChatGPT Clone API.
20
+ Supports streaming responses.
21
+ """
22
+
23
+ url = "https://chatgpt-clone-ten-nu.vercel.app"
24
+ AVAILABLE_MODELS = ["gpt-4", "gpt-3.5-turbo"]
25
+
26
+ def __init__(
27
+ self,
28
+ is_conversation: bool = True,
29
+ max_tokens: int = 2000,
30
+ timeout: int = 60,
31
+ intro: str = None,
32
+ filepath: str = None,
33
+ update_file: bool = True,
34
+ proxies: dict = {},
35
+ history_offset: int = 10250,
36
+ act: str = None,
37
+ model: str = "gpt-4",
38
+ temperature: float = 0.6,
39
+ top_p: float = 0.7,
40
+ browser: str = "chrome",
41
+ system_prompt: str = "You are a helpful assistant."
42
+ ):
43
+ """Initialize the ChatGPT Clone client."""
44
+ if model not in self.AVAILABLE_MODELS:
45
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
46
+
47
+ self.model = model
48
+ self.session = cloudscraper.create_scraper()
49
+ self.is_conversation = is_conversation
50
+ self.max_tokens_to_sample = max_tokens
51
+ self.timeout = timeout
52
+ self.last_response = {}
53
+ self.temperature = temperature
54
+ self.top_p = top_p
55
+ self.system_prompt = system_prompt
56
+
57
+ # Initialize LitAgent for user agent generation
58
+ self.agent = LitAgent()
59
+ # Use fingerprinting to create a consistent browser identity
60
+ self.fingerprint = self.agent.generate_fingerprint(browser)
61
+
62
+ # Use the fingerprint for headers
63
+ self.headers = {
64
+ "Accept": self.fingerprint["accept"],
65
+ "Accept-Encoding": "gzip, deflate, br, zstd",
66
+ "Accept-Language": self.fingerprint["accept_language"],
67
+ "Content-Type": "application/json",
68
+ "DNT": "1",
69
+ "Origin": self.url,
70
+ "Referer": f"{self.url}/",
71
+ "Sec-CH-UA": self.fingerprint["sec_ch_ua"] or '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
72
+ "Sec-CH-UA-Mobile": "?0",
73
+ "Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
74
+ "User-Agent": self.fingerprint["user_agent"],
75
+ }
76
+
77
+ # Create session cookies with unique identifiers
78
+ self.cookies = {"__Host-session": uuid.uuid4().hex, '__cf_bm': uuid.uuid4().hex}
79
+
80
+ self.__available_optimizers = (
81
+ method
82
+ for method in dir(Optimizers)
83
+ if callable(getattr(Optimizers, method))
84
+ and not method.startswith("__")
85
+ )
86
+ Conversation.intro = (
87
+ AwesomePrompts().get_act(act, raise_not_found=True, default=None, case_insensitive=True)
88
+ if act
89
+ else intro or Conversation.intro
90
+ )
91
+ self.conversation = Conversation(
92
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
93
+ )
94
+ self.conversation.history_offset = history_offset
95
+ self.session.proxies = proxies
96
+
97
+ # Set consistent headers for the scraper session
98
+ for header, value in self.headers.items():
99
+ self.session.headers[header] = value
100
+
101
+ def refresh_identity(self, browser: str = None):
102
+ """Refreshes the browser identity fingerprint."""
103
+ browser = browser or self.fingerprint.get("browser_type", "chrome")
104
+ self.fingerprint = self.agent.generate_fingerprint(browser)
105
+
106
+ # Update headers with new fingerprint
107
+ self.headers.update({
108
+ "Accept": self.fingerprint["accept"],
109
+ "Accept-Language": self.fingerprint["accept_language"],
110
+ "Sec-CH-UA": self.fingerprint["sec_ch_ua"] or self.headers["Sec-CH-UA"],
111
+ "Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
112
+ "User-Agent": self.fingerprint["user_agent"],
113
+ })
114
+
115
+ # Update session headers
116
+ for header, value in self.headers.items():
117
+ self.session.headers[header] = value
118
+
119
+ # Generate new cookies
120
+ self.cookies = {"__Host-session": uuid.uuid4().hex, '__cf_bm': uuid.uuid4().hex}
121
+
122
+ return self.fingerprint
123
+
124
+ def ask(
125
+ self,
126
+ prompt: str,
127
+ stream: bool = False,
128
+ raw: bool = False,
129
+ optimizer: str = None,
130
+ conversationally: bool = False,
131
+ ) -> Union[Dict[str, Any], Generator]:
132
+ """Send a message to the ChatGPT Clone API"""
133
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
134
+ if optimizer:
135
+ if optimizer in self.__available_optimizers:
136
+ conversation_prompt = getattr(Optimizers, optimizer)(
137
+ conversation_prompt if conversationally else prompt
138
+ )
139
+ else:
140
+ raise Exception(
141
+ f"Optimizer is not one of {self.__available_optimizers}"
142
+ )
143
+
144
+ payload = {
145
+ "messages": [
146
+ {"role": "system", "content": self.system_prompt},
147
+ {"role": "user", "content": conversation_prompt}
148
+ ],
149
+ "model": self.model
150
+ }
151
+
152
+ def for_stream():
153
+ try:
154
+ with self.session.post(f"{self.url}/api/chat", headers=self.headers, cookies=self.cookies, json=payload, stream=True, timeout=self.timeout) as response:
155
+ if not response.ok:
156
+ # If we get a non-200 response, try refreshing our identity once
157
+ if response.status_code in [403, 429]:
158
+ self.refresh_identity()
159
+ # Retry with new identity
160
+ with self.session.post(f"{self.url}/api/chat", headers=self.headers, cookies=self.cookies, json=payload, stream=True, timeout=self.timeout) as retry_response:
161
+ if not retry_response.ok:
162
+ raise exceptions.FailedToGenerateResponseError(
163
+ f"Failed to generate response after identity refresh - ({retry_response.status_code}, {retry_response.reason}) - {retry_response.text}"
164
+ )
165
+ response = retry_response
166
+ else:
167
+ raise exceptions.FailedToGenerateResponseError(
168
+ f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
169
+ )
170
+
171
+ streaming_text = ""
172
+ for line in response.iter_lines(decode_unicode=True):
173
+ if line:
174
+ match = re.search(r'0:"(.*?)"', line)
175
+ if match:
176
+ content = match.group(1)
177
+ streaming_text += content
178
+ yield content if raw else dict(text=content)
179
+
180
+ self.last_response.update(dict(text=streaming_text))
181
+ self.conversation.update_chat_history(prompt, streaming_text)
182
+ except Exception as e:
183
+ raise exceptions.FailedToGenerateResponseError(f"Request failed: {e}")
184
+
185
+ def for_non_stream():
186
+ for _ in for_stream():
187
+ pass
188
+ return self.last_response
189
+
190
+ return for_stream() if stream else for_non_stream()
191
+
192
+ def chat(
193
+ self,
194
+ prompt: str,
195
+ stream: bool = False,
196
+ optimizer: str = None,
197
+ conversationally: bool = False,
198
+ ) -> Union[str, Generator[str, None, None]]:
199
+ """Generate a response to a prompt"""
200
+ def for_stream():
201
+ for response in self.ask(
202
+ prompt, True, optimizer=optimizer, conversationally=conversationally
203
+ ):
204
+ yield self.get_message(response)
205
+
206
+ def for_non_stream():
207
+ return self.get_message(
208
+ self.ask(
209
+ prompt, False, optimizer=optimizer, conversationally=conversationally
210
+ )
211
+ )
212
+
213
+ return for_stream() if stream else for_non_stream()
214
+
215
+ def get_message(self, response: dict) -> str:
216
+ """Extract message text from response"""
217
+ assert isinstance(response, dict)
218
+ formatted_text = response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
219
+ return formatted_text
220
+
221
+ if __name__ == "__main__":
222
+ from rich import print
223
+ ai = ChatGPTClone(timeout=5000)
224
+ response = ai.chat("write a poem about AI", stream=True)
225
+ for chunk in response:
226
+ print(chunk, end="", flush=True)
@@ -2,12 +2,11 @@ import requests
2
2
  import re
3
3
  import json
4
4
  import os
5
- from typing import List, Dict
5
+ from typing import Union, List, Dict
6
6
  from webscout.AIutel import Optimizers, Conversation, AwesomePrompts
7
7
  from webscout.AIbase import Provider
8
8
  from webscout import exceptions
9
- from rich import print
10
-
9
+ from webscout.litagent import LitAgent
11
10
  class ChatGPTES(Provider):
12
11
  """
13
12
  A class to interact with the ChatGPT.es API.
@@ -47,8 +46,7 @@ class ChatGPTES(Provider):
47
46
  self.system_prompt = system_prompt
48
47
  self.model = model
49
48
  self.initial_headers = {
50
- 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) '
51
- 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
49
+ 'User-Agent': LitAgent().random(),
52
50
  'Referer': 'https://www.google.com/',
53
51
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,'
54
52
  'image/avif,image/webp,image/apng,*/*;q=0.8,'
@@ -1,11 +1,11 @@
1
- from typing import Any, Dict, Generator, Optional
1
+ from typing import Union, Any, Dict, Generator, Optional
2
2
  import requests
3
3
  import json
4
4
 
5
5
  from webscout.AIutel import Optimizers, Conversation, AwesomePrompts
6
6
  from webscout.AIbase import Provider
7
7
  from webscout import exceptions
8
- from webscout import LitAgent as Lit
8
+ from webscout.litagent import LitAgent as Lit
9
9
 
10
10
 
11
11
  class ChatGPTGratis(Provider):
@@ -74,7 +74,7 @@ class ChatGPTGratis(Provider):
74
74
  raw: bool = False,
75
75
  optimizer: Optional[str] = None,
76
76
  conversationally: bool = False,
77
- ) -> Dict[str, Any] | Generator[Dict[str, Any], None, None]:
77
+ ) -> Union[Dict[str, Any], Generator[Any, None, None]]:
78
78
  """
79
79
  Sends a request to the API and returns the response.
80
80
  If stream is True, yields response chunks as they are received.
@@ -144,7 +144,7 @@ class ChatGPTGratis(Provider):
144
144
  stream: bool = False,
145
145
  optimizer: Optional[str] = None,
146
146
  conversationally: bool = False,
147
- ) -> str | Generator[str, None, None]:
147
+ ) -> Union[str, Generator[str, None, None]]:
148
148
  """
149
149
  Returns the response as a string.
150
150
  For streaming requests, yields each response chunk as a string.
@@ -4,7 +4,7 @@ from webscout.AIutel import AwesomePrompts
4
4
  from webscout.AIbase import Provider
5
5
  from webscout import exceptions
6
6
  import requests
7
-
7
+ from webscout.litagent import LitAgent
8
8
  class Chatify(Provider):
9
9
  """
10
10
  A class to interact with the Chatify AI API.
@@ -46,7 +46,7 @@ class Chatify(Provider):
46
46
  'Sec-Fetch-Dest': 'empty',
47
47
  'Sec-Fetch-Mode': 'cors',
48
48
  'Sec-Fetch-Site': 'same-origin',
49
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0',
49
+ 'User-Agent': LitAgent().random(),
50
50
  }
51
51
 
52
52
  self.__available_optimizers = (
@@ -6,9 +6,9 @@ from webscout.AIutel import Conversation
6
6
  from webscout.AIutel import AwesomePrompts, sanitize_stream
7
7
  from webscout.AIbase import Provider, AsyncProvider
8
8
  from webscout import exceptions
9
- from typing import Any, AsyncGenerator, Dict
9
+ from typing import Union, Any, AsyncGenerator, Dict
10
10
  import cloudscraper
11
- from webscout import LitAgent
11
+ from webscout.litagent import LitAgent
12
12
 
13
13
  class Cloudflare(Provider):
14
14
  """
@@ -37,6 +37,7 @@ class Cloudflare(Provider):
37
37
  "@cf/meta/llama-3.2-1b-instruct",
38
38
  "@cf/meta/llama-3.2-3b-instruct",
39
39
  "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
40
+ "@cf/meta/llama-guard-3-8b",
40
41
  "@hf/thebloke/llamaguard-7b-awq",
41
42
  "@hf/meta-llama/meta-llama-3-8b-instruct",
42
43
  "@cf/mistral/mistral-7b-instruct-v0.1",
@@ -1,10 +1,11 @@
1
1
  import json
2
- from typing import Any, Dict, Optional
2
+ from typing import Union, Any, Dict, Optional
3
3
  from webscout.AIutel import Optimizers
4
4
  from webscout.AIutel import Conversation
5
5
  from webscout.AIutel import AwesomePrompts, sanitize_stream
6
6
  from webscout.AIbase import Provider
7
- from webscout import exceptions, LitAgent
7
+ from webscout import exceptions
8
+ from webscout.litagent import LitAgent
8
9
  import requests
9
10
 
10
11
  class DARKAI(Provider):
@@ -1,12 +1,12 @@
1
1
  import requests
2
2
  import json
3
- from typing import Any, Dict, Generator
3
+ from typing import Union, Any, Dict, Generator
4
4
  from webscout.AIutel import Optimizers
5
5
  from webscout.AIutel import Conversation
6
6
  from webscout.AIutel import AwesomePrompts
7
7
  from webscout.AIbase import Provider
8
8
  from webscout import exceptions
9
- from webscout import LitAgent as Lit
9
+ from webscout.litagent import LitAgent as Lit
10
10
 
11
11
  class DeepSeek(Provider):
12
12
  """
@@ -8,7 +8,7 @@ from webscout.AIutel import Conversation
8
8
  from webscout.AIutel import AwesomePrompts, sanitize_stream
9
9
  from webscout.AIbase import Provider, AsyncProvider
10
10
  from webscout import exceptions
11
- from webscout import LitAgent
11
+ from webscout.litagent import LitAgent
12
12
 
13
13
  class DeepInfra(Provider):
14
14
  """
@@ -4,7 +4,7 @@ from webscout.AIutel import Conversation
4
4
  from webscout.AIutel import AwesomePrompts, sanitize_stream
5
5
  from webscout.AIbase import Provider, AsyncProvider
6
6
  from webscout import exceptions
7
- from typing import Any, AsyncGenerator, Dict
7
+ from typing import Union, Any, AsyncGenerator, Dict
8
8
 
9
9
 
10
10
  class Editee(Provider):