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
@@ -0,0 +1,362 @@
1
+ import requests
2
+ import json
3
+ import time
4
+ from typing import Any, Dict, List, Optional, Union, Generator
5
+
6
+ from webscout.AIutel import Conversation
7
+ from webscout.AIutel import Optimizers
8
+ from webscout.AIutel import AwesomePrompts
9
+ from webscout.AIbase import Provider
10
+ from webscout import exceptions
11
+ from webscout import LitAgent
12
+
13
+ class GithubChat(Provider):
14
+ """
15
+ A class to interact with the GitHub Copilot Chat API.
16
+ Uses cookies for authentication and supports streaming responses.
17
+ """
18
+
19
+ # Available models
20
+ AVAILABLE_MODELS = [
21
+ "gpt-4o",
22
+ "o3-mini",
23
+ "o1",
24
+ "claude-3.5-sonnet",
25
+ "claude-3.7-sonnet",
26
+ "claude-3.7-sonnet-thought",
27
+ "gemini-2.0-flash-001"
28
+
29
+ ]
30
+
31
+ def __init__(
32
+ self,
33
+ is_conversation: bool = True,
34
+ max_tokens: int = 2000,
35
+ timeout: int = 60,
36
+ intro: str = None,
37
+ filepath: str = None,
38
+ update_file: bool = True,
39
+ proxies: dict = {},
40
+ history_offset: int = 10250,
41
+ act: str = None,
42
+ model: str = "gpt-4o",
43
+ cookie_path: str = "cookies.json"
44
+ ):
45
+ """Initialize the GithubChat client."""
46
+ if model not in self.AVAILABLE_MODELS:
47
+ raise ValueError(f"Invalid model: {model}. Choose from: {', '.join(self.AVAILABLE_MODELS)}")
48
+
49
+ self.url = "https://github.com/copilot"
50
+ self.api_url = "https://api.individual.githubcopilot.com"
51
+ self.cookie_path = cookie_path
52
+ self.session = requests.Session()
53
+ self.session.proxies.update(proxies)
54
+
55
+ # Load cookies for authentication
56
+ self.cookies = self.load_cookies()
57
+
58
+ # Set up headers for all requests
59
+ self.headers = {
60
+ "Content-Type": "application/json",
61
+ "User-Agent": LitAgent().random(),
62
+ "Accept": "*/*",
63
+ "Accept-Encoding": "gzip, deflate, br",
64
+ "Accept-Language": "en-US,en;q=0.5",
65
+ "Origin": "https://github.com",
66
+ "Referer": "https://github.com/copilot",
67
+ "GitHub-Verified-Fetch": "true",
68
+ "X-Requested-With": "XMLHttpRequest",
69
+ "Connection": "keep-alive",
70
+ "Sec-Fetch-Dest": "empty",
71
+ "Sec-Fetch-Mode": "cors",
72
+ "Sec-Fetch-Site": "same-origin",
73
+ }
74
+
75
+ # Apply cookies to session
76
+ if self.cookies:
77
+ self.session.cookies.update(self.cookies)
78
+
79
+ # Set default model
80
+ self.model = model
81
+
82
+ # Provider settings
83
+ self.is_conversation = is_conversation
84
+ self.max_tokens_to_sample = max_tokens
85
+ self.timeout = timeout
86
+ self.last_response = {}
87
+
88
+ # Available optimizers
89
+ self.__available_optimizers = (
90
+ method
91
+ for method in dir(Optimizers)
92
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
93
+ )
94
+
95
+ # Set up conversation
96
+ Conversation.intro = (
97
+ AwesomePrompts().get_act(
98
+ act, raise_not_found=True, default=None, case_insensitive=True
99
+ )
100
+ if act
101
+ else intro or Conversation.intro
102
+ )
103
+
104
+ self.conversation = Conversation(
105
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
106
+ )
107
+ self.conversation.history_offset = history_offset
108
+
109
+ # Store conversation data
110
+ self._conversation_id = None
111
+ self._access_token = None
112
+
113
+ def load_cookies(self):
114
+ """Load cookies from a JSON file"""
115
+ try:
116
+ with open(self.cookie_path, 'r') as f:
117
+ cookies_data = json.load(f)
118
+
119
+ # Convert the cookie list to a dictionary format for requests
120
+ cookies = {}
121
+ for cookie in cookies_data:
122
+ # Only include cookies that are not expired and have a name and value
123
+ if 'name' in cookie and 'value':
124
+ # Check if the cookie hasn't expired
125
+ if 'expirationDate' not in cookie or cookie['expirationDate'] > time.time():
126
+ cookies[cookie['name']] = cookie['value']
127
+
128
+ return cookies
129
+ except Exception:
130
+ return {}
131
+
132
+ def get_access_token(self):
133
+ """Get GitHub Copilot access token."""
134
+ if self._access_token:
135
+ return self._access_token
136
+
137
+ url = "https://github.com/github-copilot/chat/token"
138
+
139
+ try:
140
+ response = self.session.post(url, headers=self.headers)
141
+
142
+ if response.status_code == 401:
143
+ raise exceptions.AuthenticationError("Authentication failed. Please check your cookies.")
144
+
145
+ if response.status_code != 200:
146
+ raise exceptions.FailedToGenerateResponseError(f"Failed to get access token: {response.status_code}")
147
+
148
+ data = response.json()
149
+ self._access_token = data.get("token")
150
+
151
+ if not self._access_token:
152
+ raise exceptions.FailedToGenerateResponseError("Failed to extract access token from response")
153
+
154
+ return self._access_token
155
+
156
+ except requests.exceptions.RequestException as e:
157
+ raise exceptions.FailedToGenerateResponseError(f"Failed to get access token: {str(e)}")
158
+
159
+ def create_conversation(self):
160
+ """Create a new conversation with GitHub Copilot."""
161
+ if self._conversation_id:
162
+ return self._conversation_id
163
+
164
+ access_token = self.get_access_token()
165
+ url = f"{self.api_url}/github/chat/threads"
166
+
167
+ headers = self.headers.copy()
168
+ headers["Authorization"] = f"GitHub-Bearer {access_token}"
169
+
170
+ try:
171
+ response = self.session.post(url, headers=headers)
172
+
173
+ if response.status_code == 401:
174
+ # Token might be expired, try refreshing
175
+ self._access_token = None
176
+ access_token = self.get_access_token()
177
+ headers["Authorization"] = f"GitHub-Bearer {access_token}"
178
+ response = self.session.post(url, headers=headers)
179
+
180
+ if response.status_code not in [200, 201]:
181
+ raise exceptions.FailedToGenerateResponseError(f"Failed to create conversation: {response.status_code}")
182
+
183
+ data = response.json()
184
+ self._conversation_id = data.get("thread_id")
185
+
186
+ if not self._conversation_id:
187
+ raise exceptions.FailedToGenerateResponseError("Failed to extract conversation ID from response")
188
+
189
+ return self._conversation_id
190
+
191
+ except requests.exceptions.RequestException as e:
192
+ raise exceptions.FailedToGenerateResponseError(f"Failed to create conversation: {str(e)}")
193
+
194
+ def process_response(self, response, prompt: str):
195
+ """Process streaming response and extract content."""
196
+ full_text = ""
197
+
198
+ for line in response.iter_lines(decode_unicode=True):
199
+ if not line or not line.startswith("data: "):
200
+ continue
201
+
202
+ try:
203
+ # Parse each line (remove "data: " prefix)
204
+ json_str = line[6:]
205
+ if json_str == "[DONE]":
206
+ break
207
+
208
+ data = json.loads(json_str)
209
+
210
+ # Handle different response types
211
+ if data.get("type") == "content":
212
+ token = data.get("body", "")
213
+ full_text += token
214
+ resp = {"text": token}
215
+ yield resp
216
+
217
+ except json.JSONDecodeError:
218
+ continue
219
+
220
+ # Update conversation history only for saving to file if needed
221
+ if full_text:
222
+ self.last_response = {"text": full_text}
223
+ self.conversation.update_chat_history(prompt, full_text)
224
+
225
+ def ask(
226
+ self,
227
+ prompt: str,
228
+ stream: bool = False,
229
+ raw: bool = False,
230
+ optimizer: str = None,
231
+ conversationally: bool = False,
232
+ ) -> Union[Dict[str, Any], Generator]:
233
+ """Send a message to the GitHub Copilot Chat API"""
234
+
235
+ # Apply optimizers if specified
236
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
237
+ if optimizer:
238
+ if optimizer in self.__available_optimizers:
239
+ conversation_prompt = getattr(Optimizers, optimizer)(
240
+ conversation_prompt if conversationally else prompt
241
+ )
242
+ else:
243
+ raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
244
+
245
+ # Make sure we have a conversation ID
246
+ try:
247
+ conversation_id = self.create_conversation()
248
+ except exceptions.FailedToGenerateResponseError as e:
249
+ raise exceptions.FailedToGenerateResponseError(f"Failed to create conversation: {e}")
250
+
251
+ access_token = self.get_access_token()
252
+
253
+ url = f"{self.api_url}/github/chat/threads/{conversation_id}/messages"
254
+
255
+ # Update headers for this specific request
256
+ headers = self.headers.copy()
257
+ headers["Authorization"] = f"GitHub-Bearer {access_token}"
258
+
259
+ # Prepare the request payload
260
+ request_data = {
261
+ "content": conversation_prompt,
262
+ "intent": "conversation",
263
+ "references": [],
264
+ "context": [],
265
+ "currentURL": f"https://github.com/copilot/c/{conversation_id}",
266
+ "streaming": True,
267
+ "confirmations": [],
268
+ "customInstructions": [],
269
+ "model": self.model,
270
+ "mode": "immersive"
271
+ }
272
+
273
+ def for_stream():
274
+ try:
275
+ response = self.session.post(
276
+ url,
277
+ json=request_data,
278
+ headers=headers,
279
+ stream=True,
280
+ timeout=self.timeout
281
+ )
282
+
283
+ if response.status_code == 401:
284
+ # Token might be expired, try refreshing
285
+ self._access_token = None
286
+ access_token = self.get_access_token()
287
+ headers["Authorization"] = f"GitHub-Bearer {access_token}"
288
+ response = self.session.post(
289
+ url,
290
+ json=request_data,
291
+ headers=headers,
292
+ stream=True,
293
+ timeout=self.timeout
294
+ )
295
+
296
+ # If still not successful, raise exception
297
+ if response.status_code != 200:
298
+ raise exceptions.FailedToGenerateResponseError(f"Request failed with status code {response.status_code}")
299
+
300
+ # Process the streaming response
301
+ yield from self.process_response(response, prompt)
302
+
303
+ except Exception as e:
304
+ if isinstance(e, requests.exceptions.RequestException):
305
+ if hasattr(e, 'response') and e.response is not None:
306
+ status_code = e.response.status_code
307
+ if status_code == 401:
308
+ raise exceptions.AuthenticationError("Authentication failed. Please check your cookies.")
309
+
310
+ # If anything else fails
311
+ raise exceptions.FailedToGenerateResponseError(f"Request failed: {str(e)}")
312
+
313
+ def for_non_stream():
314
+ response_text = ""
315
+ for response in for_stream():
316
+ if "text" in response:
317
+ response_text += response["text"]
318
+ self.last_response = {"text": response_text}
319
+ return self.last_response
320
+
321
+ return for_stream() if stream else for_non_stream()
322
+
323
+ def chat(
324
+ self,
325
+ prompt: str,
326
+ stream: bool = False,
327
+ optimizer: str = None,
328
+ conversationally: bool = False,
329
+ ) -> Union[str, Generator]:
330
+ """Generate a response to a prompt"""
331
+ def for_stream():
332
+ for response in self.ask(
333
+ prompt, True, optimizer=optimizer, conversationally=conversationally
334
+ ):
335
+ yield self.get_message(response)
336
+
337
+ def for_non_stream():
338
+ return self.get_message(
339
+ self.ask(
340
+ prompt, False, optimizer=optimizer, conversationally=conversationally
341
+ )
342
+ )
343
+
344
+ return for_stream() if stream else for_non_stream()
345
+
346
+ def get_message(self, response: dict) -> str:
347
+ """Extract message text from response"""
348
+ assert isinstance(response, dict), "Response should be of dict data-type only"
349
+ return response.get("text", "")
350
+
351
+ if __name__ == "__main__":
352
+ # Simple test code
353
+ from rich import print
354
+
355
+ try:
356
+ ai = GithubChat()
357
+ response = ai.chat("Python code to count r in strawberry", stream=True)
358
+ for chunk in response:
359
+ print(chunk, end="", flush=True)
360
+ print()
361
+ except Exception as e:
362
+ print(f"An error occurred: {e}")
@@ -12,12 +12,12 @@ class GliderAI(Provider):
12
12
  A class to interact with the Glider.so API.
13
13
  """
14
14
 
15
- AVAILABLE_MODELS = {
15
+ AVAILABLE_MODELS = [
16
16
  "chat-llama-3-1-70b",
17
17
  "chat-llama-3-1-8b",
18
18
  "chat-llama-3-2-3b",
19
19
  "deepseek-ai/DeepSeek-R1",
20
- }
20
+ ]
21
21
 
22
22
  def __init__(
23
23
  self,
@@ -180,9 +180,26 @@ class GliderAI(Provider):
180
180
  return response["text"]
181
181
 
182
182
  if __name__ == "__main__":
183
- from rich import print
184
- # For testing
185
- ai = GliderAI(model="chat-llama-3-1-70b")
186
- response = ai.chat("Meaning of Life", stream=True)
187
- for chunk in response:
188
- print(chunk, end="", flush=True)
183
+ print("-" * 80)
184
+ print(f"{'Model':<50} {'Status':<10} {'Response'}")
185
+ print("-" * 80)
186
+
187
+ for model in GliderAI.AVAILABLE_MODELS:
188
+ try:
189
+ test_ai = GliderAI(model=model, timeout=60)
190
+ response = test_ai.chat("Say 'Hello' in one word", stream=True)
191
+ response_text = ""
192
+ for chunk in response:
193
+ response_text += chunk
194
+ print(f"\r{model:<50} {'Testing...':<10}", end="", flush=True)
195
+
196
+ if response_text and len(response_text.strip()) > 0:
197
+ status = "✓"
198
+ # Truncate response if too long
199
+ display_text = response_text.strip()[:50] + "..." if len(response_text.strip()) > 50 else response_text.strip()
200
+ else:
201
+ status = "✗"
202
+ display_text = "Empty or invalid response"
203
+ print(f"\r{model:<50} {status:<10} {display_text}")
204
+ except Exception as e:
205
+ print(f"\r{model:<50} {'✗':<10} {str(e)}")
@@ -1,10 +1,10 @@
1
1
  from dataclasses import dataclass
2
- from enum import Enum, auto
2
+ from enum import Enum
3
3
  import requests
4
4
  import json
5
5
  import re
6
6
  import uuid
7
- from typing import List, Dict, Generator, Optional, Any, TypedDict, Literal, Union, Final
7
+ from typing import List, Dict, Generator, Optional, Any, TypedDict, Final
8
8
 
9
9
  # Type definitions
10
10
  class Role(Enum):
@@ -170,6 +170,21 @@ class HeckAI(Provider):
170
170
 
171
171
  return for_stream() if stream else for_non_stream()
172
172
 
173
+ @staticmethod
174
+ def fix_encoding(text):
175
+ if isinstance(text, dict) and "text" in text:
176
+ try:
177
+ text["text"] = text["text"].encode("latin1").decode("utf-8")
178
+ return text
179
+ except (UnicodeError, AttributeError) as e:
180
+ return text
181
+ elif isinstance(text, str):
182
+ try:
183
+ return text.encode("latin1").decode("utf-8")
184
+ except (UnicodeError, AttributeError) as e:
185
+ return text
186
+ return text
187
+
173
188
  def chat(
174
189
  self,
175
190
  prompt: str,
@@ -193,8 +208,26 @@ class HeckAI(Provider):
193
208
  return response["text"]
194
209
 
195
210
  if __name__ == "__main__":
196
- from rich import print
197
- ai = HeckAI(timeout=120)
198
- response = ai.chat("Write a short poem about artificial intelligence", stream=True)
199
- for chunk in response:
200
- print(chunk, end="", flush=True)
211
+ print("-" * 80)
212
+ print(f"{'Model':<50} {'Status':<10} {'Response'}")
213
+ print("-" * 80)
214
+
215
+ for model in HeckAI.AVAILABLE_MODELS:
216
+ try:
217
+ test_ai = HeckAI(model=model, timeout=60)
218
+ response = test_ai.chat("Say 'Hello' in one word", stream=True)
219
+ response_text = ""
220
+ for chunk in response:
221
+ response_text += chunk
222
+ print(f"\r{model:<50} {'Testing...':<10}", end="", flush=True)
223
+
224
+ if response_text and len(response_text.strip()) > 0:
225
+ status = "✓"
226
+ # Truncate response if too long
227
+ display_text = response_text.strip()[:50] + "..." if len(response_text.strip()) > 50 else response_text.strip()
228
+ else:
229
+ status = "✗"
230
+ display_text = "Empty or invalid response"
231
+ print(f"\r{model:<50} {status:<10} {display_text}")
232
+ except Exception as e:
233
+ print(f"\r{model:<50} {'✗':<10} {str(e)}")