webscout 7.4__py3-none-any.whl → 7.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 (137) hide show
  1. webscout/AIauto.py +5 -53
  2. webscout/AIutel.py +8 -318
  3. webscout/DWEBS.py +460 -489
  4. webscout/Extra/YTToolkit/YTdownloader.py +14 -53
  5. webscout/Extra/YTToolkit/transcriber.py +12 -13
  6. webscout/Extra/YTToolkit/ytapi/video.py +0 -1
  7. webscout/Extra/__init__.py +0 -1
  8. webscout/Extra/autocoder/autocoder_utiles.py +0 -4
  9. webscout/Extra/autocoder/rawdog.py +13 -41
  10. webscout/Extra/gguf.py +652 -428
  11. webscout/Extra/weather.py +178 -156
  12. webscout/Extra/weather_ascii.py +70 -17
  13. webscout/Litlogger/core/logger.py +1 -2
  14. webscout/Litlogger/handlers/file.py +1 -1
  15. webscout/Litlogger/styles/formats.py +0 -2
  16. webscout/Litlogger/utils/detectors.py +0 -1
  17. webscout/Provider/AISEARCH/DeepFind.py +0 -1
  18. webscout/Provider/AISEARCH/ISou.py +1 -1
  19. webscout/Provider/AISEARCH/felo_search.py +0 -1
  20. webscout/Provider/AllenAI.py +24 -9
  21. webscout/Provider/C4ai.py +432 -0
  22. webscout/Provider/ChatGPTGratis.py +24 -56
  23. webscout/Provider/Cloudflare.py +18 -21
  24. webscout/Provider/DeepSeek.py +27 -48
  25. webscout/Provider/Deepinfra.py +129 -53
  26. webscout/Provider/Gemini.py +1 -1
  27. webscout/Provider/GithubChat.py +362 -0
  28. webscout/Provider/Glider.py +25 -8
  29. webscout/Provider/HF_space/qwen_qwen2.py +2 -2
  30. webscout/Provider/HeckAI.py +38 -5
  31. webscout/Provider/HuggingFaceChat.py +462 -0
  32. webscout/Provider/Jadve.py +20 -5
  33. webscout/Provider/Marcus.py +7 -50
  34. webscout/Provider/Netwrck.py +43 -67
  35. webscout/Provider/PI.py +4 -2
  36. webscout/Provider/Perplexitylabs.py +26 -6
  37. webscout/Provider/Phind.py +29 -3
  38. webscout/Provider/PizzaGPT.py +10 -51
  39. webscout/Provider/TTI/AiForce/async_aiforce.py +4 -37
  40. webscout/Provider/TTI/AiForce/sync_aiforce.py +41 -38
  41. webscout/Provider/TTI/FreeAIPlayground/__init__.py +9 -9
  42. webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +206 -206
  43. webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +192 -192
  44. webscout/Provider/TTI/MagicStudio/__init__.py +2 -0
  45. webscout/Provider/TTI/MagicStudio/async_magicstudio.py +111 -0
  46. webscout/Provider/TTI/MagicStudio/sync_magicstudio.py +109 -0
  47. webscout/Provider/TTI/PollinationsAI/async_pollinations.py +5 -24
  48. webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +2 -22
  49. webscout/Provider/TTI/__init__.py +2 -3
  50. webscout/Provider/TTI/aiarta/__init__.py +2 -0
  51. webscout/Provider/TTI/aiarta/async_aiarta.py +482 -0
  52. webscout/Provider/TTI/aiarta/sync_aiarta.py +440 -0
  53. webscout/Provider/TTI/fastflux/__init__.py +22 -0
  54. webscout/Provider/TTI/fastflux/async_fastflux.py +257 -0
  55. webscout/Provider/TTI/fastflux/sync_fastflux.py +247 -0
  56. webscout/Provider/TTS/__init__.py +2 -2
  57. webscout/Provider/TTS/deepgram.py +12 -39
  58. webscout/Provider/TTS/elevenlabs.py +14 -40
  59. webscout/Provider/TTS/gesserit.py +11 -35
  60. webscout/Provider/TTS/murfai.py +13 -39
  61. webscout/Provider/TTS/parler.py +17 -40
  62. webscout/Provider/TTS/speechma.py +180 -0
  63. webscout/Provider/TTS/streamElements.py +17 -44
  64. webscout/Provider/TextPollinationsAI.py +39 -59
  65. webscout/Provider/Venice.py +217 -200
  66. webscout/Provider/WiseCat.py +27 -5
  67. webscout/Provider/Youchat.py +63 -36
  68. webscout/Provider/__init__.py +13 -8
  69. webscout/Provider/akashgpt.py +28 -10
  70. webscout/Provider/copilot.py +416 -0
  71. webscout/Provider/flowith.py +196 -0
  72. webscout/Provider/freeaichat.py +32 -45
  73. webscout/Provider/granite.py +17 -53
  74. webscout/Provider/koala.py +20 -5
  75. webscout/Provider/llamatutor.py +7 -47
  76. webscout/Provider/llmchat.py +36 -53
  77. webscout/Provider/multichat.py +92 -98
  78. webscout/Provider/talkai.py +1 -0
  79. webscout/Provider/turboseek.py +3 -0
  80. webscout/Provider/tutorai.py +2 -0
  81. webscout/Provider/typegpt.py +154 -64
  82. webscout/Provider/x0gpt.py +3 -1
  83. webscout/Provider/yep.py +102 -20
  84. webscout/__init__.py +3 -0
  85. webscout/cli.py +4 -40
  86. webscout/conversation.py +1 -10
  87. webscout/exceptions.py +19 -9
  88. webscout/litagent/__init__.py +2 -2
  89. webscout/litagent/agent.py +351 -20
  90. webscout/litagent/constants.py +34 -5
  91. webscout/litprinter/__init__.py +0 -3
  92. webscout/models.py +181 -0
  93. webscout/optimizers.py +1 -1
  94. webscout/prompt_manager.py +2 -8
  95. webscout/scout/core/scout.py +1 -4
  96. webscout/scout/core/search_result.py +1 -1
  97. webscout/scout/core/text_utils.py +1 -1
  98. webscout/scout/core.py +2 -5
  99. webscout/scout/element.py +1 -1
  100. webscout/scout/parsers/html_parser.py +1 -1
  101. webscout/scout/utils.py +0 -1
  102. webscout/swiftcli/__init__.py +1 -3
  103. webscout/tempid.py +1 -1
  104. webscout/update_checker.py +55 -95
  105. webscout/version.py +1 -1
  106. webscout/webscout_search_async.py +1 -2
  107. webscout/yep_search.py +297 -297
  108. webscout-7.6.dist-info/LICENSE.md +146 -0
  109. {webscout-7.4.dist-info → webscout-7.6.dist-info}/METADATA +104 -514
  110. {webscout-7.4.dist-info → webscout-7.6.dist-info}/RECORD +113 -120
  111. webscout/Extra/autollama.py +0 -231
  112. webscout/Local/__init__.py +0 -10
  113. webscout/Local/_version.py +0 -3
  114. webscout/Local/formats.py +0 -747
  115. webscout/Local/model.py +0 -1368
  116. webscout/Local/samplers.py +0 -125
  117. webscout/Local/thread.py +0 -539
  118. webscout/Local/ui.py +0 -401
  119. webscout/Local/utils.py +0 -388
  120. webscout/Provider/Amigo.py +0 -274
  121. webscout/Provider/Bing.py +0 -243
  122. webscout/Provider/DiscordRocks.py +0 -253
  123. webscout/Provider/TTI/blackbox/__init__.py +0 -4
  124. webscout/Provider/TTI/blackbox/async_blackbox.py +0 -212
  125. webscout/Provider/TTI/blackbox/sync_blackbox.py +0 -199
  126. webscout/Provider/TTI/deepinfra/__init__.py +0 -4
  127. webscout/Provider/TTI/deepinfra/async_deepinfra.py +0 -227
  128. webscout/Provider/TTI/deepinfra/sync_deepinfra.py +0 -199
  129. webscout/Provider/TTI/imgninza/__init__.py +0 -4
  130. webscout/Provider/TTI/imgninza/async_ninza.py +0 -214
  131. webscout/Provider/TTI/imgninza/sync_ninza.py +0 -209
  132. webscout/Provider/TTS/voicepod.py +0 -117
  133. webscout/Provider/dgaf.py +0 -214
  134. webscout-7.4.dist-info/LICENSE.md +0 -211
  135. {webscout-7.4.dist-info → webscout-7.6.dist-info}/WHEEL +0 -0
  136. {webscout-7.4.dist-info → webscout-7.6.dist-info}/entry_points.txt +0 -0
  137. {webscout-7.4.dist-info → webscout-7.6.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,6 @@ from datetime import date
8
8
  from webscout.AIutel import Optimizers, Conversation, AwesomePrompts
9
9
  from webscout.AIbase import Provider
10
10
  from webscout import exceptions
11
- from webscout.Litlogger import Logger, LogFormat
12
11
  from webscout.litagent import LitAgent
13
12
 
14
13
  class Netwrck(Provider):
@@ -17,22 +16,22 @@ class Netwrck(Provider):
17
16
  """
18
17
  greeting = """Hello! I'm a helpful assistant. How can I help you today?"""
19
18
 
20
- AVAILABLE_MODELS = {
21
- "lumimaid": "neversleep/llama-3-lumimaid-8b:extended",
22
- "grok": "x-ai/grok-2",
23
- "claude": "anthropic/claude-3.5-sonnet:beta",
24
- "euryale": "sao10k/l3-euryale-70b",
25
- "gpt4mini": "openai/gpt-4o-mini",
26
- "mythomax": "gryphe/mythomax-l2-13b",
27
- "gemini": "google/gemini-pro-1.5",
28
- "nemotron": "nvidia/llama-3.1-nemotron-70b-instruct",
29
- "deepseek-r1": "deepseek/deepseek-r1",
30
- "deepseek": "deepseek/deepseek-chat",
31
- }
19
+ AVAILABLE_MODELS = [
20
+ "neversleep/llama-3-lumimaid-8b:extended",
21
+ "x-ai/grok-2",
22
+ "anthropic/claude-3-7-sonnet-20250219",
23
+ "sao10k/l3-euryale-70b",
24
+ "openai/gpt-4o-mini",
25
+ "gryphe/mythomax-l2-13b",
26
+ "google/gemini-pro-1.5",
27
+ "nvidia/llama-3.1-nemotron-70b-instruct",
28
+ "deepseek-r1",
29
+ "deepseek",
30
+ ]
32
31
 
33
32
  def __init__(
34
33
  self,
35
- model: str = "claude",
34
+ model: str = "anthropic/claude-3-7-sonnet-20250219",
36
35
  is_conversation: bool = True,
37
36
  max_tokens: int = 4096,
38
37
  timeout: int = 30,
@@ -44,25 +43,14 @@ class Netwrck(Provider):
44
43
  act: Optional[str] = None,
45
44
  system_prompt: str = "You are a helpful assistant.",
46
45
  temperature: float = 0.7,
47
- top_p: float = 0.8,
48
- logging: bool = False
46
+ top_p: float = 0.8
49
47
  ):
50
48
  """Initializes the Netwrck API client."""
51
- # Initialize logger first for initialization logging
52
- self.logger = Logger(
53
- name="Netwrck",
54
- format=LogFormat.MODERN_EMOJI,
55
-
56
- ) if logging else None
57
-
58
49
  if model not in self.AVAILABLE_MODELS:
59
- error_msg = f"Invalid model: {model}. Choose from: {list(self.AVAILABLE_MODELS.keys())}"
60
- if self.logger:
61
- self.logger.error(error_msg)
62
- raise ValueError(error_msg)
50
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
63
51
 
64
52
  self.model = model
65
- self.model_name = self.AVAILABLE_MODELS[model]
53
+ self.model_name = model # Use the model name directly since it's already in the correct format
66
54
  self.system_prompt = system_prompt
67
55
  self.session = requests.Session()
68
56
  self.is_conversation = is_conversation
@@ -99,9 +87,6 @@ class Netwrck(Provider):
99
87
  if callable(getattr(Optimizers, method)) and not method.startswith("__")
100
88
  )
101
89
 
102
- if self.logger:
103
- self.logger.info(f"Initialized Netwrck with model: {self.model_name}")
104
-
105
90
  def ask(
106
91
  self,
107
92
  prompt: str,
@@ -112,18 +97,13 @@ class Netwrck(Provider):
112
97
  ) -> Union[Dict[str, Any], Generator]:
113
98
  """Sends a prompt to the Netwrck API and returns the response."""
114
99
  if optimizer and optimizer not in self.__available_optimizers:
115
- error_msg = f"Optimizer is not one of {self.__available_optimizers}"
116
- if self.logger:
117
- self.logger.error(f"Invalid optimizer requested: {optimizer}")
118
- raise exceptions.FailedToGenerateResponseError(error_msg)
100
+ raise exceptions.FailedToGenerateResponseError(f"Optimizer is not one of {self.__available_optimizers}")
119
101
 
120
102
  conversation_prompt = self.conversation.gen_complete_prompt(prompt)
121
103
  if optimizer:
122
104
  conversation_prompt = getattr(Optimizers, optimizer)(
123
105
  conversation_prompt if conversationally else prompt
124
106
  )
125
- if self.logger:
126
- self.logger.debug(f"Applied optimizer: {optimizer}")
127
107
 
128
108
  payload = {
129
109
  "query": prompt,
@@ -133,9 +113,6 @@ class Netwrck(Provider):
133
113
  "greeting": self.greeting
134
114
  }
135
115
 
136
- if self.logger:
137
- self.logger.debug(f"Sending request to Netwrck API [stream={stream}]")
138
-
139
116
  def for_stream():
140
117
  try:
141
118
  response = self.session.post(
@@ -158,12 +135,8 @@ class Netwrck(Provider):
158
135
  self.conversation.update_chat_history(payload["query"], streaming_text)
159
136
 
160
137
  except requests.exceptions.RequestException as e:
161
- if self.logger:
162
- self.logger.error(f"Network error: {str(e)}")
163
138
  raise exceptions.ProviderConnectionError(f"Network error: {str(e)}") from e
164
139
  except Exception as e:
165
- if self.logger:
166
- self.logger.error(f"Unexpected error: {str(e)}")
167
140
  raise exceptions.ProviderConnectionError(f"Unexpected error: {str(e)}") from e
168
141
 
169
142
  def for_non_stream():
@@ -177,9 +150,6 @@ class Netwrck(Provider):
177
150
  )
178
151
  response.raise_for_status()
179
152
 
180
- if self.logger:
181
- self.logger.debug(f"Response status: {response.status_code}")
182
-
183
153
  text = response.text.strip('"')
184
154
  self.last_response = {"text": text}
185
155
  self.conversation.update_chat_history(prompt, text)
@@ -187,12 +157,8 @@ class Netwrck(Provider):
187
157
  return self.last_response
188
158
 
189
159
  except requests.exceptions.RequestException as e:
190
- if self.logger:
191
- self.logger.error(f"Network error: {str(e)}")
192
160
  raise exceptions.FailedToGenerateResponseError(f"Network error: {str(e)}") from e
193
161
  except Exception as e:
194
- if self.logger:
195
- self.logger.error(f"Unexpected error: {str(e)}")
196
162
  raise exceptions.FailedToGenerateResponseError(f"Unexpected error: {str(e)}") from e
197
163
 
198
164
  return for_stream() if stream else for_non_stream()
@@ -205,9 +171,6 @@ class Netwrck(Provider):
205
171
  conversationally: bool = False,
206
172
  ) -> str:
207
173
  """Generates a response from the Netwrck API."""
208
- if self.logger:
209
- self.logger.debug(f"Processing chat request [stream={stream}]")
210
-
211
174
  def for_stream():
212
175
  for response in self.ask(
213
176
  prompt,
@@ -235,17 +198,30 @@ class Netwrck(Provider):
235
198
  return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
236
199
 
237
200
  if __name__ == "__main__":
238
- from rich import print
239
-
240
- # Example with logging enabled
241
- netwrck = Netwrck(model="claude", logging=False)
201
+ print("-" * 80)
202
+ print(f"{'Model':<50} {'Status':<10} {'Response'}")
203
+ print("-" * 80)
204
+
205
+ # Test all available models
206
+ working = 0
207
+ total = len(Netwrck.AVAILABLE_MODELS)
242
208
 
243
- print("Non-Streaming Response:")
244
- response = netwrck.chat("Tell me about Russia")
245
- print(response)
246
-
247
- print("\nStreaming Response:")
248
- response = netwrck.chat("Tell me about India", stream=True)
249
- for chunk in response:
250
- print(chunk, end="", flush=True)
251
- print()
209
+ for model in Netwrck.AVAILABLE_MODELS:
210
+ try:
211
+ test_ai = Netwrck(model=model, timeout=60)
212
+ response = test_ai.chat("Say 'Hello' in one word", stream=True)
213
+ response_text = ""
214
+ for chunk in response:
215
+ response_text += chunk
216
+ print(f"\r{model:<50} {'Testing...':<10}", end="", flush=True)
217
+
218
+ if response_text and len(response_text.strip()) > 0:
219
+ status = "✓"
220
+ # Truncate response if too long
221
+ display_text = response_text.strip()[:50] + "..." if len(response_text.strip()) > 50 else response_text.strip()
222
+ else:
223
+ status = "✗"
224
+ display_text = "Empty or invalid response"
225
+ print(f"\r{model:<50} {status:<10} {display_text}")
226
+ except Exception as e:
227
+ print(f"\r{model:<50} {'✗':<10} {str(e)}")
webscout/Provider/PI.py CHANGED
@@ -18,8 +18,9 @@ class PiAI(Provider):
18
18
  Attributes:
19
19
  knowledge_cutoff (str): The knowledge cutoff date for the model
20
20
  AVAILABLE_VOICES (Dict[str, int]): Available voice options for audio responses
21
+ AVAILABLE_MODELS (List[str]): Available model options for the API
21
22
  """
22
-
23
+ AVAILABLE_MODELS = ["inflection_3_pi"]
23
24
  AVAILABLE_VOICES: Dict[str, int] = {
24
25
  "voice1": 1,
25
26
  "voice2": 2,
@@ -44,7 +45,8 @@ class PiAI(Provider):
44
45
  act: str = None,
45
46
  voice: bool = False,
46
47
  voice_name: str = "voice3",
47
- output_file: str = "PiAI.mp3"
48
+ output_file: str = "PiAI.mp3",
49
+ model: str = "inflection_3_pi",
48
50
  ):
49
51
  """
50
52
  Initializes PiAI with voice support.
@@ -386,10 +386,30 @@ class PerplexityLabs(Provider):
386
386
 
387
387
 
388
388
  if __name__ == "__main__":
389
- from rich import print
389
+ print("-" * 80)
390
+ print(f"{'Model':<50} {'Status':<10} {'Response'}")
391
+ print("-" * 80)
390
392
 
391
- # Example usage
392
- ai = PerplexityLabs(timeout=60, model="r1-1776")
393
-
394
- for chunk in ai.chat("Explain the concept of neural networks", stream=True):
395
- print(chunk, end="", flush=True)
393
+ # Test all available models
394
+ working = 0
395
+ total = len(PerplexityLabs.AVAILABLE_MODELS)
396
+
397
+ for model in PerplexityLabs.AVAILABLE_MODELS:
398
+ try:
399
+ test_ai = PerplexityLabs(model=model, timeout=60)
400
+ response = test_ai.chat("Say 'Hello' in one word", stream=True)
401
+ response_text = ""
402
+ for chunk in response:
403
+ response_text += chunk
404
+ print(f"\r{model:<50} {'Testing...':<10}", end="", flush=True)
405
+
406
+ if response_text and len(response_text.strip()) > 0:
407
+ status = "✓"
408
+ # Truncate response if too long
409
+ display_text = response_text.strip()[:50] + "..." if len(response_text.strip()) > 50 else response_text.strip()
410
+ else:
411
+ status = "✗"
412
+ display_text = "Empty or invalid response"
413
+ print(f"\r{model:<50} {status:<10} {display_text}")
414
+ except Exception as e:
415
+ print(f"\r{model:<50} {'✗':<10} {str(e)}")
@@ -13,7 +13,17 @@ from typing import Any, AsyncGenerator, Dict
13
13
 
14
14
  #------------------------------------------------------phind-------------------------------------------------------------
15
15
  class PhindSearch:
16
- # default_model = "Phind Model"
16
+ # Available models for Phind
17
+ AVAILABLE_MODELS = [
18
+ "Phind Model",
19
+ "Claude 3.7 Sonnet",
20
+ "Claude Opus",
21
+ "GPT-4o",
22
+ "o3-mini",
23
+ "Phind-405B",
24
+ "Phind-70B"
25
+ ]
26
+
17
27
  def __init__(
18
28
  self,
19
29
  is_conversation: bool = True,
@@ -43,6 +53,9 @@ class PhindSearch:
43
53
  model (str, optional): Model name. Defaults to "Phind Model".
44
54
  quiet (bool, optional): Ignore web search-results and yield final response only. Defaults to False.
45
55
  """
56
+ if model not in self.AVAILABLE_MODELS:
57
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
58
+
46
59
  self.session = requests.Session()
47
60
  self.max_tokens_to_sample = max_tokens
48
61
  self.is_conversation = is_conversation
@@ -256,6 +269,16 @@ class PhindSearch:
256
269
  )
257
270
 
258
271
  class Phindv2(Provider):
272
+ # Available models for Phindv2
273
+ AVAILABLE_MODELS = [
274
+ "Claude 3.7 Sonnet",
275
+ "Claude Opus",
276
+ "GPT-4o",
277
+ "o3-mini",
278
+ "Phind-405B",
279
+ "Phind-70B"
280
+ ]
281
+
259
282
  def __init__(
260
283
  self,
261
284
  is_conversation: bool = True,
@@ -267,7 +290,7 @@ class Phindv2(Provider):
267
290
  proxies: dict = {},
268
291
  history_offset: int = 10250,
269
292
  act: str = None,
270
- model: str = "Phind Instant",
293
+ model: str = "Claude 3.7 Sonnet",
271
294
  quiet: bool = False,
272
295
  system_prompt: str = "Be Helpful and Friendly",
273
296
  ):
@@ -287,6 +310,9 @@ class Phindv2(Provider):
287
310
  quiet (bool, optional): Ignore web search-results and yield final response only. Defaults to False.
288
311
  system_prompt (str, optional): System prompt for Phindv2. Defaults to "Be Helpful and Friendly".
289
312
  """
313
+ if model not in self.AVAILABLE_MODELS:
314
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
315
+
290
316
  self.session = requests.Session()
291
317
  self.max_tokens_to_sample = max_tokens
292
318
  self.is_conversation = is_conversation
@@ -505,5 +531,5 @@ if __name__ == "__main__":
505
531
  from rich import print
506
532
 
507
533
  ai = Phindv2()
508
- print(ai.chat("Tell me a joke"))
534
+ print(ai.chat("Who are u"))
509
535
  # Returns the chat response from the Phindv2 API.
@@ -6,14 +6,14 @@ from webscout.AIutel import Optimizers, Conversation, AwesomePrompts
6
6
  from webscout.AIbase import Provider
7
7
  from webscout import exceptions
8
8
  from webscout import LitAgent as Lit
9
- from webscout.Litlogger import Logger, LogFormat
10
9
 
11
10
  class PIZZAGPT(Provider):
12
11
  """
13
12
  PIZZAGPT is a provider class for interacting with the PizzaGPT API.
14
13
  Supports web search integration and handles responses using regex.
15
14
  """
16
-
15
+ AVAILABLE_MODELS = ["gpt-4o-mini"]
16
+
17
17
  def __init__(
18
18
  self,
19
19
  is_conversation: bool = True,
@@ -25,10 +25,12 @@ class PIZZAGPT(Provider):
25
25
  proxies: dict = {},
26
26
  history_offset: int = 10250,
27
27
  act: str = None,
28
- logging: bool = False,
29
28
  model: str = "gpt-4o-mini"
30
29
  ) -> None:
31
30
  """Initialize PizzaGPT with enhanced configuration options."""
31
+ if model not in self.AVAILABLE_MODELS:
32
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
33
+
32
34
  self.session = requests.Session()
33
35
  self.is_conversation = is_conversation
34
36
  self.max_tokens_to_sample = max_tokens
@@ -45,7 +47,9 @@ class PIZZAGPT(Provider):
45
47
  "origin": "https://www.pizzagpt.it",
46
48
  "referer": "https://www.pizzagpt.it/en",
47
49
  "user-agent": Lit().random(),
48
- "x-secret": "Marinara"
50
+ "x-secret": "Marinara",
51
+ "sec-ch-ua": '"Chromium";v="134", "Not:A-Brand";v="24"',
52
+ "sec-ch-ua-platform": '"Windows"'
49
53
  }
50
54
 
51
55
  self.__available_optimizers = (
@@ -67,28 +71,15 @@ class PIZZAGPT(Provider):
67
71
  )
68
72
  self.conversation.history_offset = history_offset
69
73
  self.session.proxies = proxies
70
-
71
- self.logger = Logger(
72
- name="PIZZAGPT",
73
- format=LogFormat.MODERN_EMOJI,
74
- ) if logging else None
75
-
76
- if self.logger:
77
- self.logger.info(f"PIZZAGPT initialized with model: {self.model}")
78
74
 
79
75
  def _extract_content(self, text: str) -> Dict[str, Any]:
80
76
  """
81
77
  Extract content from response text using regex.
82
78
  """
83
- if self.logger:
84
- self.logger.debug("Extracting content from response text")
85
-
86
79
  try:
87
80
  # Look for content pattern
88
81
  content_match = re.search(r'"content"\s*:\s*"(.*?)"(?=\s*[,}])', text, re.DOTALL)
89
82
  if not content_match:
90
- if self.logger:
91
- self.logger.error("Content pattern not found in response")
92
83
  raise exceptions.FailedToGenerateResponseError("Content not found in response")
93
84
 
94
85
  content = content_match.group(1)
@@ -108,8 +99,6 @@ class PIZZAGPT(Provider):
108
99
  }
109
100
 
110
101
  except Exception as e:
111
- if self.logger:
112
- self.logger.error(f"Failed to extract content: {str(e)}")
113
102
  raise exceptions.FailedToGenerateResponseError(f"Failed to extract content: {str(e)}")
114
103
 
115
104
  def ask(
@@ -124,21 +113,13 @@ class PIZZAGPT(Provider):
124
113
  """
125
114
  Send a prompt to PizzaGPT API with optional web search capability.
126
115
  """
127
- if self.logger:
128
- self.logger.debug(f"Processing request - Prompt: {prompt[:50]}...")
129
- self.logger.debug(f"Web search enabled: {web_search}")
130
-
131
116
  conversation_prompt = self.conversation.gen_complete_prompt(prompt)
132
117
  if optimizer:
133
118
  if optimizer in self.__available_optimizers:
134
119
  conversation_prompt = getattr(Optimizers, optimizer)(
135
120
  conversation_prompt if conversationally else prompt
136
121
  )
137
- if self.logger:
138
- self.logger.debug(f"Applied optimizer: {optimizer}")
139
122
  else:
140
- if self.logger:
141
- self.logger.error(f"Invalid optimizer: {optimizer}")
142
123
  raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
143
124
 
144
125
  payload = {
@@ -147,9 +128,6 @@ class PIZZAGPT(Provider):
147
128
  "searchEnabled": web_search
148
129
  }
149
130
 
150
- if self.logger:
151
- self.logger.debug(f"Sending payload: {json.dumps(payload, indent=2)}")
152
-
153
131
  try:
154
132
  response = self.session.post(
155
133
  self.api_endpoint,
@@ -157,26 +135,17 @@ class PIZZAGPT(Provider):
157
135
  timeout=self.timeout
158
136
  )
159
137
 
160
- if self.logger:
161
- self.logger.debug(f"Response status: {response.status_code}")
162
-
163
138
  if not response.ok:
164
- if self.logger:
165
- self.logger.error(f"API request failed: {response.status_code} - {response.reason}")
166
139
  raise exceptions.FailedToGenerateResponseError(
167
140
  f"Failed to generate response - ({response.status_code}, {response.reason})"
168
141
  )
169
142
 
170
143
  response_text = response.text
171
144
  if not response_text:
172
- if self.logger:
173
- self.logger.error("Empty response received from API")
174
145
  raise exceptions.FailedToGenerateResponseError("Empty response received from API")
175
146
 
176
147
  try:
177
148
  resp = self._extract_content(response_text)
178
- if self.logger:
179
- self.logger.debug("Response parsed successfully")
180
149
 
181
150
  self.last_response.update(dict(text=resp['content']))
182
151
  self.conversation.update_chat_history(
@@ -185,14 +154,9 @@ class PIZZAGPT(Provider):
185
154
  return self.last_response
186
155
 
187
156
  except Exception as e:
188
- if self.logger:
189
- self.logger.error(f"Failed to parse response: {str(e)}")
190
- self.logger.debug(f"Raw response text: {response_text[:500]}")
191
157
  raise exceptions.FailedToGenerateResponseError(f"Failed to parse response: {str(e)}")
192
158
 
193
159
  except requests.exceptions.RequestException as e:
194
- if self.logger:
195
- self.logger.error(f"Request failed: {str(e)}")
196
160
  raise exceptions.FailedToGenerateResponseError(f"Request failed: {str(e)}")
197
161
 
198
162
  def chat(
@@ -206,9 +170,6 @@ class PIZZAGPT(Provider):
206
170
  """
207
171
  Chat with PizzaGPT with optional web search capability.
208
172
  """
209
- if self.logger:
210
- self.logger.debug(f"Chat request initiated with web_search={web_search}")
211
-
212
173
  try:
213
174
  response = self.ask(
214
175
  prompt,
@@ -218,8 +179,6 @@ class PIZZAGPT(Provider):
218
179
  )
219
180
  return self.get_message(response)
220
181
  except Exception as e:
221
- if self.logger:
222
- self.logger.error(f"Chat failed: {str(e)}")
223
182
  raise
224
183
 
225
184
  def get_message(self, response: dict) -> str:
@@ -231,9 +190,9 @@ if __name__ == "__main__":
231
190
  from rich import print
232
191
 
233
192
  # Example usage with web search enabled
234
- ai = PIZZAGPT(logging=True)
193
+ ai = PIZZAGPT()
235
194
  try:
236
- response = ai.chat("Who is Founder and CEO of HelpingAI??", web_search=True)
195
+ response = ai.chat("hi")
237
196
  print(response)
238
197
  except Exception as e:
239
198
  print(f"Error: {str(e)}")
@@ -9,15 +9,8 @@ from aiohttp import ClientError
9
9
  from pathlib import Path
10
10
 
11
11
  from webscout.AIbase import AsyncImageProvider
12
- from webscout.Litlogger import Logger, LogFormat
13
12
  from webscout.litagent import LitAgent
14
13
 
15
- # Initialize our fire logger and agent 🔥
16
- logger = Logger(
17
- "AsyncAiForce",
18
- format=LogFormat.MODERN_EMOJI,
19
-
20
- )
21
14
  agent = LitAgent()
22
15
 
23
16
  class AsyncAiForceimager(AsyncImageProvider):
@@ -46,8 +39,6 @@ class AsyncAiForceimager(AsyncImageProvider):
46
39
  AVAILABLE_MODELS = [
47
40
  "stable-diffusion-xl-lightning",
48
41
  "stable-diffusion-xl-base",
49
- "Flux-1.1-Pro",
50
- "ideogram",
51
42
  "flux",
52
43
  "flux-realism",
53
44
  "flux-anime",
@@ -58,13 +49,12 @@ class AsyncAiForceimager(AsyncImageProvider):
58
49
  "any-dark"
59
50
  ]
60
51
 
61
- def __init__(self, timeout: int = 60, proxies: dict = {}, logging: bool = True):
52
+ def __init__(self, timeout: int = 60, proxies: dict = {}):
62
53
  """Initialize your async AiForce provider with custom settings! ⚙️
63
54
 
64
55
  Args:
65
56
  timeout (int): Request timeout in seconds (default: 60)
66
57
  proxies (dict): Proxy settings for requests (default: {})
67
- logging (bool): Enable fire logging (default: True)
68
58
  """
69
59
  self.api_endpoint = "https://api.airforce/imagine2"
70
60
  self.headers = {
@@ -77,16 +67,13 @@ class AsyncAiForceimager(AsyncImageProvider):
77
67
  self.proxies = proxies
78
68
  self.prompt: str = "AI-generated image - webscout"
79
69
  self.image_extension: str = "png"
80
- self.logging = logging
81
- if self.logging:
82
- logger.info("AsyncAiForce provider initialized! 🚀")
83
70
 
84
71
  async def generate(
85
72
  self,
86
73
  prompt: str,
87
74
  amount: int = 1,
88
75
  additives: bool = True,
89
- model: str = "Flux-1.1-Pro",
76
+ model: str = "flux-3d",
90
77
  width: int = 768,
91
78
  height: int = 768,
92
79
  seed: Optional[int] = None,
@@ -104,7 +91,7 @@ class AsyncAiForceimager(AsyncImageProvider):
104
91
  ... images = await provider.generate(
105
92
  ... prompt="Epic dragon",
106
93
  ... amount=3,
107
- ... model="Flux-1.1-Pro"
94
+ ... model="flux-3d"
108
95
  ... )
109
96
 
110
97
  Args:
@@ -143,9 +130,6 @@ class AsyncAiForceimager(AsyncImageProvider):
143
130
  self.prompt = prompt
144
131
  response = []
145
132
 
146
- if self.logging:
147
- logger.info(f"Generating {amount} images with {model}... 🎨")
148
-
149
133
  async with aiohttp.ClientSession(headers=self.headers) as session:
150
134
  for i in range(amount):
151
135
  url = f"{self.api_endpoint}?model={model}&prompt={prompt}&size={width}:{height}"
@@ -157,21 +141,13 @@ class AsyncAiForceimager(AsyncImageProvider):
157
141
  async with session.get(url, timeout=self.timeout, proxy=self.proxies.get('http')) as resp:
158
142
  resp.raise_for_status()
159
143
  response.append(await resp.read())
160
- if self.logging:
161
- logger.success(f"Generated image {i + 1}/{amount}! 🎨")
162
144
  break
163
145
  except ClientError as e:
164
146
  if attempt == max_retries - 1:
165
- if self.logging:
166
- logger.error(f"Failed to generate image after {max_retries} attempts: {e} 😢")
167
147
  raise
168
148
  else:
169
- if self.logging:
170
- logger.warning(f"Attempt {attempt + 1} failed. Retrying in {retry_delay} seconds... 🔄")
171
149
  await asyncio.sleep(retry_delay)
172
150
 
173
- if self.logging:
174
- logger.success("Images generated successfully! 🎉")
175
151
  return response
176
152
 
177
153
  async def save(
@@ -209,16 +185,11 @@ class AsyncAiForceimager(AsyncImageProvider):
209
185
  save_dir = dir if dir else os.getcwd()
210
186
  if not os.path.exists(save_dir):
211
187
  os.makedirs(save_dir)
212
- if self.logging:
213
- logger.info(f"Created directory: {save_dir} 📁")
214
188
 
215
189
  name = self.prompt if name is None else name
216
190
  saved_paths = []
217
191
  timestamp = int(time.time())
218
192
 
219
- if self.logging:
220
- logger.info(f"Saving {len(response)} images... 💾")
221
-
222
193
  async def save_single_image(image_bytes: bytes, index: int) -> str:
223
194
  filename = f"{filenames_prefix}{name}_{index}.{self.image_extension}"
224
195
  filepath = os.path.join(save_dir, filename)
@@ -228,8 +199,6 @@ class AsyncAiForceimager(AsyncImageProvider):
228
199
  with open(filepath, "wb") as f:
229
200
  f.write(image_bytes)
230
201
 
231
- if self.logging:
232
- logger.success(f"Saved image to: {filepath} 💾")
233
202
  return filepath
234
203
 
235
204
  # Handle both List[bytes] and AsyncGenerator
@@ -240,8 +209,6 @@ class AsyncAiForceimager(AsyncImageProvider):
240
209
 
241
210
  tasks = [save_single_image(img, i) for i, img in enumerate(image_list)]
242
211
  saved_paths = await asyncio.gather(*tasks)
243
- if self.logging:
244
- logger.success(f"Images saved successfully! Check {dir} 🎉")
245
212
  return saved_paths
246
213
 
247
214
  if __name__ == "__main__":
@@ -252,6 +219,6 @@ if __name__ == "__main__":
252
219
  paths = await bot.save(resp)
253
220
  print(paths)
254
221
  except Exception as e:
255
- logger.error(f"An error occurred: {e} 😢")
222
+ print(f"An error occurred: {e}")
256
223
 
257
224
  asyncio.run(main())