webscout 8.2.4__py3-none-any.whl → 8.2.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 (110) hide show
  1. webscout/AIauto.py +112 -22
  2. webscout/AIutel.py +240 -344
  3. webscout/Extra/autocoder/autocoder.py +66 -5
  4. webscout/Extra/gguf.py +2 -0
  5. webscout/Provider/AISEARCH/scira_search.py +3 -5
  6. webscout/Provider/Aitopia.py +75 -51
  7. webscout/Provider/AllenAI.py +64 -67
  8. webscout/Provider/ChatGPTClone.py +33 -34
  9. webscout/Provider/ChatSandbox.py +342 -0
  10. webscout/Provider/Cloudflare.py +79 -32
  11. webscout/Provider/Deepinfra.py +69 -56
  12. webscout/Provider/ElectronHub.py +48 -39
  13. webscout/Provider/ExaChat.py +36 -20
  14. webscout/Provider/GPTWeb.py +24 -18
  15. webscout/Provider/GithubChat.py +52 -49
  16. webscout/Provider/GizAI.py +285 -0
  17. webscout/Provider/Glider.py +39 -28
  18. webscout/Provider/Groq.py +48 -20
  19. webscout/Provider/HeckAI.py +18 -36
  20. webscout/Provider/Jadve.py +30 -37
  21. webscout/Provider/LambdaChat.py +36 -59
  22. webscout/Provider/MCPCore.py +18 -21
  23. webscout/Provider/Marcus.py +23 -14
  24. webscout/Provider/Nemotron.py +218 -0
  25. webscout/Provider/Netwrck.py +35 -26
  26. webscout/Provider/OPENAI/__init__.py +1 -1
  27. webscout/Provider/OPENAI/exachat.py +4 -0
  28. webscout/Provider/OPENAI/scirachat.py +3 -4
  29. webscout/Provider/OPENAI/textpollinations.py +20 -22
  30. webscout/Provider/OPENAI/toolbaz.py +1 -0
  31. webscout/Provider/PI.py +22 -13
  32. webscout/Provider/StandardInput.py +42 -30
  33. webscout/Provider/TeachAnything.py +24 -12
  34. webscout/Provider/TextPollinationsAI.py +78 -76
  35. webscout/Provider/TwoAI.py +120 -88
  36. webscout/Provider/TypliAI.py +305 -0
  37. webscout/Provider/Venice.py +24 -22
  38. webscout/Provider/VercelAI.py +31 -12
  39. webscout/Provider/WiseCat.py +1 -1
  40. webscout/Provider/WrDoChat.py +370 -0
  41. webscout/Provider/__init__.py +11 -13
  42. webscout/Provider/ai4chat.py +5 -3
  43. webscout/Provider/akashgpt.py +59 -66
  44. webscout/Provider/asksteve.py +53 -44
  45. webscout/Provider/cerebras.py +77 -31
  46. webscout/Provider/chatglm.py +47 -37
  47. webscout/Provider/elmo.py +38 -32
  48. webscout/Provider/freeaichat.py +57 -43
  49. webscout/Provider/granite.py +24 -21
  50. webscout/Provider/hermes.py +27 -20
  51. webscout/Provider/learnfastai.py +25 -20
  52. webscout/Provider/llmchatco.py +48 -78
  53. webscout/Provider/multichat.py +13 -3
  54. webscout/Provider/scira_chat.py +50 -30
  55. webscout/Provider/scnet.py +27 -21
  56. webscout/Provider/searchchat.py +16 -24
  57. webscout/Provider/sonus.py +37 -39
  58. webscout/Provider/toolbaz.py +24 -46
  59. webscout/Provider/turboseek.py +37 -41
  60. webscout/Provider/typefully.py +30 -22
  61. webscout/Provider/typegpt.py +47 -51
  62. webscout/Provider/uncovr.py +46 -40
  63. webscout/__init__.py +0 -1
  64. webscout/cli.py +256 -0
  65. webscout/conversation.py +305 -448
  66. webscout/exceptions.py +3 -0
  67. webscout/swiftcli/__init__.py +80 -794
  68. webscout/swiftcli/core/__init__.py +7 -0
  69. webscout/swiftcli/core/cli.py +297 -0
  70. webscout/swiftcli/core/context.py +104 -0
  71. webscout/swiftcli/core/group.py +241 -0
  72. webscout/swiftcli/decorators/__init__.py +28 -0
  73. webscout/swiftcli/decorators/command.py +221 -0
  74. webscout/swiftcli/decorators/options.py +220 -0
  75. webscout/swiftcli/decorators/output.py +252 -0
  76. webscout/swiftcli/exceptions.py +21 -0
  77. webscout/swiftcli/plugins/__init__.py +9 -0
  78. webscout/swiftcli/plugins/base.py +135 -0
  79. webscout/swiftcli/plugins/manager.py +262 -0
  80. webscout/swiftcli/utils/__init__.py +59 -0
  81. webscout/swiftcli/utils/formatting.py +252 -0
  82. webscout/swiftcli/utils/parsing.py +267 -0
  83. webscout/version.py +1 -1
  84. {webscout-8.2.4.dist-info → webscout-8.2.6.dist-info}/METADATA +166 -45
  85. {webscout-8.2.4.dist-info → webscout-8.2.6.dist-info}/RECORD +89 -89
  86. {webscout-8.2.4.dist-info → webscout-8.2.6.dist-info}/WHEEL +1 -1
  87. webscout-8.2.6.dist-info/entry_points.txt +3 -0
  88. {webscout-8.2.4.dist-info → webscout-8.2.6.dist-info}/top_level.txt +0 -1
  89. inferno/__init__.py +0 -6
  90. inferno/__main__.py +0 -9
  91. inferno/cli.py +0 -6
  92. inferno/lol.py +0 -589
  93. webscout/LLM.py +0 -442
  94. webscout/Local/__init__.py +0 -12
  95. webscout/Local/__main__.py +0 -9
  96. webscout/Local/api.py +0 -576
  97. webscout/Local/cli.py +0 -516
  98. webscout/Local/config.py +0 -75
  99. webscout/Local/llm.py +0 -287
  100. webscout/Local/model_manager.py +0 -253
  101. webscout/Local/server.py +0 -721
  102. webscout/Local/utils.py +0 -93
  103. webscout/Provider/Chatify.py +0 -175
  104. webscout/Provider/PizzaGPT.py +0 -228
  105. webscout/Provider/askmyai.py +0 -158
  106. webscout/Provider/gaurish.py +0 -244
  107. webscout/Provider/promptrefine.py +0 -193
  108. webscout/Provider/tutorai.py +0 -270
  109. webscout-8.2.4.dist-info/entry_points.txt +0 -5
  110. {webscout-8.2.4.dist-info → webscout-8.2.6.dist-info}/licenses/LICENSE.md +0 -0
webscout/AIauto.py CHANGED
@@ -1,3 +1,9 @@
1
+ """
2
+ This module provides the AUTO provider, which automatically selects and uses
3
+ an available LLM provider from the webscout library that doesn't require
4
+ API keys or cookies.
5
+ """
6
+
1
7
  from webscout.AIbase import Provider
2
8
  from webscout.exceptions import AllProvidersFailure
3
9
  from typing import Union, Any, Dict, Generator
@@ -7,8 +13,20 @@ import random
7
13
  import inspect
8
14
 
9
15
  def load_providers():
16
+ """
17
+ Dynamically loads all Provider classes from the webscout.Provider package.
18
+
19
+ Identifies providers that require special authentication parameters like
20
+ 'api_key', 'cookie_file', or 'cookie_path'.
21
+
22
+ Returns:
23
+ tuple: A tuple containing:
24
+ - provider_map (dict): A dictionary mapping uppercase provider names to their classes.
25
+ - api_key_providers (set): A set of uppercase provider names requiring special authentication.
26
+ """
10
27
  provider_map = {}
11
28
  api_key_providers = set()
29
+ cookie_providers = set()
12
30
  provider_package = importlib.import_module("webscout.Provider")
13
31
 
14
32
  for _, module_name, _ in pkgutil.iter_modules(provider_package.__path__):
@@ -18,16 +36,24 @@ def load_providers():
18
36
  attr = getattr(module, attr_name)
19
37
  if isinstance(attr, type) and issubclass(attr, Provider) and attr != Provider:
20
38
  provider_map[attr_name.upper()] = attr
21
- # Check if the provider needs an API key
22
- if 'api_key' in inspect.signature(attr.__init__).parameters:
39
+ # Check if the provider needs special parameters
40
+ sig = inspect.signature(attr.__init__).parameters
41
+ if 'api_key' in sig:
23
42
  api_key_providers.add(attr_name.upper())
43
+ if 'cookie_file' in sig or 'cookie_path' in sig:
44
+ cookie_providers.add(attr_name.upper())
24
45
  except Exception:
25
46
  pass
26
- return provider_map, api_key_providers
47
+ return provider_map, api_key_providers.union(cookie_providers)
27
48
 
28
49
  provider_map, api_key_providers = load_providers()
29
50
 
30
51
  class AUTO(Provider):
52
+ """
53
+ An automatic provider that cycles through available free providers
54
+ until one successfully processes the request. Excludes providers
55
+ requiring API keys or cookies by default.
56
+ """
31
57
  def __init__(
32
58
  self,
33
59
  is_conversation: bool = True,
@@ -40,26 +66,51 @@ class AUTO(Provider):
40
66
  history_offset: int = 10250,
41
67
  act: str = None,
42
68
  exclude: list[str] = [],
69
+ print_provider_info: bool = False,
43
70
  ):
44
- self.provider = None
45
- self.provider_name = None
46
- self.is_conversation = is_conversation
47
- self.max_tokens = max_tokens
48
- self.timeout = timeout
49
- self.intro = intro
50
- self.filepath = filepath
51
- self.update_file = update_file
52
- self.proxies = proxies
53
- self.history_offset = history_offset
54
- self.act = act
55
- self.exclude = [e.upper() for e in exclude]
71
+ """
72
+ Initializes the AUTO provider.
73
+
74
+ Args:
75
+ is_conversation (bool): Flag for conversational mode. Defaults to True.
76
+ max_tokens (int): Maximum tokens for the response. Defaults to 600.
77
+ timeout (int): Request timeout in seconds. Defaults to 30.
78
+ intro (str, optional): Introductory prompt. Defaults to None.
79
+ filepath (str, optional): Path for conversation history. Defaults to None.
80
+ update_file (bool): Whether to update the history file. Defaults to True.
81
+ proxies (dict): Proxies for requests. Defaults to {}.
82
+ history_offset (int): History character offset limit. Defaults to 10250.
83
+ act (str, optional): Awesome prompt key. Defaults to None.
84
+ exclude (list[str]): List of provider names (uppercase) to exclude. Defaults to [].
85
+ print_provider_info (bool): Whether to print the name of the successful provider. Defaults to False.
86
+ """
87
+ self.provider = None # type: Provider
88
+ self.provider_name = None # type: str
89
+ self.is_conversation: bool = is_conversation
90
+ self.max_tokens: int = max_tokens
91
+ self.timeout: int = timeout
92
+ self.intro: str = intro
93
+ self.filepath: str = filepath
94
+ self.update_file: bool = update_file
95
+ self.proxies: dict = proxies
96
+ self.history_offset: int = history_offset
97
+ self.act: str = act
98
+ self.exclude: list[str] = [e.upper() for e in exclude]
99
+ self.print_provider_info: bool = print_provider_info
100
+
56
101
 
57
102
  @property
58
103
  def last_response(self) -> dict[str, Any]:
104
+ """
105
+ Returns the last response dictionary from the successful provider.
106
+ """
59
107
  return self.provider.last_response if self.provider else {}
60
108
 
61
109
  @property
62
110
  def conversation(self) -> object:
111
+ """
112
+ Returns the conversation object from the successful provider.
113
+ """
63
114
  return self.provider.conversation if self.provider else None
64
115
 
65
116
  def ask(
@@ -69,8 +120,21 @@ class AUTO(Provider):
69
120
  raw: bool = False,
70
121
  optimizer: str = None,
71
122
  conversationally: bool = False,
72
- run_new_test: bool = False,
73
123
  ) -> Union[Dict, Generator]:
124
+ """
125
+ Sends the prompt to providers, trying each available free provider
126
+ in a random order until one succeeds.
127
+
128
+ Args:
129
+ prompt (str): The user's prompt.
130
+ stream (bool): Whether to stream the response. Defaults to False.
131
+ raw (bool): Whether to return the raw response format. Defaults to False.
132
+ optimizer (str, optional): Name of the optimizer to use. Defaults to None.
133
+ conversationally (bool): Whether to apply optimizer conversationally. Defaults to False.
134
+
135
+ Returns:
136
+ Union[Dict, Generator]: The response dictionary or generator from the successful provider.
137
+ """
74
138
  ask_kwargs = {
75
139
  "prompt": prompt,
76
140
  "stream": stream,
@@ -105,6 +169,9 @@ class AUTO(Provider):
105
169
  act=self.act,
106
170
  )
107
171
  response = self.provider.ask(**ask_kwargs)
172
+ # Print provider info if enabled
173
+ if self.print_provider_info:
174
+ print(f"\033[1;34m{self.provider_name}\033[0m\n")
108
175
  return response
109
176
  except Exception:
110
177
  continue
@@ -118,26 +185,49 @@ class AUTO(Provider):
118
185
  stream: bool = False,
119
186
  optimizer: str = None,
120
187
  conversationally: bool = False,
121
- run_new_test: bool = False,
122
188
  ) -> Union[str, Generator[str, None, None]]:
189
+ """
190
+ Provides a simplified chat interface, returning the message string(s).
191
+
192
+ Args:
193
+ prompt (str): The user's prompt.
194
+ stream (bool): Whether to stream the response. Defaults to False.
195
+ optimizer (str, optional): Name of the optimizer to use. Defaults to None.
196
+ conversationally (bool): Whether to apply optimizer conversationally. Defaults to False.
197
+
198
+ Returns:
199
+ Union[str, Generator[str, None, None]]: The response string or a generator yielding
200
+ response chunks.
201
+ """
202
+ # run_new_test is not used in the current implementation, but we keep it for API compatibility
123
203
  response = self.ask(
124
204
  prompt,
125
205
  stream,
126
206
  optimizer=optimizer,
127
207
  conversationally=conversationally,
128
- run_new_test=run_new_test,
129
208
  )
130
209
 
131
210
  if stream:
132
- return (self.get_message(chunk) for chunk in response)
211
+ for chunk in response:
212
+ yield self.get_message(chunk)
133
213
  else:
134
214
  return self.get_message(response)
135
215
 
136
216
  def get_message(self, response: dict) -> str:
217
+ """
218
+ Extracts the message text from the provider's response dictionary.
219
+
220
+ Args:
221
+ response (dict): The response dictionary from the ask method.
222
+
223
+ Returns:
224
+ str: The extracted message string.
225
+ """
137
226
  assert self.provider is not None, "Chat with AI first"
138
227
  return self.provider.get_message(response)
139
228
 
140
229
  if __name__ == "__main__":
141
- auto = AUTO()
142
- response = auto.chat("Hello, how are you?")
143
- print(response)
230
+ auto = AUTO(print_provider_info=True)
231
+ response = auto.chat("Hello, how are you?", stream=True)
232
+ for chunk in response:
233
+ print(chunk, end="", flush=True)