webscout 8.0__py3-none-any.whl → 8.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 (80) hide show
  1. inferno/__init__.py +6 -0
  2. inferno/__main__.py +9 -0
  3. inferno/cli.py +6 -0
  4. webscout/Local/__init__.py +6 -0
  5. webscout/Local/__main__.py +9 -0
  6. webscout/Local/api.py +576 -0
  7. webscout/Local/cli.py +338 -0
  8. webscout/Local/config.py +75 -0
  9. webscout/Local/llm.py +188 -0
  10. webscout/Local/model_manager.py +205 -0
  11. webscout/Local/server.py +187 -0
  12. webscout/Local/utils.py +93 -0
  13. webscout/Provider/AISEARCH/DeepFind.py +1 -1
  14. webscout/Provider/AISEARCH/ISou.py +1 -1
  15. webscout/Provider/AISEARCH/Perplexity.py +359 -0
  16. webscout/Provider/AISEARCH/__init__.py +3 -1
  17. webscout/Provider/AISEARCH/felo_search.py +1 -1
  18. webscout/Provider/AISEARCH/genspark_search.py +1 -1
  19. webscout/Provider/AISEARCH/hika_search.py +1 -1
  20. webscout/Provider/AISEARCH/iask_search.py +436 -0
  21. webscout/Provider/AISEARCH/scira_search.py +9 -5
  22. webscout/Provider/AISEARCH/webpilotai_search.py +1 -1
  23. webscout/Provider/ExaAI.py +1 -1
  24. webscout/Provider/ExaChat.py +18 -8
  25. webscout/Provider/GithubChat.py +5 -1
  26. webscout/Provider/Glider.py +4 -2
  27. webscout/Provider/Jadve.py +2 -2
  28. webscout/Provider/OPENAI/__init__.py +24 -0
  29. webscout/Provider/OPENAI/base.py +46 -0
  30. webscout/Provider/OPENAI/c4ai.py +347 -0
  31. webscout/Provider/OPENAI/chatgpt.py +549 -0
  32. webscout/Provider/OPENAI/chatgptclone.py +460 -0
  33. webscout/Provider/OPENAI/deepinfra.py +284 -0
  34. webscout/Provider/OPENAI/exaai.py +419 -0
  35. webscout/Provider/OPENAI/exachat.py +433 -0
  36. webscout/Provider/OPENAI/freeaichat.py +355 -0
  37. webscout/Provider/OPENAI/glider.py +316 -0
  38. webscout/Provider/OPENAI/heckai.py +337 -0
  39. webscout/Provider/OPENAI/llmchatco.py +327 -0
  40. webscout/Provider/OPENAI/netwrck.py +348 -0
  41. webscout/Provider/OPENAI/opkfc.py +488 -0
  42. webscout/Provider/OPENAI/scirachat.py +463 -0
  43. webscout/Provider/OPENAI/sonus.py +294 -0
  44. webscout/Provider/OPENAI/standardinput.py +425 -0
  45. webscout/Provider/OPENAI/textpollinations.py +285 -0
  46. webscout/Provider/OPENAI/toolbaz.py +405 -0
  47. webscout/Provider/OPENAI/typegpt.py +361 -0
  48. webscout/Provider/OPENAI/uncovrAI.py +455 -0
  49. webscout/Provider/OPENAI/utils.py +211 -0
  50. webscout/Provider/OPENAI/venice.py +428 -0
  51. webscout/Provider/OPENAI/wisecat.py +381 -0
  52. webscout/Provider/OPENAI/writecream.py +158 -0
  53. webscout/Provider/OPENAI/x0gpt.py +389 -0
  54. webscout/Provider/OPENAI/yep.py +329 -0
  55. webscout/Provider/StandardInput.py +278 -0
  56. webscout/Provider/TextPollinationsAI.py +27 -28
  57. webscout/Provider/Venice.py +1 -1
  58. webscout/Provider/Writecream.py +211 -0
  59. webscout/Provider/WritingMate.py +197 -0
  60. webscout/Provider/Youchat.py +30 -26
  61. webscout/Provider/__init__.py +14 -6
  62. webscout/Provider/koala.py +2 -2
  63. webscout/Provider/llmchatco.py +5 -0
  64. webscout/Provider/scira_chat.py +18 -12
  65. webscout/Provider/scnet.py +187 -0
  66. webscout/Provider/toolbaz.py +320 -0
  67. webscout/Provider/typegpt.py +3 -184
  68. webscout/Provider/uncovr.py +3 -3
  69. webscout/conversation.py +32 -32
  70. webscout/prompt_manager.py +2 -1
  71. webscout/version.py +1 -1
  72. webscout-8.2.dist-info/METADATA +734 -0
  73. {webscout-8.0.dist-info → webscout-8.2.dist-info}/RECORD +77 -32
  74. webscout-8.2.dist-info/entry_points.txt +5 -0
  75. {webscout-8.0.dist-info → webscout-8.2.dist-info}/top_level.txt +1 -0
  76. webscout/Provider/flowith.py +0 -207
  77. webscout-8.0.dist-info/METADATA +0 -995
  78. webscout-8.0.dist-info/entry_points.txt +0 -3
  79. {webscout-8.0.dist-info → webscout-8.2.dist-info}/LICENSE.md +0 -0
  80. {webscout-8.0.dist-info → webscout-8.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,329 @@
1
+ import time
2
+ import uuid
3
+ import cloudscraper # Import cloudscraper
4
+ import json
5
+ from typing import List, Dict, Optional, Union, Generator, Any
6
+
7
+ # Import base classes and utility structures
8
+ from .base import OpenAICompatibleProvider, BaseChat, BaseCompletions
9
+ from .utils import (
10
+ ChatCompletionChunk, ChatCompletion, Choice, ChoiceDelta,
11
+ ChatCompletionMessage, CompletionUsage, get_system_prompt # Import get_system_prompt
12
+ )
13
+
14
+ # Attempt to import LitAgent, fallback if not available
15
+ try:
16
+ from webscout.litagent import LitAgent
17
+ except ImportError:
18
+ # Define a dummy LitAgent if webscout is not installed or accessible
19
+ class LitAgent:
20
+ def generate_fingerprint(self, browser: str = "chrome") -> Dict[str, Any]:
21
+ print("Warning: LitAgent not found. Using default minimal headers.")
22
+ return {
23
+ "accept": "*/*",
24
+ "accept_language": "en-US,en;q=0.9",
25
+ "platform": "Windows",
26
+ "sec_ch_ua": '"Not/A)Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
27
+ "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",
28
+ "browser_type": browser,
29
+ }
30
+
31
+ # --- YEPCHAT Client ---
32
+
33
+ # ANSI escape codes for formatting
34
+ BOLD = "\033[1m"
35
+ RED = "\033[91m"
36
+ RESET = "\033[0m"
37
+
38
+ class Completions(BaseCompletions):
39
+ def __init__(self, client: 'YEPCHAT'):
40
+ self._client = client
41
+
42
+ def create(
43
+ self,
44
+ *,
45
+ model: str,
46
+ messages: List[Dict[str, str]],
47
+ max_tokens: Optional[int] = 1280,
48
+ stream: bool = False,
49
+ temperature: Optional[float] = 0.6,
50
+ top_p: Optional[float] = 0.7,
51
+ system_prompt: Optional[str] = None, # Added for consistency, but will be ignored
52
+ **kwargs: Any
53
+ ) -> Union[ChatCompletion, Generator[ChatCompletionChunk, None, None]]:
54
+ """
55
+ Creates a model response for the given chat conversation using YEPCHAT API.
56
+ Mimics openai.chat.completions.create
57
+ Note: YEPCHAT does not support system messages. They will be ignored.
58
+ """
59
+ if model not in self._client.AVAILABLE_MODELS:
60
+ raise ValueError(
61
+ f"Invalid model: {model}. Choose from: {self._client.AVAILABLE_MODELS}"
62
+ )
63
+
64
+ # Filter out system messages and warn the user if any are present
65
+ filtered_messages = []
66
+ has_system_message = False
67
+ if get_system_prompt(messages) or system_prompt: # Check both message list and explicit param
68
+ has_system_message = True
69
+
70
+ for msg in messages:
71
+ if msg["role"] == "system":
72
+ continue # Skip system messages
73
+ filtered_messages.append(msg)
74
+
75
+ if has_system_message:
76
+ # Print warning in bold red
77
+ print(f"{BOLD}{RED}Warning: YEPCHAT does not support system messages, they will be ignored.{RESET}")
78
+
79
+ # If no messages left after filtering, raise an error
80
+ if not filtered_messages:
81
+ raise ValueError("At least one user or assistant message is required for YEPCHAT.")
82
+
83
+ payload = {
84
+ "stream": stream,
85
+ "max_tokens": max_tokens,
86
+ "top_p": top_p,
87
+ "temperature": temperature,
88
+ "messages": filtered_messages, # Use filtered messages
89
+ "model": model,
90
+ }
91
+
92
+ # Add any extra kwargs to the payload
93
+ payload.update(kwargs)
94
+
95
+ request_id = f"chatcmpl-{uuid.uuid4()}"
96
+ created_time = int(time.time())
97
+
98
+ if stream:
99
+ return self._create_stream(request_id, created_time, model, payload)
100
+ else:
101
+ return self._create_non_stream(request_id, created_time, model, payload)
102
+
103
+ def _create_stream(
104
+ self, request_id: str, created_time: int, model: str, payload: Dict[str, Any]
105
+ ) -> Generator[ChatCompletionChunk, None, None]:
106
+ try:
107
+ # Use session.post from cloudscraper instance
108
+ response = self._client.session.post(
109
+ self._client.api_endpoint,
110
+ headers=self._client.headers,
111
+ cookies=self._client.cookies,
112
+ json=payload,
113
+ stream=True,
114
+ timeout=self._client.timeout
115
+ )
116
+
117
+ if not response.ok:
118
+ # Simplified error handling for now, add refresh logic if needed
119
+ raise IOError(
120
+ f"YEPCHAT API Error: {response.status_code} {response.reason} - {response.text}"
121
+ )
122
+
123
+ for line in response.iter_lines(decode_unicode=True):
124
+ if line:
125
+ line = line.strip()
126
+ if line.startswith("data: "):
127
+ json_str = line[6:]
128
+ if json_str == "[DONE]":
129
+ break
130
+ try:
131
+ data = json.loads(json_str)
132
+ choice_data = data.get('choices', [{}])[0]
133
+ delta_data = choice_data.get('delta', {})
134
+ finish_reason = choice_data.get('finish_reason')
135
+ content = delta_data.get('content')
136
+
137
+ if content is not None: # Only yield chunks with content
138
+ delta = ChoiceDelta(content=content, role=delta_data.get('role', 'assistant'))
139
+ choice = Choice(index=0, delta=delta, finish_reason=finish_reason)
140
+ chunk = ChatCompletionChunk(
141
+ id=request_id,
142
+ choices=[choice],
143
+ created=created_time,
144
+ model=model,
145
+ )
146
+ yield chunk
147
+
148
+ except json.JSONDecodeError:
149
+ print(f"Warning: Could not decode JSON line: {json_str}")
150
+ continue
151
+
152
+ # Yield final chunk with finish reason if not already sent
153
+ delta = ChoiceDelta()
154
+ choice = Choice(index=0, delta=delta, finish_reason="stop") # Assume stop if loop finishes
155
+ chunk = ChatCompletionChunk(
156
+ id=request_id,
157
+ choices=[choice],
158
+ created=created_time,
159
+ model=model,
160
+ )
161
+ yield chunk
162
+
163
+ except cloudscraper.exceptions.CloudflareChallengeError as e:
164
+ pass
165
+
166
+ def _create_non_stream(
167
+ self, request_id: str, created_time: int, model: str, payload: Dict[str, Any]
168
+ ) -> ChatCompletion:
169
+ full_response_content = ""
170
+ finish_reason = "stop" # Assume stop unless error occurs
171
+
172
+ try:
173
+ stream_generator = self._create_stream(request_id, created_time, model, payload)
174
+ for chunk in stream_generator:
175
+ if chunk.choices and chunk.choices[0].delta and chunk.choices[0].delta.content:
176
+ full_response_content += chunk.choices[0].delta.content
177
+ if chunk.choices and chunk.choices[0].finish_reason:
178
+ finish_reason = chunk.choices[0].finish_reason # Capture finish reason if provided
179
+
180
+ except IOError as e:
181
+ print(f"Error obtaining non-stream response from YEPCHAT: {e}")
182
+ finish_reason = "error"
183
+
184
+ # Construct the final ChatCompletion object
185
+ message = ChatCompletionMessage(
186
+ role="assistant",
187
+ content=full_response_content
188
+ )
189
+ choice = Choice(
190
+ index=0,
191
+ message=message,
192
+ finish_reason=finish_reason
193
+ )
194
+ # Usage data is not provided by this API in a standard way, set to 0
195
+ usage = CompletionUsage(prompt_tokens=0, completion_tokens=0, total_tokens=0)
196
+
197
+ completion = ChatCompletion(
198
+ id=request_id,
199
+ choices=[choice],
200
+ created=created_time,
201
+ model=model,
202
+ usage=usage,
203
+ )
204
+ return completion
205
+
206
+ class Chat(BaseChat):
207
+ def __init__(self, client: 'YEPCHAT'):
208
+ self.completions = Completions(client)
209
+
210
+ class YEPCHAT(OpenAICompatibleProvider):
211
+ """
212
+ OpenAI-compatible client for YEPCHAT API.
213
+
214
+ Usage:
215
+ client = YEPCHAT()
216
+ response = client.chat.completions.create(
217
+ model="DeepSeek-R1-Distill-Qwen-32B",
218
+ messages=[{"role": "user", "content": "Hello!"}]
219
+ )
220
+ print(response.choices[0].message.content)
221
+ """
222
+ AVAILABLE_MODELS = ["DeepSeek-R1-Distill-Qwen-32B", "Mixtral-8x7B-Instruct-v0.1"]
223
+
224
+ def __init__(
225
+ self,
226
+ timeout: int = 30,
227
+ browser: str = "chrome"
228
+ ):
229
+ """
230
+ Initialize the YEPCHAT client.
231
+
232
+ Args:
233
+ timeout: Request timeout in seconds.
234
+ browser: Browser name for LitAgent to generate User-Agent.
235
+ """
236
+ self.timeout = timeout
237
+ self.api_endpoint = "https://api.yep.com/v1/chat/completions"
238
+ self.session = cloudscraper.create_scraper() # Use cloudscraper
239
+
240
+ # Initialize LitAgent for user agent generation and fingerprinting
241
+ try:
242
+ agent = LitAgent()
243
+ fingerprint = agent.generate_fingerprint(browser=browser)
244
+ except Exception as e:
245
+ print(f"Warning: Failed to generate fingerprint with LitAgent: {e}. Using fallback.")
246
+ # Fallback fingerprint data
247
+ fingerprint = {
248
+ "accept": "*/*",
249
+ "accept_language": "en-US,en;q=0.9",
250
+ "sec_ch_ua": '"Not/A)Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
251
+ "platform": "Windows",
252
+ "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"
253
+ }
254
+
255
+ # Initialize headers using the fingerprint
256
+ self.headers = {
257
+ "Accept": fingerprint["accept"],
258
+ "Accept-Encoding": "gzip, deflate, br, zstd",
259
+ "Accept-Language": fingerprint["accept_language"],
260
+ "Content-Type": "application/json; charset=utf-8",
261
+ "DNT": "1",
262
+ "Origin": "https://yep.com",
263
+ "Referer": "https://yep.com/",
264
+ "Sec-CH-UA": fingerprint["sec_ch_ua"] or '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
265
+ "Sec-CH-UA-Mobile": "?0",
266
+ "Sec-CH-UA-Platform": f'"{fingerprint["platform"]}"',
267
+ "User-Agent": fingerprint["user_agent"],
268
+ }
269
+ self.session.headers.update(self.headers)
270
+
271
+ # Generate cookies (consider if these need refreshing or specific values)
272
+ self.cookies = {"__Host-session": uuid.uuid4().hex, '__cf_bm': uuid.uuid4().hex}
273
+
274
+ # Initialize the chat interface
275
+ self.chat = Chat(self)
276
+
277
+ def convert_model_name(self, model: str) -> str:
278
+ """
279
+ Ensures the model name is valid for YEPCHAT.
280
+ Returns the validated model name or raises an error if invalid.
281
+ """
282
+ if model in self.AVAILABLE_MODELS:
283
+ return model
284
+ else:
285
+ # Raise error instead of defaulting, as model is mandatory in create()
286
+ raise ValueError(f"Model '{model}' not supported by YEPCHAT. Available: {self.AVAILABLE_MODELS}")
287
+
288
+ # Example usage (optional, for testing)
289
+ if __name__ == '__main__':
290
+ print("Testing YEPCHAT OpenAI-Compatible Client...")
291
+
292
+ # Test Non-Streaming
293
+ try:
294
+ print("\n--- Non-Streaming Test (DeepSeek) ---")
295
+ client = YEPCHAT()
296
+ response = client.chat.completions.create(
297
+ model="DeepSeek-R1-Distill-Qwen-32B",
298
+ messages=[
299
+ {"role": "user", "content": "Say 'Hello World'"}
300
+ ],
301
+ stream=False
302
+ )
303
+ print("Response:", response.choices[0].message.content)
304
+ print("Usage:", response.usage) # Will show 0 tokens
305
+ except Exception as e:
306
+ print(f"Non-Streaming Test Failed: {e}")
307
+
308
+ # Test Streaming
309
+ try:
310
+ print("\n--- Streaming Test (Mixtral) ---")
311
+ client_stream = YEPCHAT()
312
+ stream = client_stream.chat.completions.create(
313
+ model="Mixtral-8x7B-Instruct-v0.1",
314
+ messages=[
315
+ {"role": "user", "content": "Write a short sentence about AI."}
316
+ ],
317
+ stream=True
318
+ )
319
+ print("Streaming Response:")
320
+ full_stream_response = ""
321
+ for chunk in stream:
322
+ content = chunk.choices[0].delta.content
323
+ if content:
324
+ print(content, end="", flush=True)
325
+ full_stream_response += content
326
+ print("\n--- End of Stream ---")
327
+ print("Full streamed text:", full_stream_response)
328
+ except Exception as e:
329
+ print(f"Streaming Test Failed: {e}")
@@ -0,0 +1,278 @@
1
+ from os import system
2
+ import requests
3
+ import json
4
+ import uuid
5
+ import re
6
+ from datetime import datetime
7
+ from typing import Any, Dict, Optional, Union, Generator
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 StandardInputAI(Provider):
16
+ """
17
+ A class to interact with the Standard Input chat API.
18
+ """
19
+
20
+ AVAILABLE_MODELS = {
21
+ "standard-quick": "quick",
22
+ "standard-reasoning": "quick", # Same model but with reasoning enabled
23
+ }
24
+
25
+ def __init__(
26
+ self,
27
+ is_conversation: bool = True,
28
+ max_tokens: int = 2049,
29
+ timeout: int = 30,
30
+ intro: str = None,
31
+ filepath: str = None,
32
+ update_file: bool = True,
33
+ proxies: dict = {},
34
+ history_offset: int = 10250,
35
+ act: str = None,
36
+ model: str = "standard-quick",
37
+ chat_id: str = None,
38
+ user_id: str = None,
39
+ browser: str = "chrome",
40
+ system_prompt: str = "You are a helpful assistant.",
41
+ enable_reasoning: bool = False,
42
+ ):
43
+ """
44
+ Initializes the Standard Input API client.
45
+
46
+ Args:
47
+ is_conversation (bool): Whether to maintain conversation history.
48
+ max_tokens (int): Maximum number of tokens to generate.
49
+ timeout (int): Request timeout in seconds.
50
+ intro (str): Introduction text for the conversation.
51
+ filepath (str): Path to save conversation history.
52
+ update_file (bool): Whether to update the conversation history file.
53
+ proxies (dict): Proxy configuration for requests.
54
+ history_offset (int): Maximum history length in characters.
55
+ act (str): Persona for the AI to adopt.
56
+ model (str): Model to use, must be one of AVAILABLE_MODELS.
57
+ chat_id (str): Unique identifier for the chat session.
58
+ user_id (str): Unique identifier for the user.
59
+ browser (str): Browser to emulate in requests.
60
+ system_prompt (str): System prompt for the AI.
61
+ enable_reasoning (bool): Whether to enable reasoning feature.
62
+ """
63
+ if model not in self.AVAILABLE_MODELS:
64
+ raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
65
+
66
+ self.url = "https://chat.standard-input.com/api/chat"
67
+
68
+ # Initialize LitAgent for user agent generation
69
+ self.agent = LitAgent()
70
+ # Use fingerprinting to create a consistent browser identity
71
+ self.fingerprint = self.agent.generate_fingerprint(browser)
72
+ self.system_prompt = system_prompt
73
+
74
+ # Use the fingerprint for headers
75
+ self.headers = {
76
+ "accept": "*/*",
77
+ "accept-encoding": "gzip, deflate, br, zstd",
78
+ "accept-language": self.fingerprint["accept_language"],
79
+ "content-type": "application/json",
80
+ "dnt": "1",
81
+ "origin": "https://chat.standard-input.com",
82
+ "referer": "https://chat.standard-input.com/",
83
+ "sec-ch-ua": self.fingerprint["sec_ch_ua"] or '"Microsoft Edge";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
84
+ "sec-ch-ua-mobile": "?0",
85
+ "sec-ch-ua-platform": f'"{self.fingerprint["platform"]}"',
86
+ "sec-fetch-dest": "empty",
87
+ "sec-fetch-mode": "cors",
88
+ "sec-fetch-site": "same-origin",
89
+ "sec-gpc": "1",
90
+ "user-agent": self.fingerprint["user_agent"],
91
+ }
92
+
93
+ # Default cookies - these should be updated for production use
94
+ self.cookies = {
95
+ "auth-chat": '''%7B%22user%22%3A%7B%22id%22%3A%2243a26ebd-7691-4a5a-8321-12aff017af86%22%2C%22email%22%3A%22iu511inmev%40illubd.com%22%2C%22accountId%22%3A%22057d78c9-06db-48eb-aeaa-0efdbaeb9446%22%2C%22provider%22%3A%22password%22%7D%2C%22tokens%22%3A%7B%22access%22%3A%22eyJhbGciOiJFUzI1NiIsImtpZCI6Ijg1NDhmZWY1LTk5MjYtNDk2Yi1hMjI2LTQ5OTExYjllYzU2NSIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiYWNjZXNzIiwidHlwZSI6InVzZXIiLCJwcm9wZXJ0aWVzIjp7ImlkIjoiNDNhMjZlYmQtNzY5MS00YTVhLTgzMzEtMTJhZmYwMTdhZjg2IiwiZW1haWwiOiJpdTUxMWlubWV2QGlsbHViZC5jb20iLCJhY2NvdW50SWQiOiIwNTdkNzhjOS0wNmRiLTQ4ZWItYWVhYS0wZWZkYmFlYjk0NDYiLCJwcm92aWRlciI6InBhc3N3b3JkIn0sImF1ZCI6InN0YW5kYXJkLWlucHV0LWlvcyIsImlzcyI6Imh0dHBzOi8vYXV0aC5zdGFuZGFyZC1pbnB1dC5jb20iLCJzdWIiOiJ1c2VyOjRmYWMzMTllZjA4MDRiZmMiLCJleHAiOjE3NDU0MDU5MDN9.d3VsEq-UCNsQWkiPlTVw7caS0wTXfCYe6yeFLeb4Ce6ZYTIFFn685SF-aKvLOxaYaq7Pyk4D2qr24riPVhxUWQ%22%2C%22refresh%22%3A%22user%3A4fac319ef0804bfc%3A3a757177-5507-4a36-9356-492f5ed06105%22%7D%7D''',
96
+ "auth": '''%7B%22user%22%3A%7B%22id%22%3A%22c51e291f-8f44-439d-a38b-9ea147581a13%22%2C%22email%22%3A%22r6cigexlsb%40mrotzis.com%22%2C%22accountId%22%3A%22599fd4ce-04a2-40f6-a78f-d33d0059b77f%22%2C%22provider%22%3A%22password%22%7D%2C%22tokens%22%3A%7B%22access%22%3A%22eyJhbGciOiJFUzI1NiIsImtpZCI6Ijg1NDhmZWY1LTk5MjYtNDk2Yi1hMjI2LTQ5OTExYjllYzU2NSIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiYWNjZXNzIiwidHlwZSI6InVzZXIiLCJwcm9wZXJ0aWVzIjp7ImlkIjoiYzUxZTI5MWYtOGY0NC00MzlkLWEzOGItOWVhMTQ3NTgxYTEzIiwiZW1haWwiOiJyNmNpZ2V4bHNiQG1yb3R6aXMuY29tIiwiYWNjb3VudElkIjoiNTk5ZmQ0Y2UtMDRhMi00MGY2LWE3OGYtZDMzZDAwNTliNzdmIiwicHJvdmlkZXIiOiJwYXNzd29yZCJ9LCJhdWQiOiJzdGFuZGFyZC1pbnB1dC1pb3MiLCJpc3MiOiJodHRwczovL2F1dGguc3RhbmRhcmQtaW5wdXQuY29tIiwic3ViIjoidXNlcjo4Y2FmMjRkYzUxNDc4MmNkIiwiZXhwIjoxNzQ2NzI0MTU3fQ.a3970nBJkd8JoU-khRA2JlRMuYeJ7378QS4ZL446kOkDi35uTwuC4qGrWH9efk9GkFaVcWPtYeOJjRb7f2SeJA%22%2C%22refresh%22%3A%22user%3A8caf24dc514782cd%3A14e24386-8443-4df0-ae25-234ad59218ef%22%7D%7D''',
97
+ "sidebar:state": "true",
98
+ "ph_phc_f3wUUyCfmKlKtkc2pfT7OsdcW2mBEVGN2A87yEYbG3c_posthog": '''%7B%22distinct_id%22%3A%220195c7cc-ac8f-79ff-b901-e14a78fc2a67%22%2C%22%24sesid%22%3A%5B1744688627860%2C%220196377f-9f12-77e6-a9ea-0e9669423803%22%2C1744687832850%5D%2C%22%24initial_person_info%22%3A%7B%22r%22%3A%22%24direct%22%2C%22u%22%3A%22https%3A%2F%2Fstandard-input.com%2F%22%7D%7D'''
99
+ }
100
+
101
+ self.session = requests.Session()
102
+ self.session.headers.update(self.headers)
103
+ self.session.proxies.update(proxies)
104
+
105
+ self.is_conversation = is_conversation
106
+ self.max_tokens_to_sample = max_tokens
107
+ self.timeout = timeout
108
+ self.last_response = {}
109
+ self.model = model
110
+ self.chat_id = chat_id or str(uuid.uuid4())
111
+ self.user_id = user_id or f"user_{str(uuid.uuid4())[:8].upper()}"
112
+ self.enable_reasoning = enable_reasoning
113
+
114
+ self.__available_optimizers = (
115
+ method
116
+ for method in dir(Optimizers)
117
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
118
+ )
119
+ Conversation.intro = (
120
+ AwesomePrompts().get_act(
121
+ act, raise_not_found=True, default=None, case_insensitive=True
122
+ )
123
+ if act
124
+ else intro or Conversation.intro
125
+ )
126
+
127
+ self.conversation = Conversation(
128
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
129
+ )
130
+ self.conversation.history_offset = history_offset
131
+
132
+ def refresh_identity(self, browser: str = None):
133
+ """
134
+ Refreshes the browser identity fingerprint.
135
+
136
+ Args:
137
+ browser: Specific browser to use for the new fingerprint
138
+ """
139
+ browser = browser or self.fingerprint.get("browser_type", "chrome")
140
+ self.fingerprint = self.agent.generate_fingerprint(browser)
141
+
142
+ # Update headers with new fingerprint
143
+ self.headers.update({
144
+ "Accept-Language": self.fingerprint["accept_language"],
145
+ "Sec-CH-UA": self.fingerprint["sec_ch_ua"] or self.headers["sec-ch-ua"],
146
+ "Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
147
+ "User-Agent": self.fingerprint["user_agent"],
148
+ })
149
+
150
+ # Update session headers
151
+ for header, value in self.headers.items():
152
+ self.session.headers[header] = value
153
+
154
+ return self.fingerprint
155
+
156
+ def ask(
157
+ self,
158
+ prompt: str,
159
+ optimizer: str = None,
160
+ conversationally: bool = False,
161
+ ) -> Dict[str, Any]:
162
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
163
+ if optimizer:
164
+ if optimizer in self.__available_optimizers:
165
+ conversation_prompt = getattr(Optimizers, optimizer)(
166
+ conversation_prompt if conversationally else prompt
167
+ )
168
+ else:
169
+ raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
170
+
171
+ # Prepare the messages
172
+ messages = [
173
+ {"role": "system", "content": self.system_prompt},
174
+ {"role": "user", "content": conversation_prompt, "parts": [{"type": "text", "text": conversation_prompt}]}
175
+ ]
176
+
177
+ # Prepare the request payload
178
+ payload = {
179
+ "id": self.chat_id,
180
+ "messages": messages,
181
+ "modelId": self.AVAILABLE_MODELS[self.model],
182
+ "enabledFeatures": ["reasoning"] if self.enable_reasoning or self.model == "standard-reasoning" else []
183
+ }
184
+
185
+ try:
186
+ response = self.session.post(self.url, cookies=self.cookies, json=payload, stream=True, timeout=self.timeout)
187
+ if response.status_code != 200:
188
+ # Try to get response content for better error messages
189
+ try:
190
+ error_content = response.text
191
+ except:
192
+ error_content = "<could not read response content>"
193
+
194
+ if response.status_code in [403, 429]:
195
+ print(f"Received status code {response.status_code}, refreshing identity...")
196
+ self.refresh_identity()
197
+ response = self.session.post(self.url, cookies=self.cookies, json=payload, stream=True, timeout=self.timeout)
198
+ if not response.ok:
199
+ raise exceptions.FailedToGenerateResponseError(
200
+ f"Failed to generate response after identity refresh - ({response.status_code}, {response.reason}) - {error_content}"
201
+ )
202
+ print("Identity refreshed successfully.")
203
+ else:
204
+ raise exceptions.FailedToGenerateResponseError(
205
+ f"Request failed with status code {response.status_code}. Response: {error_content}"
206
+ )
207
+
208
+ full_response = ""
209
+ debug_lines = []
210
+
211
+ # Process the streaming response
212
+ for i, line in enumerate(response.iter_lines(decode_unicode=True)):
213
+ if line:
214
+ try:
215
+ line_str = line
216
+ debug_lines.append(line_str)
217
+
218
+ # Extract content from the response
219
+ match = re.search(r'0:"(.*?)"', line_str)
220
+ if match:
221
+ content = match.group(1)
222
+ full_response += content
223
+ continue
224
+ except: pass
225
+
226
+ self.last_response = {"text": full_response}
227
+ self.conversation.update_chat_history(prompt, full_response)
228
+ return {"text": full_response}
229
+ except Exception as e:
230
+ raise exceptions.FailedToGenerateResponseError(f"Request failed: {e}")
231
+
232
+ def chat(
233
+ self,
234
+ prompt: str,
235
+ optimizer: str = None,
236
+ conversationally: bool = False,
237
+ ) -> str:
238
+ return self.get_message(
239
+ self.ask(
240
+ prompt, optimizer=optimizer, conversationally=conversationally
241
+ )
242
+ )
243
+
244
+ def get_message(self, response: dict) -> str:
245
+ assert isinstance(response, dict), "Response should be of dict data-type only"
246
+ return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
247
+
248
+ if __name__ == "__main__":
249
+ print("-" * 100)
250
+ print(f"{'Model':<50} {'Status':<10} {'Response'}")
251
+ print("-" * 100)
252
+
253
+ test_prompt = "Say 'Hello' in one word"
254
+
255
+ # Test each model
256
+ for model in StandardInputAI.AVAILABLE_MODELS:
257
+ print(f"\rTesting {model}...", end="")
258
+
259
+ try:
260
+ test_ai = StandardInputAI(model=model, timeout=120) # Increased timeout
261
+ response = test_ai.chat(test_prompt)
262
+
263
+ if response and len(response.strip()) > 0:
264
+ status = "✓"
265
+ # Clean and truncate response
266
+ clean_text = response.strip().encode('utf-8', errors='ignore').decode('utf-8')
267
+ display_text = clean_text[:50] + "..." if len(clean_text) > 50 else clean_text
268
+ else:
269
+ status = "✗"
270
+ display_text = "Empty or invalid response"
271
+
272
+ print(f"\r{model:<50} {status:<10} {display_text}")
273
+ except Exception as e:
274
+ error_msg = str(e)
275
+ # Truncate very long error messages
276
+ if len(error_msg) > 100:
277
+ error_msg = error_msg[:97] + "..."
278
+ print(f"\r{model:<50} {'✗':<10} Error: {error_msg}")
@@ -12,34 +12,33 @@ class TextPollinationsAI(Provider):
12
12
  """
13
13
 
14
14
  AVAILABLE_MODELS = [
15
- "openai", # OpenAI GPT-4o-mini
16
- "openai-large", # OpenAI GPT-4o
17
- "openai-reasoning", # OpenAI o3-mini
18
- "qwen-coder", # Qwen 2.5 Coder 32B
19
- "llama", # Llama 3.3 70B
20
- "mistral", # Mistral Small 3
21
- "unity", # Unity Mistral Large
22
- "midijourney", # Midijourney
23
- "rtist", # Rtist
24
- "searchgpt", # SearchGPT
25
- "evil", # Evil
26
- "deepseek-reasoning", # DeepSeek-R1 Distill Qwen 32B
27
- "deepseek-reasoning-large",# DeepSeek R1 - Llama 70B
28
- # "llamalight", # Llama 3.1 8B Instruct # >>> NOT WORKING
29
- "phi", # Phi-4 Instruct
30
- "llama-vision", # Llama 3.2 11B Vision
31
- "pixtral", # Pixtral 12B
32
- "gemini", # Gemini 2.0 Flash
33
- "gemini-reasoning", # Gemini 2.0 Flash Thinking
34
- "hormoz", # Hormoz 8b
35
- "hypnosis-tracy", # Hypnosis Tracy 7B
36
- "mistral-roblox", # Mistral Roblox on Scaleway
37
- "roblox-rp", # Roblox Roleplay Assistant
38
- "deepseek", # DeepSeek-V3
39
- "qwen-reasoning", # Qwen QWQ 32B - Advanced Reasoning
40
- "sur", # Sur AI Assistant (Mistral)
41
- "llama-scaleway", # Llama (Scaleway)
42
- "openai-audio", # OpenAI GPT-4o-audio-preview
15
+ "openai",
16
+ "openai-large",
17
+ "openai-reasoning",
18
+ "qwen-coder",
19
+ "llama",
20
+ "llamascout",
21
+ "mistral",
22
+ "unity",
23
+ "midijourney",
24
+ "rtist",
25
+ "searchgpt",
26
+ "evil",
27
+ "deepseek-reasoning",
28
+ "deepseek-reasoning-large",
29
+ "llamalight",
30
+ "phi",
31
+ "llama-vision",
32
+ "pixtral",
33
+ "gemini",
34
+ "hormoz",
35
+ "hypnosis-tracy",
36
+ "mistral-roblox",
37
+ "roblox-rp",
38
+ "deepseek",
39
+ "sur",
40
+ "llama-scaleway",
41
+ "openai-audio",
43
42
  ]
44
43
 
45
44
  def __init__(
@@ -16,7 +16,7 @@ class Venice(Provider):
16
16
  """
17
17
 
18
18
  AVAILABLE_MODELS = [
19
- "llama-3.3-70b",
19
+ "mistral-31-24b",
20
20
  "llama-3.2-3b-akash",
21
21
  "qwen2dot5-coder-32b",
22
22
  "deepseek-coder-v2-lite",