webscout 6.0__py3-none-any.whl → 6.2__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/AIauto.py +77 -259
- webscout/Agents/Onlinesearcher.py +22 -10
- webscout/Agents/functioncall.py +2 -2
- webscout/Bard.py +21 -21
- webscout/Extra/autollama.py +37 -20
- webscout/Local/__init__.py +6 -7
- webscout/Local/formats.py +406 -194
- webscout/Local/model.py +1074 -477
- webscout/Local/samplers.py +108 -144
- webscout/Local/thread.py +251 -410
- webscout/Local/ui.py +401 -0
- webscout/Local/utils.py +338 -136
- webscout/Provider/Amigo.py +51 -38
- webscout/Provider/Deepseek.py +7 -6
- webscout/Provider/EDITEE.py +2 -2
- webscout/Provider/GPTWeb.py +1 -1
- webscout/Provider/Llama3.py +1 -1
- webscout/Provider/NinjaChat.py +200 -0
- webscout/Provider/OLLAMA.py +1 -1
- webscout/Provider/Perplexity.py +1 -1
- webscout/Provider/Reka.py +12 -5
- webscout/Provider/TTI/AIuncensored.py +103 -0
- webscout/Provider/TTI/Nexra.py +3 -3
- webscout/Provider/TTI/__init__.py +4 -2
- webscout/Provider/TTI/aiforce.py +2 -2
- webscout/Provider/TTI/imgninza.py +136 -0
- webscout/Provider/TTI/talkai.py +116 -0
- webscout/Provider/TeachAnything.py +0 -3
- webscout/Provider/Youchat.py +1 -1
- webscout/Provider/__init__.py +16 -12
- webscout/Provider/{ChatHub.py → aimathgpt.py} +72 -88
- webscout/Provider/cerebras.py +143 -123
- webscout/Provider/cleeai.py +1 -1
- webscout/Provider/felo_search.py +1 -1
- webscout/Provider/gaurish.py +207 -0
- webscout/Provider/geminiprorealtime.py +160 -0
- webscout/Provider/genspark.py +1 -1
- webscout/Provider/julius.py +8 -3
- webscout/Provider/learnfastai.py +1 -1
- webscout/Provider/{aigames.py → llmchat.py} +74 -84
- webscout/Provider/promptrefine.py +3 -1
- webscout/Provider/talkai.py +196 -0
- webscout/Provider/turboseek.py +3 -8
- webscout/Provider/tutorai.py +1 -1
- webscout/__init__.py +2 -43
- webscout/exceptions.py +5 -1
- webscout/tempid.py +4 -73
- webscout/utils.py +3 -0
- webscout/version.py +1 -1
- webscout/webai.py +1 -1
- webscout/webscout_search.py +154 -123
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/METADATA +164 -245
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/RECORD +57 -55
- webscout/Local/rawdog.py +0 -946
- webscout/Provider/BasedGPT.py +0 -214
- webscout/Provider/TTI/amigo.py +0 -148
- webscout/Provider/bixin.py +0 -264
- webscout/Provider/xdash.py +0 -182
- webscout/websx_search.py +0 -19
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/LICENSE.md +0 -0
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/WHEEL +0 -0
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/entry_points.txt +0 -0
- {webscout-6.0.dist-info → webscout-6.2.dist-info}/top_level.txt +0 -0
webscout/Provider/xdash.py
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import uuid
|
|
2
|
-
import requests
|
|
3
|
-
from webscout.AIutel import Optimizers
|
|
4
|
-
from webscout.AIutel import Conversation
|
|
5
|
-
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
6
|
-
from webscout.AIbase import Provider, AsyncProvider
|
|
7
|
-
from webscout import exceptions
|
|
8
|
-
from typing import Any, AsyncGenerator, Dict
|
|
9
|
-
|
|
10
|
-
class XDASH(Provider):
|
|
11
|
-
def __init__(
|
|
12
|
-
self,
|
|
13
|
-
is_conversation: bool = True,
|
|
14
|
-
max_tokens: int = 600,
|
|
15
|
-
timeout: int = 30,
|
|
16
|
-
intro: str = None,
|
|
17
|
-
filepath: str = None,
|
|
18
|
-
update_file: bool = True,
|
|
19
|
-
proxies: dict = {},
|
|
20
|
-
history_offset: int = 10250,
|
|
21
|
-
act: str = None,
|
|
22
|
-
):
|
|
23
|
-
"""Instantiates XDASH
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
27
|
-
max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
|
|
28
|
-
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
29
|
-
intro (str, optional): Conversation introductory prompt. Defaults to None.
|
|
30
|
-
filepath (str, optional): Path to file containing conversation history. Defaults to None.
|
|
31
|
-
update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
|
|
32
|
-
proxies (dict, optional): Http request proxies. Defaults to {}.
|
|
33
|
-
history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
|
|
34
|
-
act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
|
|
35
|
-
"""
|
|
36
|
-
self.session = requests.Session()
|
|
37
|
-
self.is_conversation = is_conversation
|
|
38
|
-
self.max_tokens_to_sample = max_tokens
|
|
39
|
-
self.chat_endpoint = "https://www.xdash.ai/api/query"
|
|
40
|
-
self.stream_chunk_size = 64
|
|
41
|
-
self.timeout = timeout
|
|
42
|
-
self.last_response = {}
|
|
43
|
-
self.headers = {
|
|
44
|
-
"accept": "*/*",
|
|
45
|
-
"accept-encoding": "gzip, deflate, br, zstd",
|
|
46
|
-
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
47
|
-
"content-type": "application/json",
|
|
48
|
-
"cookie": "cf_clearance=73aup_8JU0LU.tRr7D4qd4Kt7gapKFi3RVW8jLzQoP0-1723549451-1.0.1.1-HTRrjMvM5GRLsfCTB0v3N_UxQzQMfA1fvOSf0dsZJ73HR6.IUTH8BH.G1dpx3s_IxVHCBCHMXOCt0K7vyIwMgw",
|
|
49
|
-
"dnt": "1",
|
|
50
|
-
"origin": "https://www.xdash.ai",
|
|
51
|
-
"priority": "u=1, i",
|
|
52
|
-
"referer": "https://www.xdash.ai/search",
|
|
53
|
-
"sec-ch-ua": '"Not)A;Brand";v="99", "Microsoft Edge";v="127", "Chromium";v="127"',
|
|
54
|
-
"sec-ch-ua-mobile": "?0",
|
|
55
|
-
"sec-ch-ua-platform": '"Windows"',
|
|
56
|
-
"sec-fetch-dest": "empty",
|
|
57
|
-
"sec-fetch-mode": "cors",
|
|
58
|
-
"sec-fetch-site": "same-origin",
|
|
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:
|
|
89
|
-
"""Chat with AI
|
|
90
|
-
|
|
91
|
-
Args:
|
|
92
|
-
prompt (str): Prompt to be send.
|
|
93
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
94
|
-
raw (bool, optional): Stream back raw response as received. Defaults to False.
|
|
95
|
-
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
96
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
97
|
-
Returns:
|
|
98
|
-
dict : {}
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"text" : "How may I assist you today?"
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
"""
|
|
105
|
-
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
106
|
-
if optimizer:
|
|
107
|
-
if optimizer in self.__available_optimizers:
|
|
108
|
-
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
109
|
-
conversation_prompt if conversationally else prompt
|
|
110
|
-
)
|
|
111
|
-
else:
|
|
112
|
-
raise Exception(
|
|
113
|
-
f"Optimizer is not one of {self.__available_optimizers}"
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
self.session.headers.update(self.headers)
|
|
117
|
-
payload = {
|
|
118
|
-
"query": conversation_prompt,
|
|
119
|
-
"search_uuid": uuid.uuid4().hex,
|
|
120
|
-
"visitor_uuid": uuid.uuid4().hex,
|
|
121
|
-
"token": uuid.uuid4().hex
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
response = self.session.post(
|
|
125
|
-
self.chat_endpoint, json=payload, timeout=self.timeout
|
|
126
|
-
)
|
|
127
|
-
if not response.ok:
|
|
128
|
-
raise exceptions.FailedToGenerateResponseError(
|
|
129
|
-
f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
# Extract the LLM response
|
|
133
|
-
llm_response = response.text.split("__LLM_RESPONSE__")[1].split("__RELATED_QUESTIONS__")[0].strip()
|
|
134
|
-
resp = dict(text=llm_response)
|
|
135
|
-
self.last_response.update(resp)
|
|
136
|
-
self.conversation.update_chat_history(
|
|
137
|
-
prompt, self.get_message(self.last_response)
|
|
138
|
-
)
|
|
139
|
-
return self.last_response
|
|
140
|
-
|
|
141
|
-
def chat(
|
|
142
|
-
self,
|
|
143
|
-
prompt: str,
|
|
144
|
-
stream: bool = False,
|
|
145
|
-
optimizer: str = None,
|
|
146
|
-
conversationally: bool = False,
|
|
147
|
-
) -> str:
|
|
148
|
-
"""Generate response `str`
|
|
149
|
-
Args:
|
|
150
|
-
prompt (str): Prompt to be send.
|
|
151
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
152
|
-
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
153
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
154
|
-
Returns:
|
|
155
|
-
str: Response generated
|
|
156
|
-
"""
|
|
157
|
-
|
|
158
|
-
return self.get_message(
|
|
159
|
-
self.ask(
|
|
160
|
-
prompt,
|
|
161
|
-
optimizer=optimizer,
|
|
162
|
-
conversationally=conversationally,
|
|
163
|
-
)
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
def get_message(self, response: dict) -> str:
|
|
167
|
-
"""Retrieves message only from response
|
|
168
|
-
|
|
169
|
-
Args:
|
|
170
|
-
response (dict): Response generated by `self.ask`
|
|
171
|
-
|
|
172
|
-
Returns:
|
|
173
|
-
str: Message extracted
|
|
174
|
-
"""
|
|
175
|
-
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
176
|
-
return response["text"]
|
|
177
|
-
if __name__ == '__main__':
|
|
178
|
-
from rich import print
|
|
179
|
-
ai = XDASH()
|
|
180
|
-
response = ai.chat("hi")
|
|
181
|
-
for chunk in response:
|
|
182
|
-
print(chunk, end="", flush=True)
|
webscout/websx_search.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
from rich import print
|
|
3
|
-
|
|
4
|
-
def WEBSX(query):
|
|
5
|
-
url = 'https://searx.bnngpt.com/api/v1/scrape/'
|
|
6
|
-
data = {'query': query}
|
|
7
|
-
response = requests.post(url, data=data)
|
|
8
|
-
responses = response.json().get('responses')
|
|
9
|
-
return responses
|
|
10
|
-
|
|
11
|
-
if __name__ == "__main__":
|
|
12
|
-
# Example search query
|
|
13
|
-
search_query = "Python development tools"
|
|
14
|
-
|
|
15
|
-
# Call the WEBSX function with the search query
|
|
16
|
-
result = WEBSX(search_query)
|
|
17
|
-
|
|
18
|
-
# Pretty-print the JSON response
|
|
19
|
-
print(result)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|