webscout 7.4__py3-none-any.whl → 7.5__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/Provider/C4ai.py +414 -0
- webscout/Provider/Cloudflare.py +18 -21
- webscout/Provider/DeepSeek.py +3 -32
- webscout/Provider/Deepinfra.py +30 -21
- webscout/Provider/GithubChat.py +362 -0
- webscout/Provider/HeckAI.py +20 -3
- webscout/Provider/HuggingFaceChat.py +462 -0
- webscout/Provider/Marcus.py +7 -50
- webscout/Provider/Netwrck.py +6 -53
- webscout/Provider/Phind.py +29 -3
- webscout/Provider/TTI/aiarta/__init__.py +2 -0
- webscout/Provider/TTI/aiarta/async_aiarta.py +482 -0
- webscout/Provider/TTI/aiarta/sync_aiarta.py +409 -0
- webscout/Provider/Venice.py +200 -200
- webscout/Provider/Youchat.py +1 -1
- webscout/Provider/__init__.py +13 -2
- webscout/Provider/akashgpt.py +8 -5
- webscout/Provider/copilot.py +416 -0
- webscout/Provider/flowith.py +181 -0
- webscout/Provider/granite.py +17 -53
- webscout/Provider/llamatutor.py +6 -46
- webscout/Provider/llmchat.py +7 -46
- webscout/Provider/multichat.py +29 -91
- webscout/exceptions.py +19 -9
- webscout/update_checker.py +55 -93
- webscout/version.py +1 -1
- webscout-7.5.dist-info/LICENSE.md +146 -0
- {webscout-7.4.dist-info → webscout-7.5.dist-info}/METADATA +5 -126
- {webscout-7.4.dist-info → webscout-7.5.dist-info}/RECORD +32 -33
- webscout/Local/__init__.py +0 -10
- webscout/Local/_version.py +0 -3
- webscout/Local/formats.py +0 -747
- webscout/Local/model.py +0 -1368
- webscout/Local/samplers.py +0 -125
- webscout/Local/thread.py +0 -539
- webscout/Local/ui.py +0 -401
- webscout/Local/utils.py +0 -388
- webscout/Provider/dgaf.py +0 -214
- webscout-7.4.dist-info/LICENSE.md +0 -211
- {webscout-7.4.dist-info → webscout-7.5.dist-info}/WHEEL +0 -0
- {webscout-7.4.dist-info → webscout-7.5.dist-info}/entry_points.txt +0 -0
- {webscout-7.4.dist-info → webscout-7.5.dist-info}/top_level.txt +0 -0
webscout/Provider/Venice.py
CHANGED
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
from typing import Generator, Dict, Any, List, Union
|
|
4
|
-
from uuid import uuid4
|
|
5
|
-
|
|
6
|
-
from webscout.AIutel import Optimizers
|
|
7
|
-
from webscout.AIutel import Conversation
|
|
8
|
-
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
9
|
-
from webscout.AIbase import Provider
|
|
10
|
-
from webscout import exceptions
|
|
11
|
-
from webscout import LitAgent
|
|
12
|
-
|
|
13
|
-
class Venice(Provider):
|
|
14
|
-
"""
|
|
15
|
-
A class to interact with the Venice AI API.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
AVAILABLE_MODELS = [
|
|
19
|
-
"llama-3.3-70b",
|
|
20
|
-
"llama-3.2-3b-akash",
|
|
21
|
-
"qwen2dot5-coder-32b"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
self.
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"sec-ch-ua": '"
|
|
66
|
-
"sec-
|
|
67
|
-
"sec-
|
|
68
|
-
"sec-fetch-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
self.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
method
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
except
|
|
155
|
-
continue
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
response
|
|
199
|
-
for chunk in response:
|
|
200
|
-
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
from typing import Generator, Dict, Any, List, Union
|
|
4
|
+
from uuid import uuid4
|
|
5
|
+
|
|
6
|
+
from webscout.AIutel import Optimizers
|
|
7
|
+
from webscout.AIutel import Conversation
|
|
8
|
+
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
9
|
+
from webscout.AIbase import Provider
|
|
10
|
+
from webscout import exceptions
|
|
11
|
+
from webscout import LitAgent
|
|
12
|
+
|
|
13
|
+
class Venice(Provider):
|
|
14
|
+
"""
|
|
15
|
+
A class to interact with the Venice AI API.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
AVAILABLE_MODELS = [
|
|
19
|
+
"llama-3.3-70b",
|
|
20
|
+
"llama-3.2-3b-akash",
|
|
21
|
+
"qwen2dot5-coder-32b"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
is_conversation: bool = True,
|
|
27
|
+
max_tokens: int = 2000,
|
|
28
|
+
timeout: int = 30,
|
|
29
|
+
temperature: float = 0.8,
|
|
30
|
+
top_p: float = 0.9,
|
|
31
|
+
intro: str = None,
|
|
32
|
+
filepath: str = None,
|
|
33
|
+
update_file: bool = True,
|
|
34
|
+
proxies: dict = {},
|
|
35
|
+
history_offset: int = 10250,
|
|
36
|
+
act: str = None,
|
|
37
|
+
model: str = "llama-3.3-70b",
|
|
38
|
+
system_prompt: str = "You are a helpful AI assistant."
|
|
39
|
+
):
|
|
40
|
+
"""Initialize Venice AI client"""
|
|
41
|
+
if model not in self.AVAILABLE_MODELS:
|
|
42
|
+
raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
|
|
43
|
+
|
|
44
|
+
self.api_endpoint = "https://venice.ai/api/inference/chat"
|
|
45
|
+
self.session = requests.Session()
|
|
46
|
+
self.is_conversation = is_conversation
|
|
47
|
+
self.max_tokens_to_sample = max_tokens
|
|
48
|
+
self.temperature = temperature
|
|
49
|
+
self.top_p = top_p
|
|
50
|
+
self.timeout = timeout
|
|
51
|
+
self.model = model
|
|
52
|
+
self.system_prompt = system_prompt
|
|
53
|
+
self.last_response = {}
|
|
54
|
+
|
|
55
|
+
# Headers for the request
|
|
56
|
+
self.headers = {
|
|
57
|
+
"User-Agent": LitAgent().random(),
|
|
58
|
+
"accept": "*/*",
|
|
59
|
+
"accept-language": "en-US,en;q=0.9",
|
|
60
|
+
"content-type": "application/json",
|
|
61
|
+
"origin": "https://venice.ai",
|
|
62
|
+
"referer": "https://venice.ai/chat/",
|
|
63
|
+
"sec-ch-ua": '"Google Chrome";v="133", "Chromium";v="133", "Not?A_Brand";v="24"',
|
|
64
|
+
"sec-ch-ua-mobile": "?0",
|
|
65
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
66
|
+
"sec-fetch-dest": "empty",
|
|
67
|
+
"sec-fetch-mode": "cors",
|
|
68
|
+
"sec-fetch-site": "same-origin"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
self.session.headers.update(self.headers)
|
|
72
|
+
self.session.proxies.update(proxies)
|
|
73
|
+
|
|
74
|
+
self.__available_optimizers = (
|
|
75
|
+
method
|
|
76
|
+
for method in dir(Optimizers)
|
|
77
|
+
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
78
|
+
)
|
|
79
|
+
Conversation.intro = (
|
|
80
|
+
AwesomePrompts().get_act(
|
|
81
|
+
act, raise_not_found=True, default=None, case_insensitive=True
|
|
82
|
+
)
|
|
83
|
+
if act
|
|
84
|
+
else intro or Conversation.intro
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
self.conversation = Conversation(
|
|
88
|
+
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
89
|
+
)
|
|
90
|
+
self.conversation.history_offset = history_offset
|
|
91
|
+
|
|
92
|
+
def ask(
|
|
93
|
+
self,
|
|
94
|
+
prompt: str,
|
|
95
|
+
stream: bool = False,
|
|
96
|
+
raw: bool = False,
|
|
97
|
+
optimizer: str = None,
|
|
98
|
+
conversationally: bool = False,
|
|
99
|
+
) -> Union[Dict[str, Any], Generator]:
|
|
100
|
+
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
101
|
+
if optimizer:
|
|
102
|
+
if optimizer in self.__available_optimizers:
|
|
103
|
+
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
104
|
+
conversation_prompt if conversationally else prompt
|
|
105
|
+
)
|
|
106
|
+
else:
|
|
107
|
+
raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
|
|
108
|
+
|
|
109
|
+
# Payload construction
|
|
110
|
+
payload = {
|
|
111
|
+
"requestId": str(uuid4())[:7],
|
|
112
|
+
"modelId": self.model,
|
|
113
|
+
"prompt": [{"content": conversation_prompt, "role": "user"}],
|
|
114
|
+
"systemPrompt": self.system_prompt,
|
|
115
|
+
"conversationType": "text",
|
|
116
|
+
"temperature": self.temperature,
|
|
117
|
+
"webEnabled": True,
|
|
118
|
+
"topP": self.top_p,
|
|
119
|
+
"includeVeniceSystemPrompt": False,
|
|
120
|
+
"isCharacter": False,
|
|
121
|
+
"clientProcessingTime": 2000
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
def for_stream():
|
|
125
|
+
try:
|
|
126
|
+
with self.session.post(
|
|
127
|
+
self.api_endpoint,
|
|
128
|
+
json=payload,
|
|
129
|
+
stream=True,
|
|
130
|
+
timeout=self.timeout
|
|
131
|
+
) as response:
|
|
132
|
+
if response.status_code != 200:
|
|
133
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
134
|
+
f"Request failed with status code {response.status_code}"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
streaming_text = ""
|
|
138
|
+
for line in response.iter_lines():
|
|
139
|
+
if not line:
|
|
140
|
+
continue
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
# Decode bytes to string
|
|
144
|
+
line_data = line.decode('utf-8').strip()
|
|
145
|
+
if '"kind":"content"' in line_data:
|
|
146
|
+
data = json.loads(line_data)
|
|
147
|
+
if 'content' in data:
|
|
148
|
+
content = data['content']
|
|
149
|
+
streaming_text += content
|
|
150
|
+
resp = dict(text=content)
|
|
151
|
+
yield resp if raw else resp
|
|
152
|
+
except json.JSONDecodeError:
|
|
153
|
+
continue
|
|
154
|
+
except UnicodeDecodeError:
|
|
155
|
+
continue
|
|
156
|
+
|
|
157
|
+
self.conversation.update_chat_history(prompt, streaming_text)
|
|
158
|
+
|
|
159
|
+
except requests.RequestException as e:
|
|
160
|
+
raise exceptions.FailedToGenerateResponseError(f"Request failed: {str(e)}")
|
|
161
|
+
|
|
162
|
+
def for_non_stream():
|
|
163
|
+
full_text = ""
|
|
164
|
+
for chunk in for_stream():
|
|
165
|
+
full_text += chunk["text"]
|
|
166
|
+
return {"text": full_text}
|
|
167
|
+
|
|
168
|
+
return for_stream() if stream else for_non_stream()
|
|
169
|
+
|
|
170
|
+
def chat(
|
|
171
|
+
self,
|
|
172
|
+
prompt: str,
|
|
173
|
+
stream: bool = False,
|
|
174
|
+
optimizer: str = None,
|
|
175
|
+
conversationally: bool = False,
|
|
176
|
+
) -> Union[str, Generator]:
|
|
177
|
+
def for_stream():
|
|
178
|
+
for response in self.ask(prompt, True, optimizer=optimizer, conversationally=conversationally):
|
|
179
|
+
yield self.get_message(response)
|
|
180
|
+
def for_non_stream():
|
|
181
|
+
return self.get_message(
|
|
182
|
+
self.ask(prompt, False, optimizer=optimizer, conversationally=conversationally)
|
|
183
|
+
)
|
|
184
|
+
return for_stream() if stream else for_non_stream()
|
|
185
|
+
|
|
186
|
+
def get_message(self, response: dict) -> str:
|
|
187
|
+
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
188
|
+
return response["text"]
|
|
189
|
+
|
|
190
|
+
if __name__ == "__main__":
|
|
191
|
+
from rich import print
|
|
192
|
+
|
|
193
|
+
# Initialize Venice AI
|
|
194
|
+
ai = Venice(model="qwen2dot5-coder-32b", timeout=50)
|
|
195
|
+
|
|
196
|
+
# Test chat with streaming
|
|
197
|
+
response = ai.chat("Write a short story about an AI assistant", stream=False)
|
|
198
|
+
print(response)
|
|
199
|
+
# for chunk in response:
|
|
200
|
+
# print(chunk, end="", flush=True)
|
webscout/Provider/Youchat.py
CHANGED
|
@@ -264,6 +264,6 @@ class YouChat(Provider):
|
|
|
264
264
|
if __name__ == '__main__':
|
|
265
265
|
from rich import print
|
|
266
266
|
ai = YouChat(timeout=5000)
|
|
267
|
-
response = ai.chat("
|
|
267
|
+
response = ai.chat(input(">>> "), stream=True)
|
|
268
268
|
for chunk in response:
|
|
269
269
|
print(chunk, end="", flush=True)
|
webscout/Provider/__init__.py
CHANGED
|
@@ -63,7 +63,6 @@ from .chatglm import *
|
|
|
63
63
|
from .hermes import *
|
|
64
64
|
from .TextPollinationsAI import *
|
|
65
65
|
from .Glider import *
|
|
66
|
-
from .dgaf import *
|
|
67
66
|
from .ChatGPTGratis import *
|
|
68
67
|
from .QwenLM import *
|
|
69
68
|
from .granite import *
|
|
@@ -76,9 +75,19 @@ from .AllenAI import *
|
|
|
76
75
|
from .HeckAI import *
|
|
77
76
|
from .TwoAI import *
|
|
78
77
|
from .Venice import *
|
|
78
|
+
from .ElectronHub import *
|
|
79
|
+
from .HuggingFaceChat import *
|
|
80
|
+
from .GithubChat import *
|
|
81
|
+
from .copilot import *
|
|
82
|
+
from .C4ai import *
|
|
83
|
+
from .flowith import *
|
|
79
84
|
__all__ = [
|
|
80
85
|
'LLAMA',
|
|
86
|
+
'Flowith',
|
|
87
|
+
'C4ai',
|
|
81
88
|
'Venice',
|
|
89
|
+
'Copilot',
|
|
90
|
+
'HuggingFaceChat',
|
|
82
91
|
'TwoAI',
|
|
83
92
|
'HeckAI',
|
|
84
93
|
'AllenAI',
|
|
@@ -89,7 +98,7 @@ __all__ = [
|
|
|
89
98
|
'IBMGranite',
|
|
90
99
|
'QwenLM',
|
|
91
100
|
'ChatGPTGratis',
|
|
92
|
-
|
|
101
|
+
|
|
93
102
|
'TextPollinationsAI',
|
|
94
103
|
'GliderAI',
|
|
95
104
|
'Cohere',
|
|
@@ -155,4 +164,6 @@ __all__ = [
|
|
|
155
164
|
'ChatGLM',
|
|
156
165
|
'NousHermes',
|
|
157
166
|
'FreeAIChat',
|
|
167
|
+
'ElectronHub',
|
|
168
|
+
'GithubChat',
|
|
158
169
|
]
|
webscout/Provider/akashgpt.py
CHANGED
|
@@ -32,11 +32,13 @@ class AkashGPT(Provider):
|
|
|
32
32
|
"Meta-Llama-3-3-70B-Instruct",
|
|
33
33
|
"DeepSeek-R1",
|
|
34
34
|
"Meta-Llama-3-1-405B-Instruct-FP8",
|
|
35
|
-
"Meta-Llama-3-2-3B-Instruct",
|
|
36
|
-
"Meta-Llama-3-1-8B-Instruct-FP8",
|
|
37
|
-
"mistral",
|
|
38
|
-
"nous-hermes2-mixtral",
|
|
39
|
-
"dolphin-mixtral"
|
|
35
|
+
# "Meta-Llama-3-2-3B-Instruct",
|
|
36
|
+
# "Meta-Llama-3-1-8B-Instruct-FP8",
|
|
37
|
+
# "mistral",
|
|
38
|
+
# "nous-hermes2-mixtral",
|
|
39
|
+
# "dolphin-mixtral",
|
|
40
|
+
"Qwen-QwQ-32B"
|
|
41
|
+
|
|
40
42
|
]
|
|
41
43
|
|
|
42
44
|
def __init__(
|
|
@@ -186,6 +188,7 @@ class AkashGPT(Provider):
|
|
|
186
188
|
],
|
|
187
189
|
"model": self.model,
|
|
188
190
|
"temperature": self.temperature,
|
|
191
|
+
"system": self.system_prompt,
|
|
189
192
|
"topP": self.top_p
|
|
190
193
|
}
|
|
191
194
|
|