webscout 4.5__py3-none-any.whl → 4.6__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 +10 -0
- webscout/Extra/gguf.py +1 -1
- webscout/Provider/BasedGPT.py +38 -36
- webscout/Provider/Blackboxai.py +14 -10
- webscout/Provider/DARKAI.py +207 -0
- webscout/Provider/Deepseek.py +79 -133
- webscout/Provider/Llama3.py +173 -0
- webscout/Provider/PizzaGPT.py +178 -0
- webscout/Provider/RUBIKSAI.py +201 -0
- webscout/Provider/__init__.py +11 -3
- webscout/Provider/koala.py +239 -0
- webscout/__init__.py +1 -0
- webscout/version.py +1 -1
- webscout/webai.py +15 -1
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/METADATA +12 -14
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/RECORD +20 -15
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/WHEEL +1 -1
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/LICENSE.md +0 -0
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/entry_points.txt +0 -0
- {webscout-4.5.dist-info → webscout-4.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
from ..AIutel import Optimizers
|
|
5
|
+
from ..AIutel import Conversation
|
|
6
|
+
from ..AIutel import AwesomePrompts, sanitize_stream
|
|
7
|
+
from ..AIbase import Provider
|
|
8
|
+
from webscout import exceptions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RUBIKSAI(Provider):
|
|
12
|
+
"""
|
|
13
|
+
A class to interact with the Rubiks.ai API.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
is_conversation: bool = True,
|
|
19
|
+
max_tokens: int = 600,
|
|
20
|
+
timeout: int = 30,
|
|
21
|
+
intro: str = None,
|
|
22
|
+
filepath: str = None,
|
|
23
|
+
update_file: bool = True,
|
|
24
|
+
proxies: dict = {},
|
|
25
|
+
history_offset: int = 10250,
|
|
26
|
+
act: str = None,
|
|
27
|
+
model: str = "gpt-4o-mini",
|
|
28
|
+
) -> None:
|
|
29
|
+
"""
|
|
30
|
+
Initializes the RUBIKSAI API with given parameters.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
34
|
+
max_tokens (int, optional): Maximum number of tokens to be generated upon completion.
|
|
35
|
+
Defaults to 600.
|
|
36
|
+
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
37
|
+
intro (str, optional): Conversation introductory prompt. Defaults to None.
|
|
38
|
+
filepath (str, optional): Path to file containing conversation history. Defaults to None.
|
|
39
|
+
update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
|
|
40
|
+
proxies (dict, optional): Http request proxies. Defaults to {}.
|
|
41
|
+
history_offset (int, optional): Limit conversation history to this number of last texts.
|
|
42
|
+
Defaults to 10250.
|
|
43
|
+
act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
|
|
44
|
+
model (str, optional): AI model to use. Defaults to "gpt-4o-mini".
|
|
45
|
+
"""
|
|
46
|
+
self.session = requests.Session()
|
|
47
|
+
self.is_conversation = is_conversation
|
|
48
|
+
self.max_tokens_to_sample = max_tokens
|
|
49
|
+
self.api_endpoint = "https://rubiks.ai/search/api.php"
|
|
50
|
+
self.stream_chunk_size = 64
|
|
51
|
+
self.timeout = timeout
|
|
52
|
+
self.last_response = {}
|
|
53
|
+
self.model = model
|
|
54
|
+
self.headers = {
|
|
55
|
+
"accept": "text/event-stream",
|
|
56
|
+
"accept-encoding": "gzip, deflate, br, zstd",
|
|
57
|
+
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
58
|
+
"cache-control": "no-cache",
|
|
59
|
+
"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 Edg/127.0.0.0"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
self.__available_optimizers = (
|
|
63
|
+
method
|
|
64
|
+
for method in dir(Optimizers)
|
|
65
|
+
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
66
|
+
)
|
|
67
|
+
self.session.headers.update(self.headers)
|
|
68
|
+
Conversation.intro = (
|
|
69
|
+
AwesomePrompts().get_act(
|
|
70
|
+
act, raise_not_found=True, default=None, case_insensitive=True
|
|
71
|
+
)
|
|
72
|
+
if act
|
|
73
|
+
else intro or Conversation.intro
|
|
74
|
+
)
|
|
75
|
+
self.conversation = Conversation(
|
|
76
|
+
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
77
|
+
)
|
|
78
|
+
self.conversation.history_offset = history_offset
|
|
79
|
+
self.session.proxies = proxies
|
|
80
|
+
|
|
81
|
+
def ask(
|
|
82
|
+
self,
|
|
83
|
+
prompt: str,
|
|
84
|
+
stream: bool = False,
|
|
85
|
+
raw: bool = False,
|
|
86
|
+
optimizer: str = None,
|
|
87
|
+
conversationally: bool = False,
|
|
88
|
+
) -> Dict[str, Any]:
|
|
89
|
+
"""
|
|
90
|
+
Sends a prompt to the Rubiks.ai API and returns the response.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
prompt: The text prompt to generate text from.
|
|
94
|
+
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
95
|
+
raw (bool, optional): Whether to return the raw response. Defaults to False.
|
|
96
|
+
optimizer (str, optional): The name of the optimizer to use. Defaults to None.
|
|
97
|
+
conversationally (bool, optional): Whether to chat conversationally. Defaults to False.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
The response from the API.
|
|
101
|
+
"""
|
|
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(
|
|
110
|
+
f"Optimizer is not one of {self.__available_optimizers}"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
params = {
|
|
114
|
+
"q": conversation_prompt,
|
|
115
|
+
"model": self.model,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
def for_stream():
|
|
119
|
+
response = self.session.get(
|
|
120
|
+
self.api_endpoint, params=params, headers=self.headers, stream=True, timeout=self.timeout
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
if not response.ok:
|
|
124
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
125
|
+
f"Failed to generate response - ({response.status_code}, {response.reason})"
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
streaming_response = ""
|
|
129
|
+
for line in response.iter_lines(decode_unicode=True):
|
|
130
|
+
if line:
|
|
131
|
+
if line.startswith("data: "):
|
|
132
|
+
json_data = line[6:]
|
|
133
|
+
if json_data == "[DONE]":
|
|
134
|
+
break
|
|
135
|
+
try:
|
|
136
|
+
data = json.loads(json_data)
|
|
137
|
+
if "choices" in data and len(data["choices"]) > 0:
|
|
138
|
+
content = data["choices"][0]["delta"].get("content", "")
|
|
139
|
+
streaming_response += content
|
|
140
|
+
yield content if raw else dict(text=streaming_response)
|
|
141
|
+
except json.decoder.JSONDecodeError:
|
|
142
|
+
continue
|
|
143
|
+
|
|
144
|
+
self.last_response.update(dict(text=streaming_response))
|
|
145
|
+
self.conversation.update_chat_history(
|
|
146
|
+
prompt, self.get_message(self.last_response)
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def for_non_stream():
|
|
150
|
+
for _ in for_stream():
|
|
151
|
+
pass
|
|
152
|
+
return self.last_response
|
|
153
|
+
|
|
154
|
+
return for_stream() if stream else for_non_stream()
|
|
155
|
+
|
|
156
|
+
def chat(
|
|
157
|
+
self,
|
|
158
|
+
prompt: str,
|
|
159
|
+
stream: bool = False,
|
|
160
|
+
optimizer: str = None,
|
|
161
|
+
conversationally: bool = False,
|
|
162
|
+
) -> str:
|
|
163
|
+
"""Generate response `str`
|
|
164
|
+
Args:
|
|
165
|
+
prompt (str): Prompt to be send.
|
|
166
|
+
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
167
|
+
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
168
|
+
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
169
|
+
Returns:
|
|
170
|
+
str: Response generated
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
def for_stream():
|
|
174
|
+
for response in self.ask(
|
|
175
|
+
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
176
|
+
):
|
|
177
|
+
yield self.get_message(response)
|
|
178
|
+
|
|
179
|
+
def for_non_stream():
|
|
180
|
+
return self.get_message(
|
|
181
|
+
self.ask(
|
|
182
|
+
prompt,
|
|
183
|
+
False,
|
|
184
|
+
optimizer=optimizer,
|
|
185
|
+
conversationally=conversationally,
|
|
186
|
+
)
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
return for_stream() if stream else for_non_stream()
|
|
190
|
+
|
|
191
|
+
def get_message(self, response: dict) -> str:
|
|
192
|
+
"""Retrieves message only from response
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
response (dict): Response generated by `self.ask`
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
str: Message extracted
|
|
199
|
+
"""
|
|
200
|
+
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
201
|
+
return response["text"]
|
webscout/Provider/__init__.py
CHANGED
|
@@ -39,6 +39,11 @@ from .Geminiflash import GEMINIFLASH
|
|
|
39
39
|
from .OLLAMA import OLLAMA
|
|
40
40
|
from .FreeGemini import FreeGemini
|
|
41
41
|
from .Andi import AndiSearch
|
|
42
|
+
from .PizzaGPT import *
|
|
43
|
+
from .Llama3 import *
|
|
44
|
+
from .DARKAI import *
|
|
45
|
+
from .koala import *
|
|
46
|
+
from .RUBIKSAI import *
|
|
42
47
|
__all__ = [
|
|
43
48
|
'ThinkAnyAI',
|
|
44
49
|
'Xjai',
|
|
@@ -80,7 +85,10 @@ __all__ = [
|
|
|
80
85
|
'GEMINIFLASH',
|
|
81
86
|
'OLLAMA',
|
|
82
87
|
'FreeGemini',
|
|
83
|
-
'AndiSearch'
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
'AndiSearch',
|
|
89
|
+
'PIZZAGPT',
|
|
90
|
+
'LLAMA3',
|
|
91
|
+
'DARKAI',
|
|
92
|
+
'KOALA',
|
|
93
|
+
'RUBIKSAI'
|
|
86
94
|
]
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
from ..AIutel import Optimizers
|
|
5
|
+
from ..AIutel import Conversation
|
|
6
|
+
from ..AIutel import AwesomePrompts, sanitize_stream
|
|
7
|
+
from ..AIbase import Provider
|
|
8
|
+
from webscout import exceptions
|
|
9
|
+
|
|
10
|
+
class KOALA(Provider):
|
|
11
|
+
"""
|
|
12
|
+
A class to interact with the Koala.sh API.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
is_conversation: bool = True,
|
|
18
|
+
max_tokens: int = 600,
|
|
19
|
+
timeout: int = 30,
|
|
20
|
+
intro: str = None,
|
|
21
|
+
filepath: str = None,
|
|
22
|
+
update_file: bool = True,
|
|
23
|
+
proxies: dict = {},
|
|
24
|
+
history_offset: int = 10250,
|
|
25
|
+
act: str = None,
|
|
26
|
+
model: str = "gpt-4o-mini",
|
|
27
|
+
web_search: bool = True,
|
|
28
|
+
|
|
29
|
+
) -> None:
|
|
30
|
+
"""
|
|
31
|
+
Initializes the KOALASH API with given parameters.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
35
|
+
max_tokens (int, optional): Maximum number of tokens to be generated upon completion.
|
|
36
|
+
Defaults to 600.
|
|
37
|
+
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
38
|
+
intro (str, optional): Conversation introductory prompt. Defaults to None.
|
|
39
|
+
filepath (str, optional): Path to file containing conversation history. Defaults to None.
|
|
40
|
+
update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
|
|
41
|
+
proxies (dict, optional): Http request proxies. Defaults to {}.
|
|
42
|
+
history_offset (int, optional): Limit conversation history to this number of last texts.
|
|
43
|
+
Defaults to 10250.
|
|
44
|
+
act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
|
|
45
|
+
model (str, optional): AI model to use. Defaults to "gpt-4o-mini".
|
|
46
|
+
"""
|
|
47
|
+
self.session = requests.Session()
|
|
48
|
+
self.is_conversation = is_conversation
|
|
49
|
+
self.max_tokens_to_sample = max_tokens
|
|
50
|
+
self.api_endpoint = "https://koala.sh/api/gpt/"
|
|
51
|
+
self.stream_chunk_size = 64
|
|
52
|
+
self.timeout = timeout
|
|
53
|
+
self.last_response = {}
|
|
54
|
+
self.model = model
|
|
55
|
+
self.headers = {
|
|
56
|
+
"accept": "text/event-stream",
|
|
57
|
+
"accept-encoding": "gzip, deflate, br, zstd",
|
|
58
|
+
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
59
|
+
"content-length": "73",
|
|
60
|
+
"content-type": "application/json",
|
|
61
|
+
"dnt": "1",
|
|
62
|
+
"flag-real-time-data": "true" if web_search else "false",
|
|
63
|
+
"origin": "https://koala.sh",
|
|
64
|
+
"priority": "u=1, i",
|
|
65
|
+
"referer": "https://koala.sh/chat",
|
|
66
|
+
"sec-ch-ua": '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
|
|
67
|
+
"sec-ch-ua-mobile": "?0",
|
|
68
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
69
|
+
"sec-fetch-dest": "empty",
|
|
70
|
+
"sec-fetch-mode": "cors",
|
|
71
|
+
"sec-fetch-site": "same-origin",
|
|
72
|
+
"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 Edg/127.0.0.0",
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
self.__available_optimizers = (
|
|
76
|
+
method
|
|
77
|
+
for method in dir(Optimizers)
|
|
78
|
+
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
79
|
+
)
|
|
80
|
+
self.session.headers.update(self.headers)
|
|
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
|
+
self.conversation = Conversation(
|
|
89
|
+
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
90
|
+
)
|
|
91
|
+
self.conversation.history_offset = history_offset
|
|
92
|
+
self.session.proxies = proxies
|
|
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
|
+
) -> Dict[str, Any]:
|
|
102
|
+
"""
|
|
103
|
+
Sends a prompt to the Koala.sh API and returns the response.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
prompt: The text prompt to generate text from.
|
|
107
|
+
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
108
|
+
raw (bool, optional): Whether to return the raw response. Defaults to False.
|
|
109
|
+
optimizer (str, optional): The name of the optimizer to use. Defaults to None.
|
|
110
|
+
conversationally (bool, optional): Whether to chat conversationally. Defaults to False.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
The response from the API.
|
|
114
|
+
"""
|
|
115
|
+
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
116
|
+
if optimizer:
|
|
117
|
+
if optimizer in self.__available_optimizers:
|
|
118
|
+
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
119
|
+
conversation_prompt if conversationally else prompt
|
|
120
|
+
)
|
|
121
|
+
else:
|
|
122
|
+
raise Exception(
|
|
123
|
+
f"Optimizer is not one of {self.__available_optimizers}"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
payload = {
|
|
127
|
+
"input": conversation_prompt,
|
|
128
|
+
"model": self.model
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
def for_stream():
|
|
132
|
+
response = self.session.post(
|
|
133
|
+
self.api_endpoint, json=payload, headers=self.headers, stream=True, timeout=self.timeout
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
if not response.ok:
|
|
137
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
138
|
+
f"Failed to generate response - ({response.status_code}, {response.reason})"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
streaming_response = ""
|
|
142
|
+
for line in response.iter_lines(decode_unicode=True):
|
|
143
|
+
if line:
|
|
144
|
+
if line.startswith("data:"):
|
|
145
|
+
data = line[len("data:"):].strip()
|
|
146
|
+
if data:
|
|
147
|
+
try:
|
|
148
|
+
event = json.loads(data)
|
|
149
|
+
streaming_response += event.get("choices", [{}])[0].get("delta", {}).get("content", "")
|
|
150
|
+
yield event if raw else dict(text=streaming_response)
|
|
151
|
+
except json.decoder.JSONDecodeError:
|
|
152
|
+
continue
|
|
153
|
+
self.last_response.update(dict(text=streaming_response))
|
|
154
|
+
self.conversation.update_chat_history(
|
|
155
|
+
prompt, self.get_message(self.last_response)
|
|
156
|
+
)
|
|
157
|
+
def for_non_stream():
|
|
158
|
+
response = self.session.post(
|
|
159
|
+
self.api_endpoint, json=payload, headers=self.headers, timeout=self.timeout
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
if not response.ok:
|
|
163
|
+
raise exceptions.FailedToGenerateResponseError(
|
|
164
|
+
f"Failed to generate response - ({response.status_code}, {response.reason})"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
response_content = response.content.decode('utf-8')
|
|
168
|
+
data_parts = response_content.strip().split('\n\n')
|
|
169
|
+
formatted_response = ''.join([part.replace('data: ', '') for part in data_parts if part.startswith('data: ')])
|
|
170
|
+
|
|
171
|
+
# Remove extra quotes from the formatted response
|
|
172
|
+
formatted_response = formatted_response.replace('""', '')
|
|
173
|
+
|
|
174
|
+
# Split the response into lines and format with new lines before headers
|
|
175
|
+
lines = formatted_response.split('\n')
|
|
176
|
+
formatted_lines = []
|
|
177
|
+
for line in lines:
|
|
178
|
+
if line.startswith('###'):
|
|
179
|
+
formatted_lines.append('\n' + line)
|
|
180
|
+
else:
|
|
181
|
+
formatted_lines.append(line)
|
|
182
|
+
|
|
183
|
+
# Join the formatted lines back into a single string
|
|
184
|
+
final_response = '\n'.join(formatted_lines)
|
|
185
|
+
|
|
186
|
+
# self.last_response.update(dict(text=streaming_response))
|
|
187
|
+
self.conversation.update_chat_history(
|
|
188
|
+
prompt, final_response
|
|
189
|
+
)
|
|
190
|
+
return dict(text=final_response)
|
|
191
|
+
|
|
192
|
+
return for_stream() if stream else for_non_stream()
|
|
193
|
+
|
|
194
|
+
def chat(
|
|
195
|
+
self,
|
|
196
|
+
prompt: str,
|
|
197
|
+
stream: bool = False,
|
|
198
|
+
optimizer: str = None,
|
|
199
|
+
conversationally: bool = False,
|
|
200
|
+
) -> str:
|
|
201
|
+
"""Generate response `str`
|
|
202
|
+
Args:
|
|
203
|
+
prompt (str): Prompt to be send.
|
|
204
|
+
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
205
|
+
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
206
|
+
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
207
|
+
Returns:
|
|
208
|
+
str: Response generated
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
def for_stream():
|
|
212
|
+
for response in self.ask(
|
|
213
|
+
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
214
|
+
):
|
|
215
|
+
yield self.get_message(response)
|
|
216
|
+
|
|
217
|
+
def for_non_stream():
|
|
218
|
+
return self.get_message(
|
|
219
|
+
self.ask(
|
|
220
|
+
prompt,
|
|
221
|
+
False,
|
|
222
|
+
optimizer=optimizer,
|
|
223
|
+
conversationally=conversationally,
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
return for_stream() if stream else for_non_stream()
|
|
228
|
+
|
|
229
|
+
def get_message(self, response: dict) -> str:
|
|
230
|
+
"""Retrieves message only from response
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
response (dict): Response generated by `self.ask`
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
str: Message extracted
|
|
237
|
+
"""
|
|
238
|
+
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
239
|
+
return response["text"]
|
webscout/__init__.py
CHANGED
webscout/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "4.
|
|
1
|
+
__version__ = "4.6"
|
|
2
2
|
__prog__ = "webscout"
|
webscout/webai.py
CHANGED
|
@@ -65,7 +65,7 @@ class this:
|
|
|
65
65
|
|
|
66
66
|
rich_code_themes = ["monokai", "paraiso-dark", "igor", "vs", "fruity", "xcode"]
|
|
67
67
|
|
|
68
|
-
default_provider = "
|
|
68
|
+
default_provider = "llama3"
|
|
69
69
|
|
|
70
70
|
getExc = lambda e: e.args[1] if len(e.args) > 1 else str(e)
|
|
71
71
|
|
|
@@ -518,6 +518,20 @@ class Main(cmd.Cmd):
|
|
|
518
518
|
history_offset=history_offset,
|
|
519
519
|
act=awesome_prompt,
|
|
520
520
|
)
|
|
521
|
+
elif provider == "llama3":
|
|
522
|
+
from webscout import LLAMA3
|
|
523
|
+
self.bot = LLAMA3(
|
|
524
|
+
is_conversation=disable_conversation,
|
|
525
|
+
max_tokens=max_tokens,
|
|
526
|
+
timeout=timeout,
|
|
527
|
+
intro=intro,
|
|
528
|
+
filepath=filepath,
|
|
529
|
+
update_file=update_file,
|
|
530
|
+
proxies=proxies,
|
|
531
|
+
history_offset=history_offset,
|
|
532
|
+
act=awesome_prompt,
|
|
533
|
+
model=getOr(model, "llama3-8b"),
|
|
534
|
+
)
|
|
521
535
|
elif provider == "berlin4h":
|
|
522
536
|
from webscout import Berlin4h
|
|
523
537
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: webscout
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.6
|
|
4
4
|
Summary: Search for anything using Google, DuckDuckGo, brave, qwant, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs and more
|
|
5
5
|
Author: OEvortex
|
|
6
6
|
Author-email: helpingai5@gmail.com
|
|
@@ -61,6 +61,7 @@ Requires-Dist: PyExecJS
|
|
|
61
61
|
Requires-Dist: ollama
|
|
62
62
|
Requires-Dist: pyfiglet
|
|
63
63
|
Requires-Dist: yaspin
|
|
64
|
+
Requires-Dist: pillow
|
|
64
65
|
Provides-Extra: dev
|
|
65
66
|
Requires-Dist: ruff >=0.1.6 ; extra == 'dev'
|
|
66
67
|
Requires-Dist: pytest >=7.4.2 ; extra == 'dev'
|
|
@@ -1368,7 +1369,7 @@ from rich import print
|
|
|
1368
1369
|
|
|
1369
1370
|
ai = DeepSeek(
|
|
1370
1371
|
is_conversation=True,
|
|
1371
|
-
api_key='',
|
|
1372
|
+
api_key='23bfff080d38429c9fbbf3c76f88454c',
|
|
1372
1373
|
max_tokens=800,
|
|
1373
1374
|
timeout=30,
|
|
1374
1375
|
intro=None,
|
|
@@ -1380,18 +1381,12 @@ ai = DeepSeek(
|
|
|
1380
1381
|
model="deepseek_chat"
|
|
1381
1382
|
)
|
|
1382
1383
|
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
if prompt.lower() == "exit":
|
|
1390
|
-
break
|
|
1391
|
-
|
|
1392
|
-
# Use the 'chat' method to send the prompt and receive a response
|
|
1393
|
-
r = ai.chat(prompt)
|
|
1394
|
-
print(r)
|
|
1384
|
+
|
|
1385
|
+
# Define a prompt to send to the AI
|
|
1386
|
+
prompt = "Tell me about india"
|
|
1387
|
+
# Use the 'chat' method to send the prompt and receive a response
|
|
1388
|
+
r = ai.chat(prompt)
|
|
1389
|
+
print(r)
|
|
1395
1390
|
```
|
|
1396
1391
|
### 18. `Deepinfra`
|
|
1397
1392
|
```python
|
|
@@ -1492,6 +1487,9 @@ from webscout import AndiSearch
|
|
|
1492
1487
|
a = AndiSearch()
|
|
1493
1488
|
print(a.chat("HelpingAI-9B"))
|
|
1494
1489
|
```
|
|
1490
|
+
|
|
1491
|
+
### 25. LLAMA3, pizzagpt, RUBIKSAI, Koala, Darkai
|
|
1492
|
+
code similar to other providers
|
|
1495
1493
|
### `LLM`
|
|
1496
1494
|
```python
|
|
1497
1495
|
from webscout.LLM import LLM
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
webscout/AIauto.py,sha256=gC01wLPpnqONf9DwKqkmbC_gIWo5Lh5V8YPu4OmYnhE,19923
|
|
2
2
|
webscout/AIbase.py,sha256=GoHbN8r0gq2saYRZv6LA-Fr9Jlcjv80STKFXUq2ZeGU,4710
|
|
3
|
-
webscout/AIutel.py,sha256=
|
|
3
|
+
webscout/AIutel.py,sha256=e1RbQHMMPL_sB_P_lNk8DKWDNiTGteMiCK-_uUKagbw,34248
|
|
4
4
|
webscout/DWEBS.py,sha256=QLuT1IKu0lnwdl7W6c-ctBAO7Jj0Zk3PYm6-13BC7rU,25740
|
|
5
5
|
webscout/GoogleS.py,sha256=dW_iArNTyFT5MWBEI1HQvqf-Noj3uJeJA_Eods8D4ms,11587
|
|
6
6
|
webscout/LLM.py,sha256=LbGCZdJf8A5dwfoGS4tyy39tAh5BDdhMZP0ScKaaQfU,4184
|
|
7
7
|
webscout/YTdownloader.py,sha256=uWpUWnw9pxeEGw9KJ_3XDyQ5gd38gH1dJpr-HJo4vzU,39144
|
|
8
|
-
webscout/__init__.py,sha256=
|
|
8
|
+
webscout/__init__.py,sha256=NK2atRuAg26zcT1g5bkwOwPDZyBbTud1mjbrDexjvhI,2282
|
|
9
9
|
webscout/__main__.py,sha256=ZtTRgsRjUi2JOvYFLF1ZCh55Sdoz94I-BS-TlJC7WDU,126
|
|
10
10
|
webscout/async_providers.py,sha256=MRj0klEhBYVQXnzZGG_15d0e-TPA0nOc2nn735H-wR4,622
|
|
11
11
|
webscout/cli.py,sha256=RlBKeS9CSIsiBMqlzxevWtKjbY9htkZvA7J0bM_hHE8,14999
|
|
@@ -15,9 +15,9 @@ webscout/models.py,sha256=5iQIdtedT18YuTZ3npoG7kLMwcrKwhQ7928dl_7qZW0,692
|
|
|
15
15
|
webscout/tempid.py,sha256=5oc3UbXhPGKxrMRTfRABT-V-dNzH_hOKWtLYM6iCWd4,5896
|
|
16
16
|
webscout/transcriber.py,sha256=EddvTSq7dPJ42V3pQVnGuEiYQ7WjJ9uyeR9kMSxN7uY,20622
|
|
17
17
|
webscout/utils.py,sha256=2O8_lftBKsv5OEvVaXCN-h0sipup0m3jxzhFdWQrdY8,2873
|
|
18
|
-
webscout/version.py,sha256=
|
|
18
|
+
webscout/version.py,sha256=KMQp1OFSXS2c5ktgRbsGATEX6rfWibjyO1pA1IvlI2g,44
|
|
19
19
|
webscout/voice.py,sha256=AHyeb3D8rYuAa-zBJsuMDgHq_Zvi98ROMKAUnEsKldo,1169
|
|
20
|
-
webscout/webai.py,sha256=
|
|
20
|
+
webscout/webai.py,sha256=MyKfQ7QftSQGX8iBlQrcNZcn23bf8wSdwCIZnY6LpTI,90162
|
|
21
21
|
webscout/webscout_search.py,sha256=evbJPy8vG2YgBuUwyHaOkinIdVlgM-esvjVOvy6N8jY,43729
|
|
22
22
|
webscout/webscout_search_async.py,sha256=dooKGwLm0cwTml55Vy6NHPPY-nymEqX2h8laX94Zg5A,14537
|
|
23
23
|
webscout/websx_search.py,sha256=5hfkkmGFhyQzojUpvMzIOJ3DBZIBNS90UReaacsfu6s,521
|
|
@@ -26,7 +26,7 @@ webscout/Agents/__init__.py,sha256=VbGyW5pulh3LRqbVTv54n5TwWsrTqOANRioG18xtdJ0,5
|
|
|
26
26
|
webscout/Agents/functioncall.py,sha256=5Nfmh8gmFOs7ZV7jJgZElZlJhi7hHrhxbITgLT7UpeI,5242
|
|
27
27
|
webscout/Extra/__init__.py,sha256=GG1qUwS-HspT4TeeAIT4qFpM8PaO1ZdQhpelctaM7Rs,99
|
|
28
28
|
webscout/Extra/autollama.py,sha256=8lyodIWAgJABzlMMHytlolPCgvUKh8ynkZD6MMEltXs,5970
|
|
29
|
-
webscout/Extra/gguf.py,sha256=
|
|
29
|
+
webscout/Extra/gguf.py,sha256=RvSp7xuaD6epAA9iAzthUnAQ3HA5N-svMyKUadAVnw8,7009
|
|
30
30
|
webscout/Extra/weather.py,sha256=wdSrQxZRpbNfyaux0BeLdaDWyde5KwxZjSUM13820X0,2460
|
|
31
31
|
webscout/Extra/weather_ascii.py,sha256=Aed-_EUzvTEjBXbOpNRxkJBLa6fXsclknXP06HnQD18,808
|
|
32
32
|
webscout/Local/__init__.py,sha256=RN6klpbabPGNX2YzPm_hdeUcQvieUwvJt22uAO2RKSM,238
|
|
@@ -38,13 +38,14 @@ webscout/Local/samplers.py,sha256=qXwU4eLXER-2aCYzcJcTgA6BeFmi5GMpTDUX1C9pTN4,43
|
|
|
38
38
|
webscout/Local/thread.py,sha256=Lyf_N2CaGAn2usSWSiUXLPAgpWub8vUu_tgFgtnvZVA,27408
|
|
39
39
|
webscout/Local/utils.py,sha256=CSt9IqHhVGk_nJEnKvSFbLhC5nNf01e0MtwpgMmF9pA,6197
|
|
40
40
|
webscout/Provider/Andi.py,sha256=y7Y9sC83NeMvK3MheROFoMttrFs9nGwjYaLNLPZMGCQ,10485
|
|
41
|
-
webscout/Provider/BasedGPT.py,sha256=
|
|
41
|
+
webscout/Provider/BasedGPT.py,sha256=c03PWIsDbG98XD7EOKYmuxaaevOAcYmkRFSB2fYj4MU,8683
|
|
42
42
|
webscout/Provider/Berlin4h.py,sha256=zMpmWmdFCbcE3UWB-F9xbbTWZTfx4GnjnRf6sDoaiC0,8552
|
|
43
|
-
webscout/Provider/Blackboxai.py,sha256=
|
|
43
|
+
webscout/Provider/Blackboxai.py,sha256=ywq3PFDmogYzyNm12cdXyndaC3mL80mU-17zeB-y1vE,17154
|
|
44
44
|
webscout/Provider/ChatGPTUK.py,sha256=qmuCb_a71GNE5LelOb5AKJUBndvj7soebiNey4VdDvE,8570
|
|
45
45
|
webscout/Provider/Cohere.py,sha256=IXnRosYOaMAA65nvsKmN6ZkJGSdZFYQYBidzuNaCqX8,8711
|
|
46
|
+
webscout/Provider/DARKAI.py,sha256=dbTX6dpS_13bX7AfOMUyDdhLNQJIpB7mTs_28hDuPXE,8538
|
|
46
47
|
webscout/Provider/Deepinfra.py,sha256=kVnWARJdEtIeIsZwGw3POq8B2dO87bDcJso3uOeCeOA,18750
|
|
47
|
-
webscout/Provider/Deepseek.py,sha256=
|
|
48
|
+
webscout/Provider/Deepseek.py,sha256=IYJHZsM3ezhwzn4Wg1Ms-ZDyMH71Frtnfi3XZxGQpuw,8691
|
|
48
49
|
webscout/Provider/FreeGemini.py,sha256=GbTJEG09vs5IKWKy9FqHBvDNKVq-HdMexOplctpb0RI,6426
|
|
49
50
|
webscout/Provider/Gemini.py,sha256=_4DHWvlWuNAmVHPwHB1RjmryjTZZCthLa6lvPEHLvkQ,8451
|
|
50
51
|
webscout/Provider/Geminiflash.py,sha256=1kMPA-ypi1gmJoms606Z7j_51znpdofM2aAyo4Hl7wU,5951
|
|
@@ -53,22 +54,26 @@ webscout/Provider/Groq.py,sha256=QfgP3hKUcqq5vUA4Pzuu3HAgpJkKwLWNjjsnxtkCYd8,210
|
|
|
53
54
|
webscout/Provider/Koboldai.py,sha256=KwWx2yPlvT9BGx37iNvSbgzWkJ9I8kSOmeg7sL1hb0M,15806
|
|
54
55
|
webscout/Provider/Leo.py,sha256=wbuDR-vFjLptfRC6yDlk74tINqNvCOzpISsK92lIgGg,19987
|
|
55
56
|
webscout/Provider/Llama.py,sha256=F_srqtdo6ws03tnEaetZOfDolXrQEnLZaIxmQaY_tJQ,8052
|
|
57
|
+
webscout/Provider/Llama3.py,sha256=HIDLC2uYHOF-8D0XjOJZ-VJdBPLTdpyO-hlbXCZU05o,7199
|
|
56
58
|
webscout/Provider/OLLAMA.py,sha256=G8sz_P7OZINFI1qGnpDhNPWU789Sv2cpDnShOA5Nbmw,7075
|
|
57
59
|
webscout/Provider/OpenGPT.py,sha256=ZymwLgNJSPlGZHW3msMlnRR7NxmALqJw9yuToqrRrhw,35515
|
|
58
60
|
webscout/Provider/Openai.py,sha256=SjfVOwY94unVnXhvN0Fkome-q2-wi4mPJk_vCGq5Fjc,20617
|
|
59
61
|
webscout/Provider/Perplexity.py,sha256=CPdKqkdlVejXDcf1uycNO4LPCVNUADSCetvyJEGepSw,8826
|
|
60
62
|
webscout/Provider/Phind.py,sha256=bkgKVtggRJSbJAG1tXviW9BqDvcgqPBlSr88Q6rlFHw,39226
|
|
63
|
+
webscout/Provider/PizzaGPT.py,sha256=bxCf91sgu9iZAaBzyfaVVHWqz-nt6FfKhQUqCZdfv1g,7065
|
|
61
64
|
webscout/Provider/Poe.py,sha256=ObUxa-Fa2Dq7sJcV0hc65m09StS9uWsB2-bR2rSjXDY,7510
|
|
65
|
+
webscout/Provider/RUBIKSAI.py,sha256=HPY8klGBNVVkfAXb-RziNrEtJGItjiqbSyXKXTOIHW4,7954
|
|
62
66
|
webscout/Provider/Reka.py,sha256=F0ZXENkhARprj5biK3mRxwiuPH0BW3ga7EWsi8agbtE,8917
|
|
63
67
|
webscout/Provider/ThinkAnyAI.py,sha256=_qFjj0djxxrranyEY33w14oizyRjzlVwMv_hzvVtwNc,11616
|
|
64
68
|
webscout/Provider/VTLchat.py,sha256=_sErGr-wOi16ZAfiGOo0bPsAEMkjzzwreEsIqjIZMIU,10041
|
|
65
69
|
webscout/Provider/Xjai.py,sha256=BIlk2ouz9Kh_0Gg9hPvTqhI7XtcmWdg5vHSX_4uGrIs,9039
|
|
66
70
|
webscout/Provider/Yepchat.py,sha256=2Eit-A7w1ph1GQKNQuur_yaDzI64r0yBGxCIjDefJxQ,19875
|
|
67
71
|
webscout/Provider/Youchat.py,sha256=fhMpt94pIPE_XDbC4z9xyfgA7NbkNE2wlRFJabsjv90,8069
|
|
68
|
-
webscout/Provider/__init__.py,sha256=
|
|
69
|
-
webscout
|
|
70
|
-
webscout-4.
|
|
71
|
-
webscout-4.
|
|
72
|
-
webscout-4.
|
|
73
|
-
webscout-4.
|
|
74
|
-
webscout-4.
|
|
72
|
+
webscout/Provider/__init__.py,sha256=MBOhedREt8-ic3CrNoq952u5ytMl6-Wa_MgtnQwx1QM,2204
|
|
73
|
+
webscout/Provider/koala.py,sha256=uBYJU_3YmC1qyCugDOrMSLoUR8my76zt_WqIUiGgf2Q,9840
|
|
74
|
+
webscout-4.6.dist-info/LICENSE.md,sha256=9P0imsudI7MEvZe2pOcg8rKBn6E5FGHQ-riYozZI-Bk,2942
|
|
75
|
+
webscout-4.6.dist-info/METADATA,sha256=lBjTpCHhckbEcAKYzIkW5ng5R8kgrpEIgJNM3uM42KE,57059
|
|
76
|
+
webscout-4.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
77
|
+
webscout-4.6.dist-info/entry_points.txt,sha256=Hh4YIIjvkqB9SVxZ2ri4DZUkgEu_WF_5_r_nZDIvfG8,73
|
|
78
|
+
webscout-4.6.dist-info/top_level.txt,sha256=nYIw7OKBQDr_Z33IzZUKidRD3zQEo8jOJYkMVMeN334,9
|
|
79
|
+
webscout-4.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|