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.

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