webscout 7.8__py3-none-any.whl → 8.0__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 (66) hide show
  1. webscout/Bard.py +5 -25
  2. webscout/DWEBS.py +476 -476
  3. webscout/Extra/GitToolkit/__init__.py +10 -0
  4. webscout/Extra/GitToolkit/gitapi/__init__.py +12 -0
  5. webscout/Extra/GitToolkit/gitapi/repository.py +195 -0
  6. webscout/Extra/GitToolkit/gitapi/user.py +96 -0
  7. webscout/Extra/GitToolkit/gitapi/utils.py +62 -0
  8. webscout/Extra/YTToolkit/ytapi/video.py +232 -103
  9. webscout/Extra/__init__.py +2 -0
  10. webscout/Extra/autocoder/__init__.py +1 -1
  11. webscout/Extra/autocoder/{rawdog.py → autocoder.py} +849 -849
  12. webscout/Extra/tempmail/__init__.py +26 -0
  13. webscout/Extra/tempmail/async_utils.py +141 -0
  14. webscout/Extra/tempmail/base.py +156 -0
  15. webscout/Extra/tempmail/cli.py +187 -0
  16. webscout/Extra/tempmail/mail_tm.py +361 -0
  17. webscout/Extra/tempmail/temp_mail_io.py +292 -0
  18. webscout/Provider/AISEARCH/__init__.py +5 -1
  19. webscout/Provider/AISEARCH/hika_search.py +194 -0
  20. webscout/Provider/AISEARCH/monica_search.py +246 -0
  21. webscout/Provider/AISEARCH/scira_search.py +320 -0
  22. webscout/Provider/AISEARCH/webpilotai_search.py +281 -0
  23. webscout/Provider/AllenAI.py +255 -122
  24. webscout/Provider/DeepSeek.py +1 -2
  25. webscout/Provider/Deepinfra.py +296 -286
  26. webscout/Provider/ElectronHub.py +709 -716
  27. webscout/Provider/ExaAI.py +261 -0
  28. webscout/Provider/ExaChat.py +28 -6
  29. webscout/Provider/Gemini.py +167 -165
  30. webscout/Provider/GithubChat.py +2 -1
  31. webscout/Provider/Groq.py +38 -24
  32. webscout/Provider/LambdaChat.py +2 -1
  33. webscout/Provider/Netwrck.py +3 -2
  34. webscout/Provider/OpenGPT.py +199 -0
  35. webscout/Provider/PI.py +39 -24
  36. webscout/Provider/TextPollinationsAI.py +232 -230
  37. webscout/Provider/Youchat.py +326 -296
  38. webscout/Provider/__init__.py +10 -4
  39. webscout/Provider/ai4chat.py +58 -56
  40. webscout/Provider/akashgpt.py +34 -22
  41. webscout/Provider/copilot.py +427 -427
  42. webscout/Provider/freeaichat.py +9 -2
  43. webscout/Provider/labyrinth.py +121 -20
  44. webscout/Provider/llmchatco.py +306 -0
  45. webscout/Provider/scira_chat.py +271 -0
  46. webscout/Provider/typefully.py +280 -0
  47. webscout/Provider/uncovr.py +312 -299
  48. webscout/Provider/yep.py +64 -12
  49. webscout/__init__.py +38 -36
  50. webscout/cli.py +293 -293
  51. webscout/conversation.py +350 -17
  52. webscout/litprinter/__init__.py +59 -667
  53. webscout/optimizers.py +419 -419
  54. webscout/update_checker.py +14 -12
  55. webscout/version.py +1 -1
  56. webscout/webscout_search.py +1346 -1282
  57. webscout/webscout_search_async.py +877 -813
  58. {webscout-7.8.dist-info → webscout-8.0.dist-info}/METADATA +44 -39
  59. {webscout-7.8.dist-info → webscout-8.0.dist-info}/RECORD +63 -46
  60. webscout/Provider/DARKAI.py +0 -225
  61. webscout/Provider/EDITEE.py +0 -192
  62. webscout/litprinter/colors.py +0 -54
  63. {webscout-7.8.dist-info → webscout-8.0.dist-info}/LICENSE.md +0 -0
  64. {webscout-7.8.dist-info → webscout-8.0.dist-info}/WHEEL +0 -0
  65. {webscout-7.8.dist-info → webscout-8.0.dist-info}/entry_points.txt +0 -0
  66. {webscout-7.8.dist-info → webscout-8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,261 @@
1
+ from typing import Union, Any, Dict, Generator
2
+ from uuid import uuid4
3
+ import requests
4
+ import json
5
+ import re
6
+
7
+ from webscout.AIutel import Optimizers
8
+ from webscout.AIutel import Conversation
9
+ from webscout.AIutel import AwesomePrompts
10
+ from webscout.AIbase import Provider
11
+ from webscout import exceptions
12
+ from webscout.litagent import LitAgent
13
+
14
+ class ExaAI(Provider):
15
+ """
16
+ A class to interact with the o3minichat.exa.ai API.
17
+
18
+ Attributes:
19
+ system_prompt (str): The system prompt to define the assistant's role.
20
+
21
+ Examples:
22
+ >>> from webscout.Provider.ExaAI import ExaAI
23
+ >>> ai = ExaAI()
24
+ >>> response = ai.chat("What's the weather today?")
25
+ >>> print(response)
26
+ 'The weather today depends on your location...'
27
+ """
28
+ AVAILABLE_MODELS = ["O3-Mini"]
29
+
30
+ def __init__(
31
+ self,
32
+ is_conversation: bool = True,
33
+ max_tokens: int = 600,
34
+ timeout: int = 30,
35
+ intro: str = None,
36
+ filepath: str = None,
37
+ update_file: bool = True,
38
+ proxies: dict = {},
39
+ history_offset: int = 10250,
40
+ act: str = None,
41
+ # system_prompt: str = "You are a helpful assistant.",
42
+ model: str = "O3-Mini", # >>> THIS FLAG IS NOT USED <<<
43
+ ):
44
+ """
45
+ Initializes the ExaAI API with given parameters.
46
+
47
+ Args:
48
+ is_conversation (bool): Whether the provider is in conversation mode.
49
+ max_tokens (int): Maximum number of tokens to sample.
50
+ timeout (int): Timeout for API requests.
51
+ intro (str): Introduction message for the conversation.
52
+ filepath (str): Filepath for storing conversation history.
53
+ update_file (bool): Whether to update the conversation history file.
54
+ proxies (dict): Proxies for the API requests.
55
+ history_offset (int): Offset for conversation history.
56
+ act (str): Act for the conversation.
57
+ system_prompt (str): The system prompt to define the assistant's role.
58
+
59
+ Examples:
60
+ >>> ai = ExaAI(system_prompt="You are a friendly assistant.")
61
+ >>> print(ai.system_prompt)
62
+ 'You are a friendly assistant.'
63
+ """
64
+ self.session = requests.Session()
65
+ self.is_conversation = is_conversation
66
+ self.max_tokens_to_sample = max_tokens
67
+ self.api_endpoint = "https://o3minichat.exa.ai/api/chat"
68
+ self.timeout = timeout
69
+ self.last_response = {}
70
+ # self.system_prompt = system_prompt
71
+
72
+ # Initialize LitAgent for user agent generation
73
+ self.agent = LitAgent()
74
+
75
+ self.headers = {
76
+ "authority": "o3minichat.exa.ai",
77
+ "accept": "*/*",
78
+ "accept-encoding": "gzip, deflate, br, zstd",
79
+ "accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
80
+ "content-type": "application/json",
81
+ "dnt": "1",
82
+ "origin": "https://o3minichat.exa.ai",
83
+ "priority": "u=1, i",
84
+ "referer": "https://o3minichat.exa.ai/",
85
+ "sec-ch-ua": '"Microsoft Edge";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
86
+ "sec-ch-ua-mobile": "?0",
87
+ "sec-ch-ua-platform": '"Windows"',
88
+ "sec-fetch-dest": "empty",
89
+ "sec-fetch-mode": "cors",
90
+ "sec-fetch-site": "same-origin",
91
+ "sec-gpc": "1",
92
+ "user-agent": self.agent.random() # Use LitAgent to generate a random user agent
93
+ }
94
+
95
+ self.__available_optimizers = (
96
+ method
97
+ for method in dir(Optimizers)
98
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
99
+ )
100
+ self.session.headers.update(self.headers)
101
+ Conversation.intro = (
102
+ AwesomePrompts().get_act(
103
+ act, raise_not_found=True, default=None, case_insensitive=True
104
+ )
105
+ if act
106
+ else intro or Conversation.intro
107
+ )
108
+ self.conversation = Conversation(
109
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
110
+ )
111
+ self.conversation.history_offset = history_offset
112
+ self.session.proxies = proxies
113
+
114
+ def ask(
115
+ self,
116
+ prompt: str,
117
+ stream: bool = False,
118
+ raw: bool = False,
119
+ optimizer: str = None,
120
+ conversationally: bool = False,
121
+ ) -> Dict[str, Any]:
122
+ """
123
+ Sends a prompt to the o3minichat.exa.ai API and returns the response.
124
+
125
+ Args:
126
+ prompt (str): The prompt to send to the API.
127
+ stream (bool): Whether to stream the response.
128
+ raw (bool): Whether to return the raw response.
129
+ optimizer (str): Optimizer to use for the prompt.
130
+ conversationally (bool): Whether to generate the prompt conversationally.
131
+
132
+ Returns:
133
+ Dict[str, Any]: The API response.
134
+
135
+ Examples:
136
+ >>> ai = ExaAI()
137
+ >>> response = ai.ask("Tell me a joke!")
138
+ >>> print(response)
139
+ {'text': 'Why did the scarecrow win an award? Because he was outstanding in his field!'}
140
+ """
141
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
142
+ if optimizer:
143
+ if optimizer in self.__available_optimizers:
144
+ conversation_prompt = getattr(Optimizers, optimizer)(
145
+ conversation_prompt if conversationally else prompt
146
+ )
147
+ else:
148
+ raise Exception(
149
+ f"Optimizer is not one of {self.__available_optimizers}"
150
+ )
151
+
152
+ # Generate a unique ID for the conversation
153
+ conversation_id = uuid4().hex[:16]
154
+
155
+ payload = {
156
+ "id": conversation_id,
157
+ "messages": [
158
+ # {"role": "system", "content": self.system_prompt},
159
+ {"role": "user", "content": conversation_prompt}
160
+ ]
161
+ }
162
+
163
+ def for_stream():
164
+ response = self.session.post(self.api_endpoint, headers=self.headers, json=payload, stream=True, timeout=self.timeout)
165
+ if not response.ok:
166
+ raise exceptions.FailedToGenerateResponseError(
167
+ f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
168
+ )
169
+
170
+ streaming_response = ""
171
+ for line in response.iter_lines(decode_unicode=True):
172
+ if line:
173
+ match = re.search(r'0:"(.*?)"', line)
174
+ if match:
175
+ content = match.group(1)
176
+ streaming_response += content
177
+ yield content if raw else dict(text=content)
178
+
179
+ self.last_response.update(dict(text=streaming_response))
180
+ self.conversation.update_chat_history(
181
+ prompt, self.get_message(self.last_response)
182
+ )
183
+
184
+ def for_non_stream():
185
+ for _ in for_stream():
186
+ pass
187
+ return self.last_response
188
+
189
+ return for_stream() if stream else for_non_stream()
190
+
191
+ def chat(
192
+ self,
193
+ prompt: str,
194
+ stream: bool = False,
195
+ optimizer: str = None,
196
+ conversationally: bool = False,
197
+ ) -> Union[str, Generator[str, None, None]]:
198
+ """
199
+ Generates a response from the ExaAI API.
200
+
201
+ Args:
202
+ prompt (str): The prompt to send to the API.
203
+ stream (bool): Whether to stream the response.
204
+ optimizer (str): Optimizer to use for the prompt.
205
+ conversationally (bool): Whether to generate the prompt conversationally.
206
+
207
+ Returns:
208
+ Union[str, Generator[str, None, None]]: The API response as a string or a generator of string chunks.
209
+
210
+ Examples:
211
+ >>> ai = ExaAI()
212
+ >>> response = ai.chat("What's the weather today?")
213
+ >>> print(response)
214
+ 'The weather today depends on your location...'
215
+ """
216
+
217
+ def for_stream():
218
+ for response in self.ask(
219
+ prompt, True, optimizer=optimizer, conversationally=conversationally
220
+ ):
221
+ yield self.get_message(response)
222
+
223
+ def for_non_stream():
224
+ return self.get_message(
225
+ self.ask(
226
+ prompt,
227
+ False,
228
+ optimizer=optimizer,
229
+ conversationally=conversationally,
230
+ )
231
+ )
232
+
233
+ return for_stream() if stream else for_non_stream()
234
+
235
+ def get_message(self, response: dict) -> str:
236
+ """
237
+ Extracts the message from the API response.
238
+
239
+ Args:
240
+ response (dict): The API response.
241
+
242
+ Returns:
243
+ str: The message content.
244
+
245
+ Examples:
246
+ >>> ai = ExaAI()
247
+ >>> response = ai.ask("Tell me a joke!")
248
+ >>> message = ai.get_message(response)
249
+ >>> print(message)
250
+ 'Why did the scarecrow win an award? Because he was outstanding in his field!'
251
+ """
252
+ assert isinstance(response, dict), "Response should be of dict data-type only"
253
+ formatted_text = response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
254
+ return formatted_text
255
+
256
+ if __name__ == "__main__":
257
+ from rich import print
258
+ ai = ExaAI(timeout=5000)
259
+ response = ai.chat("Tell me about HelpingAI", stream=True)
260
+ for chunk in response:
261
+ print(chunk, end="", flush=True)
@@ -18,9 +18,11 @@ MODEL_CONFIGS = {
18
18
  "endpoint": "https://exa-chat.vercel.app/api/gemini",
19
19
  "models": [
20
20
  "gemini-2.0-flash",
21
+ "gemini-2.0-flash-exp-image-generation",
21
22
  "gemini-2.0-flash-thinking-exp-01-21",
22
23
  "gemini-2.5-pro-exp-03-25",
23
24
  "gemini-2.0-pro-exp-02-05",
25
+
24
26
  ],
25
27
  },
26
28
  "openrouter": {
@@ -30,6 +32,7 @@ MODEL_CONFIGS = {
30
32
  "deepseek/deepseek-r1:free",
31
33
  "deepseek/deepseek-chat-v3-0324:free",
32
34
  "google/gemma-3-27b-it:free",
35
+ "meta-llama/llama-4-maverick:free",
33
36
  ],
34
37
  },
35
38
  "groq": {
@@ -48,7 +51,15 @@ MODEL_CONFIGS = {
48
51
  "llama3-8b-8192",
49
52
  "qwen-2.5-32b",
50
53
  "qwen-2.5-coder-32b",
51
- "qwen-qwq-32b"
54
+ "qwen-qwq-32b",
55
+ "meta-llama/llama-4-scout-17b-16e-instruct"
56
+ ],
57
+ },
58
+ "cerebras": {
59
+ "endpoint": "https://exa-chat.vercel.app/api/cerebras",
60
+ "models": [
61
+ "llama3.1-8b",
62
+ "llama-3.3-70b"
52
63
  ],
53
64
  },
54
65
  }
@@ -63,6 +74,7 @@ class ExaChat(Provider):
63
74
 
64
75
  # Gemini Models
65
76
  "gemini-2.0-flash",
77
+ "gemini-2.0-flash-exp-image-generation",
66
78
  "gemini-2.0-flash-thinking-exp-01-21",
67
79
  "gemini-2.5-pro-exp-03-25",
68
80
  "gemini-2.0-pro-exp-02-05",
@@ -72,6 +84,7 @@ class ExaChat(Provider):
72
84
  "deepseek/deepseek-r1:free",
73
85
  "deepseek/deepseek-chat-v3-0324:free",
74
86
  "google/gemma-3-27b-it:free",
87
+ "meta-llama/llama-4-maverick:free",
75
88
 
76
89
  # Groq Models
77
90
  "deepseek-r1-distill-llama-70b",
@@ -87,7 +100,13 @@ class ExaChat(Provider):
87
100
  "llama3-8b-8192",
88
101
  "qwen-2.5-32b",
89
102
  "qwen-2.5-coder-32b",
90
- "qwen-qwq-32b"
103
+ "qwen-qwq-32b",
104
+ "meta-llama/llama-4-scout-17b-16e-instruct",
105
+
106
+
107
+ # Cerebras Models
108
+ "llama3.1-8b",
109
+ "llama-3.3-70b"
91
110
  ]
92
111
 
93
112
  def __init__(
@@ -206,6 +225,12 @@ class ExaChat(Provider):
206
225
  "model": self.model,
207
226
  "messages": []
208
227
  }
228
+ elif self.provider == "cerebras":
229
+ return {
230
+ "query": conversation_prompt,
231
+ "model": self.model,
232
+ "messages": []
233
+ }
209
234
  else: # openrouter or groq
210
235
  return {
211
236
  "query": conversation_prompt + "\n", # Add newline for openrouter and groq models
@@ -246,10 +271,7 @@ class ExaChat(Provider):
246
271
  full_response += content
247
272
  except json.JSONDecodeError:
248
273
  continue
249
-
250
- if not raw:
251
- print() # New line after response
252
-
274
+
253
275
  self.last_response = {"text": full_response}
254
276
  self.conversation.update_chat_history(prompt, full_response)
255
277
  return self.last_response