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
@@ -1,270 +0,0 @@
1
- from curl_cffi.requests import Session
2
- from curl_cffi import CurlError
3
- import os
4
- from typing import Union, List, Optional
5
- from string import punctuation
6
- from random import choice
7
- import json
8
- from webscout.AIutel import Optimizers
9
- from webscout.AIutel import Conversation
10
- from webscout.AIutel import AwesomePrompts
11
- from webscout.AIbase import Provider
12
- from webscout import exceptions
13
- from webscout.litagent import LitAgent
14
-
15
- class TutorAI(Provider):
16
- """
17
- A class to interact with the TutorAI.me API.
18
- """
19
- AVAILABLE_MODELS = ["gpt-4o"]
20
-
21
- def __init__(
22
- self,
23
- is_conversation: bool = True,
24
- max_tokens: int = 600,
25
- timeout: int = 30,
26
- intro: str = None,
27
- filepath: str = None,
28
- update_file: bool = True,
29
- proxies: dict = {},
30
- history_offset: int = 10250,
31
- act: str = None,
32
- ):
33
- """
34
- Initializes the TutorAI.me API with given parameters.
35
-
36
- Args:
37
- is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
38
- max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 1024.
39
- timeout (int, optional): Http request timeout. Defaults to 30.
40
- intro (str, optional): Conversation introductory prompt. Defaults to None.
41
- filepath (str, optional): Path to file containing conversation history. Defaults to None.
42
- update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
43
- proxies (dict, optional): Http request proxies. Defaults to {}.
44
- history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
45
- act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
46
- system_prompt (str, optional): System prompt for TutorAI.
47
- Defaults to "You are a helpful AI assistant.".
48
- """
49
- # Initialize curl_cffi Session
50
- self.session = Session()
51
- self.is_conversation = is_conversation
52
- self.max_tokens_to_sample = max_tokens
53
- self.api_endpoint = "https://ai-tutor.ai/api/generate-homeworkify-response"
54
- self.stream_chunk_size = 1024
55
- self.timeout = timeout
56
- self.last_response = {}
57
- # Remove Cookie header, curl_cffi doesn't use it directly like this
58
- self.headers = {
59
- "Accept": "*/*",
60
- "Accept-Encoding": "gzip, deflate, br, zstd",
61
- "Accept-Language": "en-US,en;q=0.9,en-IN;q=0.8",
62
- "DNT": "1",
63
- "Origin": "https://tutorai.me",
64
- "Priority": "u=1, i",
65
- "Referer": "https://tutorai.me/homeworkify?ref=taaft&utm_source=taaft&utm_medium=referral",
66
- "Sec-Ch-Ua": '"Microsoft Edge";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
67
- "Sec-Ch-Ua-Mobile": "?0",
68
- "Sec-Ch-Ua-Platform": '"Windows"',
69
- "Sec-Fetch-Dest": "empty",
70
- "Sec-Fetch-Mode": "cors",
71
- "Sec-Fetch-Site": "same-origin",
72
- "User-Agent": LitAgent().random()
73
- }
74
-
75
- self.__available_optimizers = (
76
- method
77
- for method in dir(Optimizers)
78
- if callable(getattr(Optimizers, method)) and not method.startswith("__")
79
- )
80
- # Update curl_cffi session headers and proxies
81
- self.session.headers.update(self.headers)
82
- self.session.proxies = proxies # Assign proxies directly
83
- Conversation.intro = (
84
- AwesomePrompts().get_act(
85
- act, raise_not_found=True, default=None, case_insensitive=True
86
- )
87
- if act
88
- else intro or Conversation.intro
89
- )
90
- self.conversation = Conversation(
91
- is_conversation, self.max_tokens_to_sample, filepath, update_file
92
- )
93
- self.conversation.history_offset = history_offset
94
-
95
- def ask(
96
- self,
97
- prompt: str,
98
- stream: bool = False, # Note: API doesn't seem to truly stream text chunks
99
- raw: bool = False,
100
- optimizer: str = None,
101
- conversationally: bool = False,
102
- attachment_path: Optional[str] = None
103
- ) -> dict:
104
- """Chat with TutorAI
105
-
106
- Args:
107
- prompt (str): Prompt to be send.
108
- stream (bool, optional): Flag for streaming response. Defaults to False.
109
- raw (bool, optional): Stream back raw response as received. Defaults to False.
110
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
111
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
112
- attachment_path (str, optional): Path to attachment file. Defaults to None.
113
-
114
- Returns:
115
- dict : {}
116
- ```json
117
- {
118
- "text" : "How may I assist you today?"
119
- }
120
- ```
121
- """
122
- conversation_prompt = self.conversation.gen_complete_prompt(prompt)
123
- if optimizer:
124
- if optimizer in self.__available_optimizers:
125
- conversation_prompt = getattr(Optimizers, optimizer)(conversation_prompt if conversationally else prompt)
126
- else:
127
- raise Exception(
128
- f"Optimizer is not one of {self.__available_optimizers}"
129
- )
130
-
131
- form_data = {
132
- "inputMessage": conversation_prompt,
133
- "attachmentsCount": "1" if attachment_path else "0"
134
- }
135
- files = {}
136
- file_handle = None # To ensure file is closed
137
- if attachment_path:
138
- if not os.path.isfile(attachment_path):
139
- raise FileNotFoundError(f"Error: The file '{attachment_path}' does not exist.")
140
- try:
141
- # Open file handle to pass to curl_cffi
142
- file_handle = open(attachment_path, 'rb')
143
- files["attachment0"] = (os.path.basename(attachment_path), file_handle, 'image/png') # Adjust mime type if needed
144
- except Exception as e:
145
- if file_handle: file_handle.close() # Close if opened
146
- raise exceptions.FailedToGenerateResponseError(f"Error opening the file: {e}")
147
-
148
- # The API doesn't seem to support streaming text chunks based on the original code.
149
- # Both stream=True and stream=False resulted in processing the full response.
150
- # We will implement the non-stream logic for both cases.
151
- try:
152
- # Use curl_cffi session post with impersonate
153
- # Pass data and files for multipart/form-data
154
- response = self.session.post(
155
- self.api_endpoint,
156
- # headers are set on the session
157
- data=form_data,
158
- files=files,
159
- timeout=self.timeout,
160
- impersonate="chrome120", # Try a different impersonation profile
161
- )
162
- response.raise_for_status() # Check for HTTP errors
163
-
164
- try:
165
- response_data = response.json()
166
- except json.JSONDecodeError as json_err:
167
- raise exceptions.FailedToGenerateResponseError(f"Error decoding JSON: {json_err} - Response text: {response.text}")
168
-
169
- homeworkify_html = response_data.get("homeworkifyResponse", "")
170
- if not homeworkify_html:
171
- # Return empty if no content, consistent with original non-stream logic
172
- clean_text = ""
173
- else:
174
- # Assuming the response is HTML that needs cleaning/parsing
175
- # For now, just return the raw HTML content as text
176
- clean_text = homeworkify_html
177
-
178
- self.last_response = {"text": clean_text}
179
- self.conversation.update_chat_history(prompt, clean_text)
180
- return self.last_response # Return the full response content
181
-
182
- except CurlError as e: # Catch CurlError
183
- raise exceptions.FailedToGenerateResponseError(f"Request failed (CurlError): {e}")
184
- except Exception as e: # Catch other potential exceptions
185
- # Include response text if available in HTTP errors
186
- err_text = getattr(e, 'response', None) and getattr(e.response, 'text', '')
187
- raise exceptions.FailedToGenerateResponseError(f"An unexpected error occurred ({type(e).__name__}): {e} - {err_text}")
188
- finally:
189
- if file_handle: # Ensure file is closed
190
- file_handle.close()
191
-
192
-
193
- def chat(
194
- self,
195
- prompt: str,
196
- stream: bool = False, # Keep stream param for interface consistency, though API might not support it
197
- optimizer: str = None,
198
- conversationally: bool = False,
199
- attachment_path: Optional[str] = None,
200
- ) -> str:
201
- """Generate response `str`
202
- Args:
203
- prompt (str): Prompt to be send.
204
- stream (bool, optional): Flag for streaming response. Defaults to False.
205
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
206
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
207
- attachment_path (str, optional): Path to attachment file. Defaults to None.
208
- Returns:
209
- str: Response generated
210
- """
211
-
212
- def for_stream():
213
- for response in self.ask(
214
- prompt, True, optimizer=optimizer, conversationally=conversationally, attachment_path=attachment_path,
215
- ):
216
- yield self.get_message(response)
217
-
218
- def for_non_stream():
219
- for response in self.ask(
220
- prompt, False, optimizer=optimizer, conversationally=conversationally, attachment_path=attachment_path,
221
- ):
222
- yield self.get_message(response)
223
-
224
- return for_stream() if stream else for_non_stream()
225
-
226
- def get_message(self, response: dict) -> str:
227
- """Retrieves message only from response
228
-
229
- Args:
230
- response (dict): Response generated by `self.ask`
231
-
232
- Returns:
233
- str: Message extracted
234
- """
235
- assert isinstance(response, dict), "Response should be of dict data-type only"
236
- return response["text"]
237
-
238
- if __name__ == "__main__":
239
- from rich import print
240
-
241
- try: # Add try-except block for testing
242
- ai = TutorAI(timeout=120) # Increased timeout for potential uploads
243
- # Test without attachment first
244
- print("[bold blue]Testing Text Prompt:[/bold blue]")
245
- response_gen = ai.chat("hello buddy", stream=True) # Test stream interface
246
- full_response = ""
247
- for chunk in response_gen:
248
- print(chunk, end="", flush=True)
249
- full_response += chunk
250
- print("\n[bold green]Text Test Complete.[/bold green]\n")
251
-
252
- # Optional: Test with attachment (replace with a valid image path)
253
- # attachment_file = "path/to/your/image.png"
254
- # if os.path.exists(attachment_file):
255
- # print(f"[bold blue]Testing with Attachment ({attachment_file}):[/bold blue]")
256
- # response_gen_attach = ai.chat("Describe this image", stream=True, attachment_path=attachment_file)
257
- # full_response_attach = ""
258
- # for chunk in response_gen_attach:
259
- # print(chunk, end="", flush=True)
260
- # full_response_attach += chunk
261
- # print("\n[bold green]Attachment Test Complete.[/bold green]")
262
- # else:
263
- # print(f"[bold yellow]Skipping attachment test: File not found at {attachment_file}[/bold yellow]")
264
-
265
- except exceptions.FailedToGenerateResponseError as e:
266
- print(f"\n[bold red]API Error:[/bold red] {e}")
267
- except FileNotFoundError as e:
268
- print(f"\n[bold red]File Error:[/bold red] {e}")
269
- except Exception as e:
270
- print(f"\n[bold red]An unexpected error occurred:[/bold red] {e}")
@@ -1,5 +0,0 @@
1
- [console_scripts]
2
- WEBS = webscout.cli:cli
3
- inferno = webscout.Local.cli:app
4
- webscout = webscout.cli:cli
5
- webscout-local = webscout.Local.cli:app