webscout 8.3.1__py3-none-any.whl → 8.3.2__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 (77) hide show
  1. webscout/AIutel.py +46 -53
  2. webscout/Bing_search.py +418 -0
  3. webscout/Extra/gguf.py +706 -177
  4. webscout/Provider/AISEARCH/genspark_search.py +7 -7
  5. webscout/Provider/GeminiProxy.py +140 -0
  6. webscout/Provider/MCPCore.py +78 -75
  7. webscout/Provider/OPENAI/BLACKBOXAI.py +1 -4
  8. webscout/Provider/OPENAI/GeminiProxy.py +328 -0
  9. webscout/Provider/OPENAI/README.md +2 -0
  10. webscout/Provider/OPENAI/README_AUTOPROXY.md +238 -0
  11. webscout/Provider/OPENAI/__init__.py +15 -1
  12. webscout/Provider/OPENAI/autoproxy.py +332 -39
  13. webscout/Provider/OPENAI/base.py +15 -5
  14. webscout/Provider/OPENAI/e2b.py +0 -1
  15. webscout/Provider/OPENAI/mcpcore.py +109 -70
  16. webscout/Provider/OPENAI/scirachat.py +59 -51
  17. webscout/Provider/OPENAI/toolbaz.py +2 -9
  18. webscout/Provider/OPENAI/xenai.py +514 -0
  19. webscout/Provider/OPENAI/yep.py +8 -2
  20. webscout/Provider/TTI/__init__.py +1 -0
  21. webscout/Provider/TTI/bing.py +231 -0
  22. webscout/Provider/TTS/speechma.py +45 -39
  23. webscout/Provider/TogetherAI.py +366 -0
  24. webscout/Provider/XenAI.py +324 -0
  25. webscout/Provider/__init__.py +8 -3
  26. webscout/Provider/deepseek_assistant.py +378 -0
  27. webscout/auth/__init__.py +44 -0
  28. webscout/auth/api_key_manager.py +189 -0
  29. webscout/auth/auth_system.py +100 -0
  30. webscout/auth/config.py +76 -0
  31. webscout/auth/database.py +400 -0
  32. webscout/auth/exceptions.py +67 -0
  33. webscout/auth/middleware.py +248 -0
  34. webscout/auth/models.py +130 -0
  35. webscout/auth/providers.py +257 -0
  36. webscout/auth/rate_limiter.py +254 -0
  37. webscout/auth/request_models.py +127 -0
  38. webscout/auth/request_processing.py +226 -0
  39. webscout/auth/routes.py +526 -0
  40. webscout/auth/schemas.py +103 -0
  41. webscout/auth/server.py +312 -0
  42. webscout/auth/static/favicon.svg +11 -0
  43. webscout/auth/swagger_ui.py +203 -0
  44. webscout/auth/templates/components/authentication.html +237 -0
  45. webscout/auth/templates/components/base.html +103 -0
  46. webscout/auth/templates/components/endpoints.html +750 -0
  47. webscout/auth/templates/components/examples.html +491 -0
  48. webscout/auth/templates/components/footer.html +75 -0
  49. webscout/auth/templates/components/header.html +27 -0
  50. webscout/auth/templates/components/models.html +286 -0
  51. webscout/auth/templates/components/navigation.html +70 -0
  52. webscout/auth/templates/static/api.js +455 -0
  53. webscout/auth/templates/static/icons.js +168 -0
  54. webscout/auth/templates/static/main.js +784 -0
  55. webscout/auth/templates/static/particles.js +201 -0
  56. webscout/auth/templates/static/styles.css +3353 -0
  57. webscout/auth/templates/static/ui.js +374 -0
  58. webscout/auth/templates/swagger_ui.html +170 -0
  59. webscout/client.py +49 -3
  60. webscout/scout/core/scout.py +104 -26
  61. webscout/scout/element.py +139 -18
  62. webscout/swiftcli/core/cli.py +14 -3
  63. webscout/swiftcli/decorators/output.py +59 -9
  64. webscout/update_checker.py +31 -49
  65. webscout/version.py +1 -1
  66. webscout/webscout_search.py +4 -12
  67. webscout/webscout_search_async.py +3 -10
  68. webscout/yep_search.py +2 -11
  69. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/METADATA +41 -11
  70. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/RECORD +74 -36
  71. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/entry_points.txt +1 -1
  72. webscout/Provider/HF_space/__init__.py +0 -0
  73. webscout/Provider/HF_space/qwen_qwen2.py +0 -206
  74. webscout/Provider/OPENAI/api.py +0 -1320
  75. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/WHEEL +0 -0
  76. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/licenses/LICENSE.md +0 -0
  77. {webscout-8.3.1.dist-info → webscout-8.3.2.dist-info}/top_level.txt +0 -0
@@ -6,8 +6,8 @@ import re
6
6
  from typing import List, Dict, Optional, Union, Generator, Any
7
7
 
8
8
  # Import base classes and utility structures
9
- from .base import OpenAICompatibleProvider, BaseChat, BaseCompletions
10
- from .utils import (
9
+ from webscout.Provider.OPENAI.base import OpenAICompatibleProvider, BaseChat, BaseCompletions
10
+ from webscout.Provider.OPENAI.utils import (
11
11
  ChatCompletionChunk, ChatCompletion, Choice, ChoiceDelta,
12
12
  ChatCompletionMessage, CompletionUsage, get_system_prompt, count_tokens
13
13
  )
@@ -16,20 +16,7 @@ from .utils import (
16
16
  try:
17
17
  from webscout.litagent import LitAgent
18
18
  except ImportError:
19
- # Define a dummy LitAgent if webscout is not installed or accessible
20
- class LitAgent:
21
- def generate_fingerprint(self, browser: str = "chrome") -> Dict[str, Any]:
22
- # Return minimal default headers if LitAgent is unavailable
23
- print("Warning: LitAgent not found. Using default minimal headers.")
24
- return {
25
- "accept": "*/*",
26
- "accept_language": "en-US,en;q=0.9",
27
- "platform": "Windows",
28
- "sec_ch_ua": '"Not/A)Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
29
- "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",
30
- "browser_type": browser,
31
- }
32
-
19
+ pass
33
20
  # --- SciraChat Client ---
34
21
 
35
22
  class Completions(BaseCompletions):
@@ -334,21 +321,37 @@ class SciraChat(OpenAICompatibleProvider):
334
321
  messages=[{"role": "user", "content": "Hello!"}]
335
322
  )
336
323
  """
337
-
338
- AVAILABLE_MODELS = {
339
- "scira-default": "Grok3-mini", # thinking model
340
- "scira-grok-3": "Grok3",
341
- "scira-anthropic": "Claude 4 Sonnet",
342
- "scira-anthropic-thinking": "Claude 4 Sonnet Thinking", # thinking model
343
- "scira-vision" : "Grok2-Vision", # vision model
344
- "scira-4o": "GPT4o",
345
- "scira-qwq": "QWQ-32B",
346
- "scira-o4-mini": "o4-mini",
347
- "scira-google": "gemini 2.5 flash Thinking", # thinking model
348
- "scira-google-pro": "gemini 2.5 pro",
349
- "scira-llama-4": "llama 4 Maverick",
324
+ # List of model display names for registration (aliases)
325
+ AVAILABLE_MODELS = [
326
+ "Grok3-mini (thinking)",
327
+ "Grok3",
328
+ "Claude 4 Sonnet",
329
+ "Claude 4 Sonnet Thinking",
330
+ "Grok2-Vision (vision)",
331
+ "GPT4o",
332
+ "QWQ-32B",
333
+ "o4-mini",
334
+ "Gemini 2.5 Flash Thinking",
335
+ "Gemini 2.5 Pro",
336
+ "Llama 4 Maverick",
337
+ ]
338
+ # Mapping from display name to internal model key
339
+ MODEL_NAME_MAP = {
340
+ "Grok3-mini (thinking)": "scira-default",
341
+ "Grok3": "scira-grok-3",
342
+ "Claude 4 Sonnet": "scira-anthropic",
343
+ "Claude 4 Sonnet Thinking": "scira-anthropic-thinking",
344
+ "Grok2-Vision (vision)": "scira-vision",
345
+ "GPT4o": "scira-4o",
346
+ "QWQ-32B": "scira-qwq",
347
+ "o4-mini": "scira-o4-mini",
348
+ "Gemini 2.5 Flash Thinking": "scira-google",
349
+ "Gemini 2.5 Pro": "scira-google-pro",
350
+ "Llama 4 Maverick": "scira-llama-4",
350
351
  }
351
-
352
+ # Optional: pretty display names for UI (reverse mapping)
353
+ MODEL_DISPLAY_NAMES = {v: k for k, v in MODEL_NAME_MAP.items()}
354
+
352
355
  def __init__(
353
356
  self,
354
357
  timeout: Optional[int] = None,
@@ -371,19 +374,9 @@ class SciraChat(OpenAICompatibleProvider):
371
374
 
372
375
  # Use the fingerprint for headers
373
376
  self.headers = {
374
- "Accept": self.fingerprint["accept"],
375
- "Accept-Encoding": "gzip, deflate, br, zstd",
376
- "Accept-Language": self.fingerprint["accept_language"],
377
- "Content-Type": "application/json",
377
+ **self.fingerprint,
378
378
  "Origin": "https://scira.ai",
379
379
  "Referer": "https://scira.ai/",
380
- "Sec-CH-UA": self.fingerprint["sec_ch_ua"] or '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
381
- "Sec-CH-UA-Mobile": "?0",
382
- "Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
383
- "User-Agent": self.fingerprint["user_agent"],
384
- "Sec-Fetch-Dest": "empty",
385
- "Sec-Fetch-Mode": "cors",
386
- "Sec-Fetch-Site": "same-origin"
387
380
  }
388
381
 
389
382
  self.session.headers.update(self.headers)
@@ -407,11 +400,7 @@ class SciraChat(OpenAICompatibleProvider):
407
400
 
408
401
  # Update headers with new fingerprint
409
402
  self.headers.update({
410
- "Accept": self.fingerprint["accept"],
411
- "Accept-Language": self.fingerprint["accept_language"],
412
- "Sec-CH-UA": self.fingerprint["sec_ch_ua"] or self.headers["Sec-CH-UA"],
413
- "Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
414
- "User-Agent": self.fingerprint["user_agent"],
403
+ **self.fingerprint,
415
404
  })
416
405
 
417
406
  # Update session headers
@@ -460,18 +449,20 @@ class SciraChat(OpenAICompatibleProvider):
460
449
 
461
450
  def convert_model_name(self, model: str) -> str:
462
451
  """
463
- Convert model names to ones supported by SciraChat.
452
+ Convert model display names or internal keys to ones supported by SciraChat.
464
453
 
465
454
  Args:
466
- model: Model name to convert
455
+ model: Model name or alias to convert
467
456
 
468
457
  Returns:
469
458
  SciraChat model name
470
459
  """
471
- # If the model is already a valid SciraChat model, return it
472
- if model in self.AVAILABLE_MODELS:
460
+ # If model is a display name (alias), map to internal key
461
+ if model in self.MODEL_NAME_MAP:
462
+ return self.MODEL_NAME_MAP[model]
463
+ # If model is already an internal key, return it if valid
464
+ if model in self.MODEL_DISPLAY_NAMES:
473
465
  return model
474
-
475
466
  # Default to scira-default if model not found
476
467
  print(f"Warning: Unknown model '{model}'. Using 'scira-default' instead.")
477
468
  return "scira-default"
@@ -480,5 +471,22 @@ class SciraChat(OpenAICompatibleProvider):
480
471
  def models(self):
481
472
  class _ModelList:
482
473
  def list(inner_self):
474
+ # Return display names (aliases)
483
475
  return type(self).AVAILABLE_MODELS
484
476
  return _ModelList()
477
+
478
+ if __name__ == "__main__":
479
+ ai = SciraChat()
480
+ response = ai.chat.completions.create(
481
+ model="Gemini 2.5 Pro",
482
+ messages=[
483
+ {"role": "user", "content": "who is pm of india?"}
484
+ ],
485
+ stream=True
486
+ )
487
+ for chunk in response:
488
+ if hasattr(chunk, "choices") and chunk.choices and hasattr(chunk.choices[0], "delta"):
489
+ content = getattr(chunk.choices[0].delta, "content", None)
490
+ if content:
491
+ print(content, end="", flush=True)
492
+ print()
@@ -337,18 +337,11 @@ class Toolbaz(OpenAICompatibleProvider):
337
337
 
338
338
  # Set up headers
339
339
  self.session.headers.update({
340
- "user-agent": LitAgent().generate_fingerprint(browser=browser)["user_agent"],
341
- "accept": "*/*",
342
- "accept-language": "en-US",
343
- "cache-control": "no-cache",
344
- "connection": "keep-alive",
345
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
346
- "origin": "https://toolbaz.com",
340
+ **LitAgent().generate_fingerprint(browser=browser),
347
341
  "pragma": "no-cache",
348
342
  "referer": "https://toolbaz.com/",
349
- "sec-fetch-mode": "cors"
350
343
  })
351
-
344
+
352
345
  # Initialize chat property
353
346
  self.chat = Chat(self)
354
347