webscout 8.3.2__py3-none-any.whl → 8.3.4__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 +367 -41
- webscout/Bard.py +2 -22
- webscout/Bing_search.py +1 -2
- webscout/Provider/AISEARCH/__init__.py +1 -0
- webscout/Provider/AISEARCH/scira_search.py +24 -11
- webscout/Provider/AISEARCH/stellar_search.py +132 -0
- webscout/Provider/Deepinfra.py +75 -57
- webscout/Provider/ExaChat.py +93 -63
- webscout/Provider/Flowith.py +1 -1
- webscout/Provider/FreeGemini.py +2 -2
- webscout/Provider/Gemini.py +3 -10
- webscout/Provider/GeminiProxy.py +31 -5
- webscout/Provider/HeckAI.py +85 -80
- webscout/Provider/Jadve.py +56 -50
- webscout/Provider/LambdaChat.py +39 -31
- webscout/Provider/MiniMax.py +207 -0
- webscout/Provider/Nemotron.py +41 -13
- webscout/Provider/Netwrck.py +39 -59
- webscout/Provider/OLLAMA.py +8 -9
- webscout/Provider/OPENAI/BLACKBOXAI.py +0 -1
- webscout/Provider/OPENAI/MiniMax.py +298 -0
- webscout/Provider/OPENAI/README.md +31 -30
- webscout/Provider/OPENAI/TogetherAI.py +4 -17
- webscout/Provider/OPENAI/__init__.py +4 -2
- webscout/Provider/OPENAI/autoproxy.py +753 -18
- webscout/Provider/OPENAI/base.py +7 -76
- webscout/Provider/OPENAI/copilot.py +73 -26
- webscout/Provider/OPENAI/deepinfra.py +96 -132
- webscout/Provider/OPENAI/exachat.py +9 -5
- webscout/Provider/OPENAI/flowith.py +179 -166
- webscout/Provider/OPENAI/friendli.py +233 -0
- webscout/Provider/OPENAI/monochat.py +329 -0
- webscout/Provider/OPENAI/netwrck.py +4 -7
- webscout/Provider/OPENAI/pydantic_imports.py +1 -172
- webscout/Provider/OPENAI/qodo.py +630 -0
- webscout/Provider/OPENAI/scirachat.py +82 -49
- webscout/Provider/OPENAI/textpollinations.py +13 -12
- webscout/Provider/OPENAI/toolbaz.py +1 -0
- webscout/Provider/OPENAI/typegpt.py +4 -4
- webscout/Provider/OPENAI/utils.py +19 -42
- webscout/Provider/OPENAI/x0gpt.py +14 -2
- webscout/Provider/OpenGPT.py +54 -32
- webscout/Provider/PI.py +58 -84
- webscout/Provider/Qodo.py +454 -0
- webscout/Provider/StandardInput.py +32 -13
- webscout/Provider/TTI/README.md +9 -9
- webscout/Provider/TTI/__init__.py +2 -1
- webscout/Provider/TTI/aiarta.py +92 -78
- webscout/Provider/TTI/infip.py +212 -0
- webscout/Provider/TTI/monochat.py +220 -0
- webscout/Provider/TeachAnything.py +11 -3
- webscout/Provider/TextPollinationsAI.py +91 -82
- webscout/Provider/TogetherAI.py +32 -48
- webscout/Provider/Venice.py +37 -46
- webscout/Provider/VercelAI.py +27 -24
- webscout/Provider/WiseCat.py +35 -35
- webscout/Provider/WrDoChat.py +22 -26
- webscout/Provider/WritingMate.py +26 -22
- webscout/Provider/__init__.py +6 -6
- webscout/Provider/copilot.py +58 -61
- webscout/Provider/freeaichat.py +64 -55
- webscout/Provider/granite.py +48 -57
- webscout/Provider/koala.py +51 -39
- webscout/Provider/learnfastai.py +49 -64
- webscout/Provider/llmchat.py +79 -93
- webscout/Provider/llmchatco.py +63 -78
- webscout/Provider/monochat.py +275 -0
- webscout/Provider/multichat.py +51 -40
- webscout/Provider/oivscode.py +1 -1
- webscout/Provider/scira_chat.py +257 -104
- webscout/Provider/scnet.py +13 -13
- webscout/Provider/searchchat.py +13 -13
- webscout/Provider/sonus.py +12 -11
- webscout/Provider/toolbaz.py +25 -8
- webscout/Provider/turboseek.py +41 -42
- webscout/Provider/typefully.py +27 -12
- webscout/Provider/typegpt.py +43 -48
- webscout/Provider/uncovr.py +55 -90
- webscout/Provider/x0gpt.py +325 -299
- webscout/Provider/yep.py +79 -96
- webscout/__init__.py +7 -2
- webscout/auth/__init__.py +12 -1
- webscout/auth/providers.py +27 -5
- webscout/auth/routes.py +146 -105
- webscout/auth/server.py +367 -312
- webscout/client.py +121 -116
- webscout/litagent/Readme.md +68 -55
- webscout/litagent/agent.py +99 -9
- webscout/version.py +1 -1
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/METADATA +102 -91
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/RECORD +95 -107
- webscout/Provider/AI21.py +0 -177
- webscout/Provider/HuggingFaceChat.py +0 -469
- webscout/Provider/OPENAI/freeaichat.py +0 -363
- webscout/Provider/TTI/fastflux.py +0 -233
- webscout/Provider/Writecream.py +0 -246
- webscout/auth/static/favicon.svg +0 -11
- webscout/auth/swagger_ui.py +0 -203
- webscout/auth/templates/components/authentication.html +0 -237
- webscout/auth/templates/components/base.html +0 -103
- webscout/auth/templates/components/endpoints.html +0 -750
- webscout/auth/templates/components/examples.html +0 -491
- webscout/auth/templates/components/footer.html +0 -75
- webscout/auth/templates/components/header.html +0 -27
- webscout/auth/templates/components/models.html +0 -286
- webscout/auth/templates/components/navigation.html +0 -70
- webscout/auth/templates/static/api.js +0 -455
- webscout/auth/templates/static/icons.js +0 -168
- webscout/auth/templates/static/main.js +0 -784
- webscout/auth/templates/static/particles.js +0 -201
- webscout/auth/templates/static/styles.css +0 -3353
- webscout/auth/templates/static/ui.js +0 -374
- webscout/auth/templates/swagger_ui.html +0 -170
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/WHEEL +0 -0
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/entry_points.txt +0 -0
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/licenses/LICENSE.md +0 -0
- {webscout-8.3.2.dist-info → webscout-8.3.4.dist-info}/top_level.txt +0 -0
webscout/Provider/VercelAI.py
CHANGED
|
@@ -141,7 +141,6 @@ class VercelAI(Provider):
|
|
|
141
141
|
raise Exception(
|
|
142
142
|
f"Optimizer is not one of {self.__available_optimizers}"
|
|
143
143
|
)
|
|
144
|
-
|
|
145
144
|
payload = {
|
|
146
145
|
"id": "guest",
|
|
147
146
|
"messages": [
|
|
@@ -155,7 +154,6 @@ class VercelAI(Provider):
|
|
|
155
154
|
],
|
|
156
155
|
"selectedChatModelId": self.model
|
|
157
156
|
}
|
|
158
|
-
|
|
159
157
|
def for_stream():
|
|
160
158
|
response = self.session.post(
|
|
161
159
|
self.api_endpoint, headers=self.headers, json=payload, stream=True, timeout=self.timeout
|
|
@@ -163,31 +161,32 @@ class VercelAI(Provider):
|
|
|
163
161
|
if not response.ok:
|
|
164
162
|
error_msg = f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
|
|
165
163
|
raise exceptions.FailedToGenerateResponseError(error_msg)
|
|
166
|
-
|
|
167
164
|
streaming_text = ""
|
|
168
|
-
# Use sanitize_stream with the custom extractor
|
|
169
165
|
processed_stream = sanitize_stream(
|
|
170
166
|
data=response.iter_content(chunk_size=None), # Pass byte iterator
|
|
171
167
|
intro_value=None, # No simple prefix
|
|
172
168
|
to_json=False, # Content is not JSON
|
|
173
|
-
content_extractor=self._vercelai_extractor # Use the specific extractor
|
|
169
|
+
content_extractor=self._vercelai_extractor, # Use the specific extractor
|
|
170
|
+
raw=raw
|
|
174
171
|
)
|
|
175
|
-
|
|
176
172
|
for content_chunk in processed_stream:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
# Always yield as string, even in raw mode
|
|
174
|
+
if isinstance(content_chunk, bytes):
|
|
175
|
+
content_chunk = content_chunk.decode('utf-8', errors='ignore')
|
|
176
|
+
if raw:
|
|
177
|
+
yield content_chunk
|
|
178
|
+
else:
|
|
179
|
+
if content_chunk and isinstance(content_chunk, str):
|
|
180
|
+
streaming_text += content_chunk
|
|
181
|
+
yield dict(text=content_chunk)
|
|
181
182
|
self.last_response.update(dict(text=streaming_text))
|
|
182
183
|
self.conversation.update_chat_history(
|
|
183
184
|
prompt, self.get_message(self.last_response)
|
|
184
185
|
)
|
|
185
|
-
|
|
186
186
|
def for_non_stream():
|
|
187
187
|
for _ in for_stream():
|
|
188
188
|
pass
|
|
189
189
|
return self.last_response
|
|
190
|
-
|
|
191
190
|
return for_stream() if stream else for_non_stream()
|
|
192
191
|
|
|
193
192
|
def chat(
|
|
@@ -196,24 +195,28 @@ class VercelAI(Provider):
|
|
|
196
195
|
stream: bool = False,
|
|
197
196
|
optimizer: str = None,
|
|
198
197
|
conversationally: bool = False,
|
|
198
|
+
raw: bool = False, # Added raw parameter
|
|
199
199
|
) -> str:
|
|
200
|
-
"""Generate response `str`"""
|
|
201
200
|
def for_stream():
|
|
202
201
|
for response in self.ask(
|
|
203
|
-
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
202
|
+
prompt, True, raw=raw, optimizer=optimizer, conversationally=conversationally
|
|
204
203
|
):
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
if raw:
|
|
205
|
+
yield response
|
|
206
|
+
else:
|
|
207
|
+
yield self.get_message(response)
|
|
207
208
|
def for_non_stream():
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
)
|
|
209
|
+
result = self.ask(
|
|
210
|
+
prompt,
|
|
211
|
+
False,
|
|
212
|
+
raw=raw,
|
|
213
|
+
optimizer=optimizer,
|
|
214
|
+
conversationally=conversationally,
|
|
215
215
|
)
|
|
216
|
-
|
|
216
|
+
if raw:
|
|
217
|
+
return result
|
|
218
|
+
else:
|
|
219
|
+
return self.get_message(result)
|
|
217
220
|
return for_stream() if stream else for_non_stream()
|
|
218
221
|
|
|
219
222
|
def get_message(self, response: dict) -> str:
|
webscout/Provider/WiseCat.py
CHANGED
|
@@ -106,7 +106,6 @@ class WiseCat(Provider):
|
|
|
106
106
|
raise Exception(
|
|
107
107
|
f"Optimizer is not one of {self.__available_optimizers}"
|
|
108
108
|
)
|
|
109
|
-
|
|
110
109
|
payload = {
|
|
111
110
|
"id": "ephemeral",
|
|
112
111
|
"messages": [
|
|
@@ -121,52 +120,49 @@ class WiseCat(Provider):
|
|
|
121
120
|
],
|
|
122
121
|
"selectedChatModel": self.model
|
|
123
122
|
}
|
|
124
|
-
|
|
125
123
|
def for_stream():
|
|
126
|
-
try:
|
|
127
|
-
# Use curl_cffi session post with impersonate
|
|
124
|
+
try:
|
|
128
125
|
response = self.session.post(
|
|
129
126
|
self.api_endpoint,
|
|
130
127
|
headers=self.headers,
|
|
131
128
|
json=payload,
|
|
132
129
|
stream=True,
|
|
133
130
|
timeout=self.timeout,
|
|
134
|
-
impersonate="chrome120"
|
|
131
|
+
impersonate="chrome120"
|
|
135
132
|
)
|
|
136
133
|
if not response.ok:
|
|
137
134
|
error_msg = f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
|
|
138
135
|
raise exceptions.FailedToGenerateResponseError(error_msg)
|
|
139
|
-
|
|
140
136
|
streaming_text = ""
|
|
141
|
-
# Use sanitize_stream with the custom extractor
|
|
142
137
|
processed_stream = sanitize_stream(
|
|
143
|
-
data=response.iter_content(chunk_size=None),
|
|
144
|
-
intro_value=None,
|
|
145
|
-
to_json=False,
|
|
146
|
-
content_extractor=self._wisecat_extractor
|
|
138
|
+
data=response.iter_content(chunk_size=None),
|
|
139
|
+
intro_value=None,
|
|
140
|
+
to_json=False,
|
|
141
|
+
content_extractor=self._wisecat_extractor,
|
|
142
|
+
raw=raw
|
|
147
143
|
)
|
|
148
|
-
|
|
149
144
|
for content_chunk in processed_stream:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
145
|
+
# Always yield as string, even in raw mode
|
|
146
|
+
if isinstance(content_chunk, bytes):
|
|
147
|
+
content_chunk = content_chunk.decode('utf-8', errors='ignore')
|
|
148
|
+
if raw:
|
|
149
|
+
yield content_chunk
|
|
150
|
+
else:
|
|
151
|
+
if content_chunk and isinstance(content_chunk, str):
|
|
152
|
+
streaming_text += content_chunk
|
|
153
|
+
yield dict(text=content_chunk)
|
|
154
|
+
self.last_response.update(dict(text=streaming_text))
|
|
155
155
|
self.conversation.update_chat_history(
|
|
156
156
|
prompt, self.get_message(self.last_response)
|
|
157
157
|
)
|
|
158
|
-
except CurlError as e:
|
|
158
|
+
except CurlError as e:
|
|
159
159
|
raise exceptions.FailedToGenerateResponseError(f"Request failed (CurlError): {e}")
|
|
160
|
-
except Exception as e:
|
|
160
|
+
except Exception as e:
|
|
161
161
|
raise exceptions.FailedToGenerateResponseError(f"An unexpected error occurred ({type(e).__name__}): {e}")
|
|
162
|
-
|
|
163
|
-
|
|
164
162
|
def for_non_stream():
|
|
165
|
-
# This function implicitly uses the updated for_stream
|
|
166
163
|
for _ in for_stream():
|
|
167
164
|
pass
|
|
168
165
|
return self.last_response
|
|
169
|
-
|
|
170
166
|
return for_stream() if stream else for_non_stream()
|
|
171
167
|
|
|
172
168
|
def chat(
|
|
@@ -175,24 +171,28 @@ class WiseCat(Provider):
|
|
|
175
171
|
stream: bool = False,
|
|
176
172
|
optimizer: str = None,
|
|
177
173
|
conversationally: bool = False,
|
|
174
|
+
raw: bool = False, # Added raw parameter
|
|
178
175
|
) -> str:
|
|
179
|
-
"""Generate response `str`"""
|
|
180
176
|
def for_stream():
|
|
181
177
|
for response in self.ask(
|
|
182
|
-
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
178
|
+
prompt, True, raw=raw, optimizer=optimizer, conversationally=conversationally
|
|
183
179
|
):
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
if raw:
|
|
181
|
+
yield response
|
|
182
|
+
else:
|
|
183
|
+
yield self.get_message(response)
|
|
186
184
|
def for_non_stream():
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
185
|
+
result = self.ask(
|
|
186
|
+
prompt,
|
|
187
|
+
False,
|
|
188
|
+
raw=raw,
|
|
189
|
+
optimizer=optimizer,
|
|
190
|
+
conversationally=conversationally,
|
|
194
191
|
)
|
|
195
|
-
|
|
192
|
+
if raw:
|
|
193
|
+
return result
|
|
194
|
+
else:
|
|
195
|
+
return self.get_message(result)
|
|
196
196
|
return for_stream() if stream else for_non_stream()
|
|
197
197
|
|
|
198
198
|
def get_message(self, response: dict) -> str:
|
webscout/Provider/WrDoChat.py
CHANGED
|
@@ -244,7 +244,6 @@ class WrDoChat(Provider):
|
|
|
244
244
|
def for_stream():
|
|
245
245
|
try:
|
|
246
246
|
self.headers["referer"] = f"https://oi.wr.do/chat/{chat_id}"
|
|
247
|
-
|
|
248
247
|
response = self.session.post(
|
|
249
248
|
self.api_endpoint,
|
|
250
249
|
json=payload,
|
|
@@ -252,31 +251,27 @@ class WrDoChat(Provider):
|
|
|
252
251
|
timeout=self.timeout,
|
|
253
252
|
impersonate="chrome110"
|
|
254
253
|
)
|
|
255
|
-
|
|
256
254
|
if response.status_code == 401:
|
|
257
255
|
raise exceptions.AuthenticationError("Authentication failed. Please check your cookies.")
|
|
258
|
-
|
|
259
256
|
response.raise_for_status()
|
|
260
|
-
|
|
261
257
|
streaming_response = ""
|
|
262
258
|
has_content = False
|
|
263
|
-
|
|
264
|
-
# Use sanitize_stream with the custom extractor
|
|
265
259
|
processed_stream = sanitize_stream(
|
|
266
260
|
data=response.iter_lines(),
|
|
267
261
|
intro_value=None, # No intro to remove
|
|
268
262
|
to_json=False, # Response is not JSON
|
|
269
263
|
content_extractor=self._wrdo_extractor,
|
|
270
|
-
yield_raw_on_error=False
|
|
264
|
+
yield_raw_on_error=False,
|
|
265
|
+
raw=raw
|
|
271
266
|
)
|
|
272
|
-
|
|
273
267
|
for content in processed_stream:
|
|
268
|
+
# Always yield as string, even in raw mode
|
|
269
|
+
if isinstance(content, bytes):
|
|
270
|
+
content = content.decode('utf-8', errors='ignore')
|
|
274
271
|
if content and isinstance(content, str):
|
|
275
272
|
streaming_response += content
|
|
276
273
|
has_content = True
|
|
277
|
-
yield
|
|
278
|
-
|
|
279
|
-
# Only update conversation history if we received content
|
|
274
|
+
yield content if raw else {"text": content}
|
|
280
275
|
if has_content:
|
|
281
276
|
self.last_response = {"text": streaming_response}
|
|
282
277
|
self.conversation.update_chat_history(
|
|
@@ -286,12 +281,10 @@ class WrDoChat(Provider):
|
|
|
286
281
|
raise exceptions.FailedToGenerateResponseError(
|
|
287
282
|
"No content received from API"
|
|
288
283
|
)
|
|
289
|
-
|
|
290
284
|
except CurlError as e:
|
|
291
285
|
raise exceptions.FailedToGenerateResponseError(f"Request failed (CurlError): {e}")
|
|
292
286
|
except Exception as e:
|
|
293
287
|
raise exceptions.FailedToGenerateResponseError(f"An error occurred: {str(e)}")
|
|
294
|
-
|
|
295
288
|
def for_non_stream():
|
|
296
289
|
response_text = ""
|
|
297
290
|
try:
|
|
@@ -303,9 +296,7 @@ class WrDoChat(Provider):
|
|
|
303
296
|
except Exception as e:
|
|
304
297
|
if not response_text:
|
|
305
298
|
raise exceptions.FailedToGenerateResponseError(f"Failed to get response: {str(e)}")
|
|
306
|
-
|
|
307
299
|
return response_text if raw else {"text": response_text}
|
|
308
|
-
|
|
309
300
|
return for_stream() if stream else for_non_stream()
|
|
310
301
|
|
|
311
302
|
def chat(
|
|
@@ -314,6 +305,7 @@ class WrDoChat(Provider):
|
|
|
314
305
|
stream: bool = False,
|
|
315
306
|
optimizer: str = None,
|
|
316
307
|
conversationally: bool = False,
|
|
308
|
+
raw: bool = False, # Added raw parameter
|
|
317
309
|
) -> Union[str, Generator[str, None, None]]:
|
|
318
310
|
"""
|
|
319
311
|
Generate a response to a prompt.
|
|
@@ -329,20 +321,24 @@ class WrDoChat(Provider):
|
|
|
329
321
|
"""
|
|
330
322
|
def for_stream():
|
|
331
323
|
for response in self.ask(
|
|
332
|
-
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
324
|
+
prompt, True, raw=raw, optimizer=optimizer, conversationally=conversationally
|
|
333
325
|
):
|
|
334
|
-
|
|
335
|
-
|
|
326
|
+
if raw:
|
|
327
|
+
yield response
|
|
328
|
+
else:
|
|
329
|
+
yield self.get_message(response)
|
|
336
330
|
def for_non_stream():
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
)
|
|
331
|
+
result = self.ask(
|
|
332
|
+
prompt,
|
|
333
|
+
False,
|
|
334
|
+
raw=raw,
|
|
335
|
+
optimizer=optimizer,
|
|
336
|
+
conversationally=conversationally,
|
|
344
337
|
)
|
|
345
|
-
|
|
338
|
+
if raw:
|
|
339
|
+
return result
|
|
340
|
+
else:
|
|
341
|
+
return self.get_message(result)
|
|
346
342
|
return for_stream() if stream else for_non_stream()
|
|
347
343
|
|
|
348
344
|
def get_message(self, response: dict) -> str:
|
webscout/Provider/WritingMate.py
CHANGED
|
@@ -178,13 +178,20 @@ class WritingMate(Provider):
|
|
|
178
178
|
data=response.iter_content(chunk_size=None), # Pass byte iterator
|
|
179
179
|
intro_value=None, # No simple prefix
|
|
180
180
|
to_json=False, # Content is not JSON
|
|
181
|
-
content_extractor=self._writingmate_extractor # Use the specific extractor
|
|
181
|
+
content_extractor=self._writingmate_extractor, # Use the specific extractor
|
|
182
|
+
raw=raw
|
|
182
183
|
)
|
|
183
184
|
|
|
184
185
|
for content_chunk in processed_stream:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
# Always yield as string, even in raw mode
|
|
187
|
+
if isinstance(content_chunk, bytes):
|
|
188
|
+
content_chunk = content_chunk.decode('utf-8', errors='ignore')
|
|
189
|
+
if raw:
|
|
190
|
+
yield content_chunk
|
|
191
|
+
else:
|
|
192
|
+
if content_chunk and isinstance(content_chunk, str):
|
|
193
|
+
streaming_text += content_chunk
|
|
194
|
+
yield dict(text=content_chunk)
|
|
188
195
|
|
|
189
196
|
self.last_response.update(dict(text=streaming_text))
|
|
190
197
|
self.conversation.update_chat_history(
|
|
@@ -196,12 +203,10 @@ class WritingMate(Provider):
|
|
|
196
203
|
raise exceptions.FailedToGenerateResponseError(f"An unexpected error occurred ({type(e).__name__}): {e}")
|
|
197
204
|
|
|
198
205
|
def for_non_stream():
|
|
199
|
-
# This function implicitly uses the updated for_stream
|
|
200
206
|
for _ in for_stream():
|
|
201
207
|
pass
|
|
202
208
|
return self.last_response
|
|
203
209
|
|
|
204
|
-
# Ensure stream defaults to True if not provided, matching original behavior
|
|
205
210
|
effective_stream = stream if stream is not None else True
|
|
206
211
|
return for_stream() if effective_stream else for_non_stream()
|
|
207
212
|
|
|
@@ -210,36 +215,35 @@ class WritingMate(Provider):
|
|
|
210
215
|
prompt: str,
|
|
211
216
|
stream: bool = False, # Default stream to False as per original chat method
|
|
212
217
|
optimizer: str = None,
|
|
213
|
-
conversationally: bool = False
|
|
218
|
+
conversationally: bool = False,
|
|
219
|
+
raw: bool = False, # Added raw parameter
|
|
214
220
|
) -> Union[str, Generator[str,None,None]]:
|
|
215
221
|
if stream:
|
|
216
|
-
# yield decoded text chunks
|
|
217
222
|
def text_stream():
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
prompt, stream=True, raw=False,
|
|
223
|
+
for response in self.ask(
|
|
224
|
+
prompt, stream=True, raw=raw,
|
|
221
225
|
optimizer=optimizer, conversationally=conversationally
|
|
222
226
|
):
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
if raw:
|
|
228
|
+
yield response
|
|
229
|
+
else:
|
|
230
|
+
yield self.get_message(response)
|
|
225
231
|
return text_stream()
|
|
226
|
-
else:
|
|
227
|
-
# Call ask with stream=False, raw=False
|
|
232
|
+
else:
|
|
228
233
|
response_data = self.ask(
|
|
229
234
|
prompt,
|
|
230
235
|
stream=False,
|
|
231
|
-
raw=
|
|
236
|
+
raw=raw,
|
|
232
237
|
optimizer=optimizer,
|
|
233
238
|
conversationally=conversationally,
|
|
234
239
|
)
|
|
235
|
-
|
|
240
|
+
if raw:
|
|
241
|
+
return response_data
|
|
236
242
|
if isinstance(response_data, dict):
|
|
237
|
-
|
|
243
|
+
return self.get_message(response_data)
|
|
238
244
|
else:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
full_text = "".join(self.get_message(chunk) for chunk in response_data if isinstance(chunk, dict))
|
|
242
|
-
return full_text
|
|
245
|
+
full_text = "".join(self.get_message(chunk) for chunk in response_data if isinstance(chunk, dict))
|
|
246
|
+
return full_text
|
|
243
247
|
|
|
244
248
|
|
|
245
249
|
def get_message(self, response: dict) -> str:
|
webscout/Provider/__init__.py
CHANGED
|
@@ -24,7 +24,6 @@ from .yep import *
|
|
|
24
24
|
from .Cloudflare import *
|
|
25
25
|
from .turboseek import *
|
|
26
26
|
from .TeachAnything import *
|
|
27
|
-
from .AI21 import *
|
|
28
27
|
from .x0gpt import *
|
|
29
28
|
from .cerebras import *
|
|
30
29
|
from .geminiapi import *
|
|
@@ -52,7 +51,6 @@ from .AllenAI import *
|
|
|
52
51
|
from .HeckAI import *
|
|
53
52
|
from .TwoAI import *
|
|
54
53
|
from .Venice import *
|
|
55
|
-
from .HuggingFaceChat import *
|
|
56
54
|
from .GithubChat import *
|
|
57
55
|
from .copilot import *
|
|
58
56
|
from .sonus import *
|
|
@@ -68,7 +66,6 @@ from .ExaAI import ExaAI
|
|
|
68
66
|
from .OpenGPT import OpenGPT
|
|
69
67
|
from .scira_chat import *
|
|
70
68
|
from .StandardInput import *
|
|
71
|
-
from .Writecream import Writecream
|
|
72
69
|
from .toolbaz import Toolbaz
|
|
73
70
|
from .scnet import SCNet
|
|
74
71
|
from .WritingMate import WritingMate
|
|
@@ -87,8 +84,14 @@ from .XenAI import XenAI
|
|
|
87
84
|
from .deepseek_assistant import DeepSeekAssistant
|
|
88
85
|
from .GeminiProxy import GeminiProxy
|
|
89
86
|
from .TogetherAI import TogetherAI
|
|
87
|
+
from .MiniMax import MiniMax
|
|
88
|
+
from .Qodo import *
|
|
89
|
+
from .monochat import MonoChat
|
|
90
90
|
__all__ = [
|
|
91
91
|
'SCNet',
|
|
92
|
+
'MonoChat',
|
|
93
|
+
'MiniMax',
|
|
94
|
+
'QodoAI',
|
|
92
95
|
'GeminiProxy',
|
|
93
96
|
'TogetherAI',
|
|
94
97
|
'oivscode',
|
|
@@ -108,7 +111,6 @@ __all__ = [
|
|
|
108
111
|
'Venice',
|
|
109
112
|
'ExaAI',
|
|
110
113
|
'Copilot',
|
|
111
|
-
'HuggingFaceChat',
|
|
112
114
|
'TwoAI',
|
|
113
115
|
'HeckAI',
|
|
114
116
|
'AllenAI',
|
|
@@ -144,7 +146,6 @@ __all__ = [
|
|
|
144
146
|
'Cloudflare',
|
|
145
147
|
'TurboSeek',
|
|
146
148
|
'TeachAnything',
|
|
147
|
-
'AI21',
|
|
148
149
|
'X0GPT',
|
|
149
150
|
'Cerebras',
|
|
150
151
|
'GEMINIAPI',
|
|
@@ -173,7 +174,6 @@ __all__ = [
|
|
|
173
174
|
'AskSteve',
|
|
174
175
|
'Aitopia',
|
|
175
176
|
'SearchChatAI',
|
|
176
|
-
'Writecream',
|
|
177
177
|
'Toolbaz',
|
|
178
178
|
'MCPCore',
|
|
179
179
|
'TypliAI',
|