webscout 6.4__py3-none-any.whl → 6.6__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 (116) hide show
  1. webscout/AIutel.py +7 -54
  2. webscout/DWEBS.py +48 -26
  3. webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
  4. webscout/Extra/YTToolkit/__init__.py +3 -0
  5. webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +1 -1
  6. webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
  7. webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
  8. webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
  9. webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
  10. webscout/Extra/YTToolkit/ytapi/https.py +88 -0
  11. webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
  12. webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
  13. webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
  14. webscout/Extra/YTToolkit/ytapi/query.py +37 -0
  15. webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
  16. webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
  17. webscout/Extra/YTToolkit/ytapi/video.py +102 -0
  18. webscout/Extra/__init__.py +2 -1
  19. webscout/Extra/autocoder/autocoder_utiles.py +119 -101
  20. webscout/Extra/autocoder/rawdog.py +679 -680
  21. webscout/Extra/gguf.py +441 -441
  22. webscout/Extra/markdownlite/__init__.py +862 -0
  23. webscout/Extra/weather_ascii.py +2 -2
  24. webscout/Provider/AISEARCH/__init__.py +2 -0
  25. webscout/Provider/AISEARCH/ooai.py +155 -0
  26. webscout/Provider/Amigo.py +70 -85
  27. webscout/Provider/{prefind.py → Jadve.py} +72 -70
  28. webscout/Provider/Netwrck.py +235 -0
  29. webscout/Provider/Openai.py +4 -3
  30. webscout/Provider/PI.py +292 -221
  31. webscout/Provider/PizzaGPT.py +3 -3
  32. webscout/Provider/Reka.py +0 -1
  33. webscout/Provider/TTS/__init__.py +5 -1
  34. webscout/Provider/TTS/deepgram.py +183 -0
  35. webscout/Provider/TTS/elevenlabs.py +137 -0
  36. webscout/Provider/TTS/gesserit.py +151 -0
  37. webscout/Provider/TTS/murfai.py +139 -0
  38. webscout/Provider/TTS/parler.py +134 -107
  39. webscout/Provider/TTS/streamElements.py +360 -275
  40. webscout/Provider/TTS/utils.py +280 -0
  41. webscout/Provider/TTS/voicepod.py +116 -116
  42. webscout/Provider/TeachAnything.py +15 -2
  43. webscout/Provider/Youchat.py +42 -8
  44. webscout/Provider/__init__.py +8 -21
  45. webscout/Provider/meta.py +794 -779
  46. webscout/Provider/multichat.py +230 -0
  47. webscout/Provider/promptrefine.py +2 -2
  48. webscout/Provider/talkai.py +10 -13
  49. webscout/Provider/turboseek.py +5 -4
  50. webscout/Provider/tutorai.py +8 -112
  51. webscout/Provider/typegpt.py +5 -7
  52. webscout/Provider/x0gpt.py +81 -9
  53. webscout/Provider/yep.py +123 -361
  54. webscout/__init__.py +33 -28
  55. webscout/conversation.py +24 -9
  56. webscout/exceptions.py +188 -20
  57. webscout/litprinter/__init__.py +719 -831
  58. webscout/litprinter/colors.py +54 -0
  59. webscout/optimizers.py +420 -270
  60. webscout/prompt_manager.py +279 -279
  61. webscout/scout/__init__.py +8 -0
  62. webscout/scout/core/__init__.py +7 -0
  63. webscout/scout/core/crawler.py +140 -0
  64. webscout/scout/core/scout.py +571 -0
  65. webscout/scout/core/search_result.py +96 -0
  66. webscout/scout/core/text_analyzer.py +63 -0
  67. webscout/scout/core/text_utils.py +277 -0
  68. webscout/scout/core/web_analyzer.py +52 -0
  69. webscout/scout/core.py +884 -0
  70. webscout/scout/element.py +460 -0
  71. webscout/scout/parsers/__init__.py +69 -0
  72. webscout/scout/parsers/html5lib_parser.py +172 -0
  73. webscout/scout/parsers/html_parser.py +236 -0
  74. webscout/scout/parsers/lxml_parser.py +178 -0
  75. webscout/scout/utils.py +38 -0
  76. webscout/update_checker.py +184 -125
  77. webscout/version.py +1 -1
  78. webscout/zeroart/__init__.py +55 -0
  79. webscout/zeroart/base.py +60 -0
  80. webscout/zeroart/effects.py +99 -0
  81. webscout/zeroart/fonts.py +816 -0
  82. webscout/zerodir/__init__.py +225 -0
  83. {webscout-6.4.dist-info → webscout-6.6.dist-info}/METADATA +18 -231
  84. webscout-6.6.dist-info/RECORD +197 -0
  85. webscout-6.6.dist-info/top_level.txt +2 -0
  86. webstoken/__init__.py +30 -0
  87. webstoken/classifier.py +189 -0
  88. webstoken/keywords.py +216 -0
  89. webstoken/language.py +128 -0
  90. webstoken/ner.py +164 -0
  91. webstoken/normalizer.py +35 -0
  92. webstoken/processor.py +77 -0
  93. webstoken/sentiment.py +206 -0
  94. webstoken/stemmer.py +73 -0
  95. webstoken/t.py +75 -0
  96. webstoken/tagger.py +60 -0
  97. webstoken/tokenizer.py +158 -0
  98. webscout/Agents/Onlinesearcher.py +0 -182
  99. webscout/Agents/__init__.py +0 -2
  100. webscout/Agents/functioncall.py +0 -248
  101. webscout/Bing_search.py +0 -251
  102. webscout/Provider/Perplexity.py +0 -599
  103. webscout/Provider/RoboCoders.py +0 -206
  104. webscout/Provider/genspark.py +0 -225
  105. webscout/Provider/perplexitylabs.py +0 -265
  106. webscout/Provider/twitterclone.py +0 -251
  107. webscout/Provider/upstage.py +0 -230
  108. webscout/gpt4free.py +0 -666
  109. webscout/requestsHTMLfix.py +0 -775
  110. webscout/webai.py +0 -2590
  111. webscout-6.4.dist-info/RECORD +0 -154
  112. webscout-6.4.dist-info/top_level.txt +0 -1
  113. /webscout/Provider/{felo_search.py → AISEARCH/felo_search.py} +0 -0
  114. {webscout-6.4.dist-info → webscout-6.6.dist-info}/LICENSE.md +0 -0
  115. {webscout-6.4.dist-info → webscout-6.6.dist-info}/WHEEL +0 -0
  116. {webscout-6.4.dist-info → webscout-6.6.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,235 @@
1
+ import time
2
+ import uuid
3
+ import requests
4
+ import json
5
+
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, Conversation, AwesomePrompts
11
+ from webscout.AIbase import Provider
12
+ from webscout import exceptions
13
+ from webscout.Litlogger import LitLogger, LogFormat, ColorScheme
14
+ from webscout.litagent import LitAgent
15
+
16
+
17
+ class Netwrck(Provider):
18
+ """
19
+ A class to interact with the Netwrck.com API. Supports streaming.
20
+ """
21
+
22
+ AVAILABLE_MODELS = {
23
+ "lumimaid": "neversleep/llama-3.1-lumimaid-8b",
24
+ "grok": "x-ai/grok-2",
25
+ "claude": "anthropic/claude-3.5-sonnet:beta",
26
+ "euryale": "sao10k/l3-euryale-70b",
27
+ "gpt4mini": "openai/gpt-4o-mini",
28
+ "mythomax": "gryphe/mythomax-l2-13b",
29
+ "gemini": "google/gemini-pro-1.5",
30
+ "lumimaid70b": "neversleep/llama-3.1-lumimaid-70b",
31
+ "nemotron": "nvidia/llama-3.1-nemotron-70b-instruct",
32
+ }
33
+
34
+ def __init__(
35
+ self,
36
+ model: str = "lumimaid",
37
+ is_conversation: bool = True,
38
+ max_tokens: int = 2048,
39
+ timeout: int = 30,
40
+ intro: Optional[str] = None,
41
+ filepath: Optional[str] = None,
42
+ update_file: bool = False,
43
+ proxies: Optional[dict] = None,
44
+ history_offset: int = 0,
45
+ act: Optional[str] = None,
46
+ system_prompt: str = "You are a helpful assistant.",
47
+ temperature: float = 0.7,
48
+ top_p: float = 0.8,
49
+ logging: bool = False
50
+ ):
51
+ """Initializes the Netwrck API client."""
52
+ if model not in self.AVAILABLE_MODELS:
53
+ raise ValueError(f"Invalid model: {model}. Choose from: {list(self.AVAILABLE_MODELS.keys())}")
54
+
55
+ self.model = model
56
+ self.model_name = self.AVAILABLE_MODELS[model]
57
+ self.system_prompt = system_prompt
58
+ self.session = requests.Session()
59
+ self.is_conversation = is_conversation
60
+ self.max_tokens_to_sample = max_tokens
61
+ self.timeout = timeout
62
+ self.last_response: Dict[str, Any] = {}
63
+ self.temperature = temperature
64
+ self.top_p = top_p
65
+
66
+ # Initialize LitAgent for user agent generation
67
+ self.agent = LitAgent()
68
+
69
+ self.headers = {
70
+ 'authority': 'netwrck.com',
71
+ 'accept': '*/*',
72
+ 'accept-language': 'en-US,en;q=0.9',
73
+ 'content-type': 'application/json',
74
+ 'origin': 'https://netwrck.com',
75
+ 'referer': 'https://netwrck.com/',
76
+ 'user-agent': self.agent.random()
77
+ }
78
+ self.session.headers.update(self.headers)
79
+ self.proxies = proxies or {}
80
+
81
+ Conversation.intro = (
82
+ AwesomePrompts().get_act(act, raise_not_found=True, default=None, case_insensitive=True)
83
+ if act
84
+ else intro or Conversation.intro
85
+ )
86
+ self.conversation = Conversation(is_conversation, max_tokens, filepath, update_file)
87
+ self.conversation.history_offset = history_offset
88
+ self.__available_optimizers = (
89
+ method
90
+ for method in dir(Optimizers)
91
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
92
+ )
93
+
94
+ # Initialize logger
95
+ self.logger = LitLogger(name="Netwrck", format=LogFormat.MODERN_EMOJI, color_scheme=ColorScheme.CYBERPUNK) if logging else None
96
+
97
+
98
+ def ask(
99
+ self,
100
+ prompt: str,
101
+ stream: bool = False,
102
+ raw: bool = False,
103
+ optimizer: Optional[str] = None,
104
+ conversationally: bool = False,
105
+ ) -> Union[Dict[str, Any], Generator]:
106
+ """Sends a prompt to the Netwrck API and returns the response."""
107
+
108
+ if self.logger:
109
+ self.logger.debug(f"ask() called with prompt: {prompt}")
110
+
111
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
112
+ if optimizer:
113
+ if optimizer in self.__available_optimizers:
114
+ conversation_prompt = getattr(Optimizers, optimizer)(
115
+ conversation_prompt if conversationally else prompt
116
+ )
117
+ else:
118
+ if self.logger:
119
+ self.logger.error(f"Invalid optimizer: {optimizer}")
120
+ raise exceptions.FailedToGenerateResponseError(
121
+ f"Optimizer is not one of {self.__available_optimizers}"
122
+ )
123
+
124
+ payload = {
125
+ "query": conversation_prompt,
126
+ "context": self.system_prompt,
127
+ "examples": [],
128
+ "model_name": self.model_name,
129
+ "temperature": self.temperature,
130
+ "top_p": self.top_p,
131
+ }
132
+
133
+
134
+ def for_stream():
135
+ try:
136
+ response = self.session.post(
137
+ "https://netwrck.com/api/chatpred_or",
138
+ json=payload,
139
+ headers=self.headers,
140
+ proxies=self.proxies,
141
+ timeout=self.timeout,
142
+ stream=True,
143
+ )
144
+ response.raise_for_status()
145
+
146
+ streaming_text = ""
147
+ for line in response.iter_lines():
148
+ if line:
149
+ decoded_line = line.decode('utf-8').strip('"')
150
+ streaming_text += decoded_line
151
+ yield {"text": decoded_line} if not raw else decoded_line
152
+
153
+ self.conversation.update_chat_history(prompt, streaming_text)
154
+
155
+ except Exception as e:
156
+ if self.logger:
157
+ self.logger.error(f"Error communicating with Netwrck: {e}")
158
+ raise exceptions.ProviderConnectionError(f"Error communicating with Netwrck: {e}") from e
159
+
160
+ def for_non_stream():
161
+ try:
162
+ response = self.session.post(
163
+ "https://netwrck.com/api/chatpred_or",
164
+ json=payload,
165
+ headers=self.headers,
166
+ proxies=self.proxies,
167
+ timeout=self.timeout,
168
+ )
169
+ response.raise_for_status()
170
+ print(response.text)
171
+ text = response.text.strip('"')
172
+ self.last_response = {"text": text}
173
+ self.conversation.update_chat_history(prompt, text)
174
+
175
+ return self.last_response
176
+ except Exception as e:
177
+ if self.logger:
178
+ self.logger.error(f"Error communicating with Netwrck: {e}")
179
+ raise exceptions.ProviderConnectionError(f"Error communicating with Netwrck: {e}") from e
180
+
181
+ return for_stream() if stream else for_non_stream()
182
+
183
+ def chat(
184
+ self,
185
+ prompt: str,
186
+ stream: bool = False,
187
+ optimizer: Optional[str] = None,
188
+ conversationally: bool = False,
189
+ ) -> str:
190
+ """Generates a response from the Netwrck API."""
191
+ if self.logger:
192
+ self.logger.debug(f"chat() called with prompt: {prompt}")
193
+
194
+ def for_stream():
195
+ for response in self.ask(
196
+ prompt,
197
+ stream=True,
198
+ optimizer=optimizer,
199
+ conversationally=conversationally
200
+ ):
201
+ yield self.get_message(response)
202
+
203
+ def for_non_stream():
204
+ return self.get_message(
205
+ self.ask(
206
+ prompt,
207
+ stream=False,
208
+ optimizer=optimizer,
209
+ conversationally=conversationally,
210
+ )
211
+ )
212
+
213
+ return for_stream() if stream else for_non_stream()
214
+
215
+ def get_message(self, response: Dict[str, Any]) -> str:
216
+ """Retrieves message only from response"""
217
+ assert isinstance(response, dict), "Response should be of dict data-type only"
218
+ return response["text"]
219
+
220
+ # Example Usage:
221
+ if __name__ == "__main__":
222
+ from rich import print
223
+
224
+ # Non-streaming example
225
+ print("Non-Streaming Response:")
226
+ netwrck = Netwrck(model="lumimaid", logging=True)
227
+ response = netwrck.chat("What is the capital of France?")
228
+ print(response)
229
+
230
+ # Streaming example
231
+ print("\nStreaming Response:")
232
+ response = netwrck.chat("tell me about india", stream=True)
233
+ for chunk in response:
234
+ print(chunk, end="", flush=True)
235
+ print() # Add a newline at the end
@@ -6,7 +6,7 @@ from ..AIbase import Provider, AsyncProvider
6
6
 
7
7
  from webscout import exceptions
8
8
  from typing import Any, AsyncGenerator, Dict
9
-
9
+ import requests
10
10
  import httpx
11
11
  #----------------------------------------------------------OpenAI-----------------------------------
12
12
  class OPENAI(Provider):
@@ -27,6 +27,7 @@ class OPENAI(Provider):
27
27
  proxies: dict = {},
28
28
  history_offset: int = 10250,
29
29
  act: str = None,
30
+ base_url: str = "https://api.openai.com/v1/chat/completions",
30
31
  ):
31
32
  """Instantiates OPENAI
32
33
 
@@ -55,7 +56,7 @@ class OPENAI(Provider):
55
56
  self.presence_penalty = presence_penalty
56
57
  self.frequency_penalty = frequency_penalty
57
58
  self.top_p = top_p
58
- self.chat_endpoint = "https://api.openai.com/v1/chat/completions"
59
+ self.chat_endpoint = base_url
59
60
  self.stream_chunk_size = 64
60
61
  self.timeout = timeout
61
62
  self.last_response = {}
@@ -63,7 +64,7 @@ class OPENAI(Provider):
63
64
  "Content-Type": "application/json",
64
65
  "Authorization": f"Bearer {self.api_key}",
65
66
  }
66
-
67
+ self.session = requests.session()
67
68
  self.__available_optimizers = (
68
69
  method
69
70
  for method in dir(Optimizers)