webscout 7.6__py3-none-any.whl → 7.8__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.
- webscout/AIutel.py +2 -1
- webscout/Bard.py +14 -11
- webscout/DWEBS.py +431 -415
- webscout/Extra/autocoder/autocoder_utiles.py +183 -47
- webscout/Extra/autocoder/rawdog.py +848 -649
- webscout/Extra/gguf.py +682 -652
- webscout/Provider/AI21.py +1 -1
- webscout/Provider/AISEARCH/DeepFind.py +2 -2
- webscout/Provider/AISEARCH/ISou.py +2 -23
- webscout/Provider/AISEARCH/felo_search.py +6 -6
- webscout/Provider/AISEARCH/genspark_search.py +1 -1
- webscout/Provider/Aitopia.py +292 -0
- webscout/Provider/AllenAI.py +5 -22
- webscout/Provider/Andi.py +3 -3
- webscout/Provider/C4ai.py +1 -1
- webscout/Provider/ChatGPTClone.py +226 -0
- webscout/Provider/ChatGPTES.py +3 -5
- webscout/Provider/ChatGPTGratis.py +4 -4
- webscout/Provider/Chatify.py +2 -2
- webscout/Provider/Cloudflare.py +3 -2
- webscout/Provider/DARKAI.py +3 -2
- webscout/Provider/DeepSeek.py +2 -2
- webscout/Provider/Deepinfra.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/ElectronHub.py +178 -96
- webscout/Provider/ExaChat.py +310 -0
- webscout/Provider/Free2GPT.py +2 -2
- webscout/Provider/Gemini.py +5 -19
- webscout/Provider/GithubChat.py +1 -1
- webscout/Provider/Glider.py +12 -8
- webscout/Provider/Groq.py +3 -3
- webscout/Provider/HF_space/qwen_qwen2.py +1 -1
- webscout/Provider/HeckAI.py +1 -1
- webscout/Provider/HuggingFaceChat.py +1 -1
- webscout/Provider/Hunyuan.py +272 -0
- webscout/Provider/Jadve.py +3 -3
- webscout/Provider/Koboldai.py +3 -3
- webscout/Provider/LambdaChat.py +391 -0
- webscout/Provider/Llama.py +3 -5
- webscout/Provider/Llama3.py +4 -12
- webscout/Provider/Marcus.py +3 -3
- webscout/Provider/OLLAMA.py +260 -36
- webscout/Provider/Openai.py +7 -3
- webscout/Provider/PI.py +1 -1
- webscout/Provider/Perplexitylabs.py +1 -1
- webscout/Provider/Phind.py +1 -1
- webscout/Provider/PizzaGPT.py +1 -1
- webscout/Provider/QwenLM.py +4 -7
- webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +21 -46
- webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +37 -49
- webscout/Provider/TTI/ImgSys/__init__.py +23 -0
- webscout/Provider/TTI/ImgSys/async_imgsys.py +202 -0
- webscout/Provider/TTI/ImgSys/sync_imgsys.py +195 -0
- webscout/Provider/TTI/__init__.py +3 -1
- webscout/Provider/TTI/artbit/async_artbit.py +4 -33
- webscout/Provider/TTI/artbit/sync_artbit.py +4 -32
- webscout/Provider/TTI/fastflux/async_fastflux.py +6 -2
- webscout/Provider/TTI/fastflux/sync_fastflux.py +7 -2
- webscout/Provider/TTI/huggingface/async_huggingface.py +1 -1
- webscout/Provider/TTI/huggingface/sync_huggingface.py +1 -1
- webscout/Provider/TTI/pixelmuse/__init__.py +4 -0
- webscout/Provider/TTI/pixelmuse/async_pixelmuse.py +249 -0
- webscout/Provider/TTI/pixelmuse/sync_pixelmuse.py +182 -0
- webscout/Provider/TTI/talkai/sync_talkai.py +1 -1
- webscout/Provider/TTS/utils.py +1 -1
- webscout/Provider/TeachAnything.py +1 -1
- webscout/Provider/TextPollinationsAI.py +4 -4
- webscout/Provider/TwoAI.py +1 -2
- webscout/Provider/Venice.py +4 -2
- webscout/Provider/VercelAI.py +234 -0
- webscout/Provider/WebSim.py +228 -0
- webscout/Provider/WiseCat.py +10 -12
- webscout/Provider/Youchat.py +1 -1
- webscout/Provider/__init__.py +22 -1
- webscout/Provider/ai4chat.py +1 -1
- webscout/Provider/aimathgpt.py +2 -6
- webscout/Provider/akashgpt.py +1 -1
- webscout/Provider/askmyai.py +4 -4
- webscout/Provider/asksteve.py +203 -0
- webscout/Provider/bagoodex.py +2 -2
- webscout/Provider/cerebras.py +1 -1
- webscout/Provider/chatglm.py +4 -4
- webscout/Provider/cleeai.py +1 -0
- webscout/Provider/copilot.py +427 -415
- webscout/Provider/elmo.py +1 -1
- webscout/Provider/flowith.py +14 -3
- webscout/Provider/freeaichat.py +57 -31
- webscout/Provider/gaurish.py +3 -5
- webscout/Provider/geminiprorealtime.py +1 -1
- webscout/Provider/granite.py +4 -4
- webscout/Provider/hermes.py +5 -5
- webscout/Provider/julius.py +1 -1
- webscout/Provider/koala.py +1 -1
- webscout/Provider/labyrinth.py +239 -0
- webscout/Provider/learnfastai.py +28 -15
- webscout/Provider/lepton.py +1 -1
- webscout/Provider/llama3mitril.py +4 -4
- webscout/Provider/llamatutor.py +1 -1
- webscout/Provider/llmchat.py +3 -3
- webscout/Provider/meta.py +1 -1
- webscout/Provider/multichat.py +10 -10
- webscout/Provider/promptrefine.py +1 -1
- webscout/Provider/searchchat.py +293 -0
- webscout/Provider/sonus.py +208 -0
- webscout/Provider/talkai.py +2 -2
- webscout/Provider/turboseek.py +1 -1
- webscout/Provider/tutorai.py +1 -1
- webscout/Provider/typegpt.py +6 -43
- webscout/Provider/uncovr.py +299 -0
- webscout/Provider/x0gpt.py +1 -1
- webscout/__init__.py +36 -36
- webscout/cli.py +293 -283
- webscout/litagent/agent.py +14 -9
- webscout/tempid.py +11 -11
- webscout/utils.py +2 -2
- webscout/version.py +1 -1
- webscout/webscout_search.py +1282 -1223
- webscout/webscout_search_async.py +813 -692
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/METADATA +76 -44
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/RECORD +124 -106
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/LICENSE.md +0 -0
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/WHEEL +0 -0
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/entry_points.txt +0 -0
- {webscout-7.6.dist-info → webscout-7.8.dist-info}/top_level.txt +0 -0
webscout/Provider/typegpt.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
import json
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Union, Any, Dict, Generator
|
|
4
4
|
import requests.exceptions
|
|
5
5
|
|
|
6
6
|
from webscout.AIutel import Optimizers
|
|
@@ -146,6 +146,7 @@ class TypeGPT(Provider):
|
|
|
146
146
|
"deepseek-r1-distill-llama-70b",
|
|
147
147
|
# "deepseek-reasoner", >>>> NOT WORKING
|
|
148
148
|
"deepseek-v3",
|
|
149
|
+
"uncensored-r1",
|
|
149
150
|
|
|
150
151
|
# Specialized Models and Tools
|
|
151
152
|
"@cf/defog/sqlcoder-7b-2",
|
|
@@ -162,45 +163,7 @@ class TypeGPT(Provider):
|
|
|
162
163
|
# "@hf/thebloke/neural-chat-7b-v3-1-awq", >>>> NOT WORKING
|
|
163
164
|
# "@hf/thebloke/openhermes-2.5-mistral-7b-awq", >>>> NOT WORKING
|
|
164
165
|
# "@hf/thebloke/zephyr-7b-beta-awq", >>>> NOT WORKING
|
|
165
|
-
|
|
166
|
-
# Development Agents
|
|
167
|
-
"AndroidDeveloper",
|
|
168
|
-
"AngularJSAgent",
|
|
169
|
-
"AzureAgent",
|
|
170
|
-
"BitbucketAgent",
|
|
171
|
-
"DigitalOceanAgent",
|
|
172
|
-
"DockerAgent",
|
|
173
|
-
"ElectronAgent",
|
|
174
|
-
"ErlangAgent",
|
|
175
|
-
"FastAPIAgent",
|
|
176
|
-
"FirebaseAgent",
|
|
177
|
-
"FlaskAgent",
|
|
178
|
-
"FlutterAgent",
|
|
179
|
-
"GitAgent",
|
|
180
|
-
"GitlabAgent",
|
|
181
|
-
"GoAgent",
|
|
182
|
-
"GodotAgent",
|
|
183
|
-
"GoogleCloudAgent",
|
|
184
|
-
"HTMLAgent",
|
|
185
|
-
"JavaAgent",
|
|
186
|
-
"JavaScriptAgent",
|
|
187
|
-
"MongoDBAgent",
|
|
188
|
-
"Next.jsAgent",
|
|
189
|
-
"PyTorchAgent",
|
|
190
|
-
"PythonAgent",
|
|
191
|
-
"ReactAgent",
|
|
192
|
-
"RepoMap",
|
|
193
|
-
"SwiftDeveloper",
|
|
194
|
-
"XcodeAgent",
|
|
195
|
-
# "YoutubeAgent", >>>> NOT WORKING
|
|
196
|
-
|
|
197
|
-
# Other Models
|
|
198
|
-
"blackboxai",
|
|
199
|
-
"blackboxai-pro",
|
|
200
|
-
"builderAgent",
|
|
201
|
-
# "Cipher-20b", >>>> NOT WORKING
|
|
202
|
-
# "dify", >>>> NOT WORKING
|
|
203
|
-
"flux",
|
|
166
|
+
"Image-Generator",
|
|
204
167
|
# "flux-1-schnell", >>>> NOT WORKING
|
|
205
168
|
# "HelpingAI-15B", >>>> NOT WORKING
|
|
206
169
|
# "HelpingAI2-3b", >>>> NOT WORKING
|
|
@@ -267,7 +230,7 @@ class TypeGPT(Provider):
|
|
|
267
230
|
self.session = requests.Session()
|
|
268
231
|
self.is_conversation = is_conversation
|
|
269
232
|
self.max_tokens_to_sample = max_tokens
|
|
270
|
-
self.api_endpoint = "https://chat.typegpt.net/api/openai/v1/chat/completions"
|
|
233
|
+
self.api_endpoint = "https://chat.typegpt.net/api/openai/typegpt/v1/chat/completions"
|
|
271
234
|
self.timeout = timeout
|
|
272
235
|
self.last_response = {}
|
|
273
236
|
self.model = model
|
|
@@ -309,7 +272,7 @@ class TypeGPT(Provider):
|
|
|
309
272
|
raw: bool = False,
|
|
310
273
|
optimizer: str = None,
|
|
311
274
|
conversationally: bool = False,
|
|
312
|
-
) -> Dict[str, Any]
|
|
275
|
+
) -> Union[Dict[str, Any], Generator[Any, None, None]]:
|
|
313
276
|
"""Sends a prompt to the TypeGPT.net API and returns the response."""
|
|
314
277
|
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
315
278
|
if optimizer:
|
|
@@ -398,7 +361,7 @@ class TypeGPT(Provider):
|
|
|
398
361
|
stream: bool = False,
|
|
399
362
|
optimizer: str = None,
|
|
400
363
|
conversationally: bool = False,
|
|
401
|
-
) -> str
|
|
364
|
+
) -> Union[str, Generator[str, None, None]]:
|
|
402
365
|
"""Generate response string or stream."""
|
|
403
366
|
if stream:
|
|
404
367
|
gen = self.ask(
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
import uuid
|
|
4
|
+
import re
|
|
5
|
+
from typing import Any, Dict, Optional, Generator, Union
|
|
6
|
+
from webscout.AIutel import Optimizers
|
|
7
|
+
from webscout.AIutel import Conversation
|
|
8
|
+
from webscout.AIutel import AwesomePrompts
|
|
9
|
+
from webscout.AIbase import Provider
|
|
10
|
+
from webscout import exceptions
|
|
11
|
+
from webscout.litagent import LitAgent
|
|
12
|
+
|
|
13
|
+
class UncovrAI(Provider):
|
|
14
|
+
"""
|
|
15
|
+
A class to interact with the Uncovr AI chat API.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
AVAILABLE_MODELS = [
|
|
19
|
+
"default",
|
|
20
|
+
"gpt-4o-mini",
|
|
21
|
+
"gemini-2-flash",
|
|
22
|
+
"o3-mini",
|
|
23
|
+
"claude-3-7-sonnet",
|
|
24
|
+
"gpt-4o",
|
|
25
|
+
"claude-3-5-sonnet-v2",
|
|
26
|
+
"groq-llama-3-1-8b",
|
|
27
|
+
"deepseek-r1-distill-llama-70b",
|
|
28
|
+
"deepseek-r1-distill-qwen-32b",
|
|
29
|
+
"gemini-2-flash-lite-preview",
|
|
30
|
+
"qwen-qwq-32b"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
is_conversation: bool = True,
|
|
36
|
+
max_tokens: int = 2049,
|
|
37
|
+
timeout: int = 30,
|
|
38
|
+
intro: str = None,
|
|
39
|
+
filepath: str = None,
|
|
40
|
+
update_file: bool = True,
|
|
41
|
+
proxies: dict = {},
|
|
42
|
+
history_offset: int = 10250,
|
|
43
|
+
act: str = None,
|
|
44
|
+
model: str = "default",
|
|
45
|
+
chat_id: str = None,
|
|
46
|
+
user_id: str = None,
|
|
47
|
+
browser: str = "chrome"
|
|
48
|
+
):
|
|
49
|
+
"""Initializes the Uncovr AI API client."""
|
|
50
|
+
if model not in self.AVAILABLE_MODELS:
|
|
51
|
+
raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
|
|
52
|
+
|
|
53
|
+
self.url = "https://uncovr.app/api/workflows/chat"
|
|
54
|
+
|
|
55
|
+
# Initialize LitAgent for user agent generation
|
|
56
|
+
self.agent = LitAgent()
|
|
57
|
+
# Use fingerprinting to create a consistent browser identity
|
|
58
|
+
self.fingerprint = self.agent.generate_fingerprint(browser)
|
|
59
|
+
|
|
60
|
+
# Use the fingerprint for headers
|
|
61
|
+
self.headers = {
|
|
62
|
+
"Accept": self.fingerprint["accept"],
|
|
63
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
64
|
+
"Accept-Language": self.fingerprint["accept_language"],
|
|
65
|
+
"Content-Type": "application/json",
|
|
66
|
+
"Origin": "https://uncovr.app",
|
|
67
|
+
"Referer": "https://uncovr.app/",
|
|
68
|
+
"Sec-CH-UA": self.fingerprint["sec_ch_ua"] or '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
|
|
69
|
+
"Sec-CH-UA-Mobile": "?0",
|
|
70
|
+
"Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
|
|
71
|
+
"User-Agent": self.fingerprint["user_agent"],
|
|
72
|
+
"Sec-Fetch-Dest": "empty",
|
|
73
|
+
"Sec-Fetch-Mode": "cors",
|
|
74
|
+
"Sec-Fetch-Site": "same-origin"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
self.session = requests.Session()
|
|
78
|
+
self.session.headers.update(self.headers)
|
|
79
|
+
self.session.proxies.update(proxies)
|
|
80
|
+
|
|
81
|
+
self.is_conversation = is_conversation
|
|
82
|
+
self.max_tokens_to_sample = max_tokens
|
|
83
|
+
self.timeout = timeout
|
|
84
|
+
self.last_response = {}
|
|
85
|
+
self.model = model
|
|
86
|
+
self.chat_id = chat_id or str(uuid.uuid4())
|
|
87
|
+
self.user_id = user_id or f"user_{str(uuid.uuid4())[:8].upper()}"
|
|
88
|
+
|
|
89
|
+
self.__available_optimizers = (
|
|
90
|
+
method
|
|
91
|
+
for method in dir(Optimizers)
|
|
92
|
+
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
93
|
+
)
|
|
94
|
+
Conversation.intro = (
|
|
95
|
+
AwesomePrompts().get_act(
|
|
96
|
+
act, raise_not_found=True, default=None, case_insensitive=True
|
|
97
|
+
)
|
|
98
|
+
if act
|
|
99
|
+
else intro or Conversation.intro
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
self.conversation = Conversation(
|
|
103
|
+
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
104
|
+
)
|
|
105
|
+
self.conversation.history_offset = history_offset
|
|
106
|
+
|
|
107
|
+
def refresh_identity(self, browser: str = None):
|
|
108
|
+
"""
|
|
109
|
+
Refreshes the browser identity fingerprint.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
browser: Specific browser to use for the new fingerprint
|
|
113
|
+
"""
|
|
114
|
+
browser = browser or self.fingerprint.get("browser_type", "chrome")
|
|
115
|
+
self.fingerprint = self.agent.generate_fingerprint(browser)
|
|
116
|
+
|
|
117
|
+
# Update headers with new fingerprint
|
|
118
|
+
self.headers.update({
|
|
119
|
+
"Accept": self.fingerprint["accept"],
|
|
120
|
+
"Accept-Language": self.fingerprint["accept_language"],
|
|
121
|
+
"Sec-CH-UA": self.fingerprint["sec_ch_ua"] or self.headers["Sec-CH-UA"],
|
|
122
|
+
"Sec-CH-UA-Platform": f'"{self.fingerprint["platform"]}"',
|
|
123
|
+
"User-Agent": self.fingerprint["user_agent"],
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
# Update session headers
|
|
127
|
+
for header, value in self.headers.items():
|
|
128
|
+
self.session.headers[header] = value
|
|
129
|
+
|
|
130
|
+
return self.fingerprint
|
|
131
|
+
|
|
132
|
+
def ask(
|
|
133
|
+
self,
|
|
134
|
+
prompt: str,
|
|
135
|
+
stream: bool = False,
|
|
136
|
+
raw: bool = False,
|
|
137
|
+
optimizer: str = None,
|
|
138
|
+
conversationally: bool = False,
|
|
139
|
+
temperature: int = 32,
|
|
140
|
+
creativity: str = "medium",
|
|
141
|
+
selected_focus: list = ["web"],
|
|
142
|
+
selected_tools: list = ["quick-cards"]
|
|
143
|
+
) -> Union[Dict[str, Any], Generator]:
|
|
144
|
+
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
145
|
+
if optimizer:
|
|
146
|
+
if optimizer in self.__available_optimizers:
|
|
147
|
+
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
148
|
+
conversation_prompt if conversationally else prompt
|
|
149
|
+
)
|
|
150
|
+
else:
|
|
151
|
+
raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
|
|
152
|
+
|
|
153
|
+
# Prepare the request payload
|
|
154
|
+
payload = {
|
|
155
|
+
"content": conversation_prompt,
|
|
156
|
+
"chatId": self.chat_id,
|
|
157
|
+
"userMessageId": str(uuid.uuid4()),
|
|
158
|
+
"ai_config": {
|
|
159
|
+
"selectedFocus": selected_focus,
|
|
160
|
+
"selectedTools": selected_tools,
|
|
161
|
+
"agentId": "chat",
|
|
162
|
+
"modelId": self.model,
|
|
163
|
+
"temperature": temperature,
|
|
164
|
+
"creativity": creativity
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
def for_stream():
|
|
169
|
+
try:
|
|
170
|
+
with self.session.post(self.url, json=payload, stream=True, timeout=self.timeout) as response:
|
|
171
|
+
if response.status_code != 200:
|
|
172
|
+
# If we get a non-200 response, try refreshing our identity once
|
|
173
|
+
if response.status_code in [403, 429]:
|
|
174
|
+
self.refresh_identity()
|
|
175
|
+
# Retry with new identity
|
|
176
|
+
with self.session.post(self.url, json=payload, stream=True, timeout=self.timeout) as retry_response:
|
|
177
|
+
if not retry_response.ok:
|
|
178
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
179
|
+
f"Failed to generate response after identity refresh - ({retry_response.status_code}, {retry_response.reason}) - {retry_response.text}"
|
|
180
|
+
)
|
|
181
|
+
response = retry_response
|
|
182
|
+
else:
|
|
183
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
184
|
+
f"Request failed with status code {response.status_code}"
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
streaming_text = ""
|
|
188
|
+
for line in response.iter_lines():
|
|
189
|
+
if line:
|
|
190
|
+
try:
|
|
191
|
+
line = line.decode('utf-8')
|
|
192
|
+
# Handle different message types
|
|
193
|
+
if line.startswith('0:'): # Content message
|
|
194
|
+
content = line[2:].strip('"')
|
|
195
|
+
streaming_text += content
|
|
196
|
+
resp = dict(text=content)
|
|
197
|
+
yield resp if raw else resp
|
|
198
|
+
except (json.JSONDecodeError, UnicodeDecodeError):
|
|
199
|
+
continue
|
|
200
|
+
|
|
201
|
+
self.last_response = {"text": streaming_text}
|
|
202
|
+
self.conversation.update_chat_history(prompt, streaming_text)
|
|
203
|
+
|
|
204
|
+
except requests.RequestException as e:
|
|
205
|
+
raise exceptions.FailedToGenerateResponseError(f"Request failed: {str(e)}")
|
|
206
|
+
|
|
207
|
+
def for_non_stream():
|
|
208
|
+
try:
|
|
209
|
+
response = self.session.post(self.url, json=payload, timeout=self.timeout)
|
|
210
|
+
if response.status_code != 200:
|
|
211
|
+
if response.status_code in [403, 429]:
|
|
212
|
+
self.refresh_identity()
|
|
213
|
+
response = self.session.post(self.url, json=payload, timeout=self.timeout)
|
|
214
|
+
if not response.ok:
|
|
215
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
216
|
+
f"Failed to generate response after identity refresh - ({response.status_code}, {response.reason}) - {response.text}"
|
|
217
|
+
)
|
|
218
|
+
else:
|
|
219
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
220
|
+
f"Request failed with status code {response.status_code}"
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
full_response = ""
|
|
224
|
+
for line in response.iter_lines():
|
|
225
|
+
if line:
|
|
226
|
+
try:
|
|
227
|
+
line = line.decode('utf-8')
|
|
228
|
+
match = re.search(r'0:"(.*?)"', line)
|
|
229
|
+
if match:
|
|
230
|
+
content = match.group(1)
|
|
231
|
+
full_response += content
|
|
232
|
+
except (json.JSONDecodeError, UnicodeDecodeError):
|
|
233
|
+
continue
|
|
234
|
+
|
|
235
|
+
self.last_response = {"text": full_response}
|
|
236
|
+
self.conversation.update_chat_history(prompt, full_response)
|
|
237
|
+
return {"text": full_response}
|
|
238
|
+
except Exception as e:
|
|
239
|
+
raise exceptions.FailedToGenerateResponseError(f"Request failed: {e}")
|
|
240
|
+
|
|
241
|
+
return for_stream() if stream else for_non_stream()
|
|
242
|
+
|
|
243
|
+
def chat(
|
|
244
|
+
self,
|
|
245
|
+
prompt: str,
|
|
246
|
+
stream: bool = False,
|
|
247
|
+
optimizer: str = None,
|
|
248
|
+
conversationally: bool = False,
|
|
249
|
+
temperature: int = 32,
|
|
250
|
+
creativity: str = "medium",
|
|
251
|
+
selected_focus: list = ["web"],
|
|
252
|
+
selected_tools: list = []
|
|
253
|
+
) -> Union[str, Generator[str, None, None]]:
|
|
254
|
+
def for_stream():
|
|
255
|
+
for response in self.ask(
|
|
256
|
+
prompt, True, optimizer=optimizer, conversationally=conversationally,
|
|
257
|
+
temperature=temperature, creativity=creativity,
|
|
258
|
+
selected_focus=selected_focus, selected_tools=selected_tools
|
|
259
|
+
):
|
|
260
|
+
yield self.get_message(response)
|
|
261
|
+
def for_non_stream():
|
|
262
|
+
return self.get_message(
|
|
263
|
+
self.ask(
|
|
264
|
+
prompt, False, optimizer=optimizer, conversationally=conversationally,
|
|
265
|
+
temperature=temperature, creativity=creativity,
|
|
266
|
+
selected_focus=selected_focus, selected_tools=selected_tools
|
|
267
|
+
)
|
|
268
|
+
)
|
|
269
|
+
return for_stream() if stream else for_non_stream()
|
|
270
|
+
|
|
271
|
+
def get_message(self, response: dict) -> str:
|
|
272
|
+
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
273
|
+
return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
|
|
274
|
+
|
|
275
|
+
if __name__ == "__main__":
|
|
276
|
+
print("-" * 80)
|
|
277
|
+
print(f"{'Model':<50} {'Status':<10} {'Response'}")
|
|
278
|
+
print("-" * 80)
|
|
279
|
+
|
|
280
|
+
for model in UncovrAI.AVAILABLE_MODELS:
|
|
281
|
+
try:
|
|
282
|
+
test_ai = UncovrAI(model=model, timeout=60)
|
|
283
|
+
response = test_ai.chat("Say 'Hello' in one word", stream=True)
|
|
284
|
+
response_text = ""
|
|
285
|
+
for chunk in response:
|
|
286
|
+
response_text += chunk
|
|
287
|
+
|
|
288
|
+
if response_text and len(response_text.strip()) > 0:
|
|
289
|
+
status = "✓"
|
|
290
|
+
# Clean and truncate response
|
|
291
|
+
clean_text = response_text.strip().encode('utf-8', errors='ignore').decode('utf-8')
|
|
292
|
+
display_text = clean_text[:50] + "..." if len(clean_text) > 50 else clean_text
|
|
293
|
+
else:
|
|
294
|
+
status = "✗"
|
|
295
|
+
display_text = "Empty or invalid response"
|
|
296
|
+
print(f"\r{model:<50} {status:<10} {display_text}")
|
|
297
|
+
except Exception as e:
|
|
298
|
+
print(f"\r{model:<50} {'✗':<10} {str(e)}")
|
|
299
|
+
|
webscout/Provider/x0gpt.py
CHANGED
webscout/__init__.py
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
# webscout/__init__.py
|
|
2
|
-
|
|
3
|
-
from .webscout_search import WEBS
|
|
4
|
-
from .webscout_search_async import AsyncWEBS
|
|
5
|
-
from .version import __version__
|
|
6
|
-
from .DWEBS import *
|
|
7
|
-
from .tempid import *
|
|
8
|
-
from .LLM import VLM, LLM
|
|
9
|
-
from .Provider import *
|
|
10
|
-
from .Provider.TTI import *
|
|
11
|
-
from .Provider.TTS import *
|
|
12
|
-
from .Provider.AISEARCH import *
|
|
13
|
-
from .Extra import *
|
|
14
|
-
from .Litlogger import *
|
|
15
|
-
from .optimizers import *
|
|
16
|
-
from .swiftcli import *
|
|
17
|
-
from .litagent import LitAgent
|
|
18
|
-
from .scout import *
|
|
19
|
-
from .zeroart import *
|
|
20
|
-
from .yep_search import *
|
|
21
|
-
agent = LitAgent()
|
|
22
|
-
|
|
23
|
-
__repo__ = "https://github.com/OE-LUCIFER/Webscout"
|
|
24
|
-
|
|
25
|
-
# Add update checker
|
|
26
|
-
from .update_checker import check_for_updates
|
|
27
|
-
try:
|
|
28
|
-
check_for_updates()
|
|
29
|
-
except Exception:
|
|
30
|
-
pass # Silently handle any update check errors
|
|
31
|
-
|
|
32
|
-
import logging
|
|
33
|
-
logging.getLogger("webscout").addHandler(logging.NullHandler())
|
|
34
|
-
|
|
35
|
-
# Import models for easy access
|
|
36
|
-
from webscout.models import model
|
|
1
|
+
# webscout/__init__.py
|
|
2
|
+
|
|
3
|
+
from .webscout_search import WEBS
|
|
4
|
+
from .webscout_search_async import AsyncWEBS
|
|
5
|
+
from .version import __version__
|
|
6
|
+
from .DWEBS import *
|
|
7
|
+
from .tempid import *
|
|
8
|
+
from .LLM import VLM, LLM
|
|
9
|
+
from .Provider import *
|
|
10
|
+
from .Provider.TTI import *
|
|
11
|
+
from .Provider.TTS import *
|
|
12
|
+
from .Provider.AISEARCH import *
|
|
13
|
+
from .Extra import *
|
|
14
|
+
from .Litlogger import *
|
|
15
|
+
from .optimizers import *
|
|
16
|
+
from .swiftcli import *
|
|
17
|
+
from .litagent import LitAgent
|
|
18
|
+
from .scout import *
|
|
19
|
+
from .zeroart import *
|
|
20
|
+
from .yep_search import *
|
|
21
|
+
agent = LitAgent()
|
|
22
|
+
|
|
23
|
+
__repo__ = "https://github.com/OE-LUCIFER/Webscout"
|
|
24
|
+
|
|
25
|
+
# Add update checker
|
|
26
|
+
from .update_checker import check_for_updates
|
|
27
|
+
try:
|
|
28
|
+
check_for_updates()
|
|
29
|
+
except Exception:
|
|
30
|
+
pass # Silently handle any update check errors
|
|
31
|
+
|
|
32
|
+
import logging
|
|
33
|
+
logging.getLogger("webscout").addHandler(logging.NullHandler())
|
|
34
|
+
|
|
35
|
+
# Import models for easy access
|
|
36
|
+
from webscout.models import model
|