webscout 5.3__py3-none-any.whl → 5.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/AIauto.py +8 -12
- webscout/Agents/Onlinesearcher.py +5 -5
- webscout/Agents/functioncall.py +123 -97
- webscout/Local/_version.py +2 -2
- webscout/Provider/Andi.py +1 -21
- webscout/Provider/BasedGPT.py +1 -21
- webscout/Provider/Blackboxai.py +1 -21
- webscout/Provider/Chatify.py +3 -2
- webscout/Provider/Cloudflare.py +1 -22
- webscout/Provider/Cohere.py +2 -23
- webscout/Provider/DARKAI.py +0 -1
- webscout/Provider/Deepinfra.py +2 -16
- webscout/Provider/EDITEE.py +3 -26
- webscout/Provider/Gemini.py +1 -24
- webscout/Provider/Groq.py +0 -2
- webscout/Provider/Koboldai.py +0 -21
- webscout/Provider/Llama.py +4 -21
- webscout/Provider/OLLAMA.py +0 -17
- webscout/Provider/Openai.py +2 -22
- webscout/Provider/Perplexity.py +1 -2
- webscout/Provider/Phind.py +3 -508
- webscout/Provider/Reka.py +4 -22
- webscout/Provider/TTI/__init__.py +2 -1
- webscout/Provider/TTI/aiforce.py +137 -0
- webscout/Provider/TTS/streamElements.py +0 -17
- webscout/Provider/TTS/voicepod.py +0 -1
- webscout/Provider/ThinkAnyAI.py +17 -78
- webscout/Provider/Youchat.py +3 -20
- webscout/Provider/__init__.py +12 -5
- webscout/Provider/cleeai.py +212 -0
- webscout/Provider/elmo.py +237 -0
- webscout/Provider/felo_search.py +4 -22
- webscout/Provider/geminiapi.py +198 -0
- webscout/Provider/genspark.py +222 -0
- webscout/Provider/julius.py +3 -20
- webscout/Provider/koala.py +1 -1
- webscout/Provider/lepton.py +194 -0
- webscout/Provider/turboseek.py +4 -21
- webscout/Provider/x0gpt.py +3 -2
- webscout/Provider/xdash.py +2 -22
- webscout/Provider/yep.py +391 -149
- webscout/YTdownloader.py +2 -3
- webscout/tempid.py +46 -2
- webscout/version.py +1 -1
- webscout/webscout_search_async.py +9 -9
- {webscout-5.3.dist-info → webscout-5.5.dist-info}/METADATA +39 -64
- webscout-5.5.dist-info/RECORD +99 -0
- webscout-5.3.dist-info/RECORD +0 -93
- {webscout-5.3.dist-info → webscout-5.5.dist-info}/LICENSE.md +0 -0
- {webscout-5.3.dist-info → webscout-5.5.dist-info}/WHEEL +0 -0
- {webscout-5.3.dist-info → webscout-5.5.dist-info}/entry_points.txt +0 -0
- {webscout-5.3.dist-info → webscout-5.5.dist-info}/top_level.txt +0 -0
webscout/AIauto.py
CHANGED
|
@@ -9,11 +9,8 @@ from webscout.Provider.Perplexity import Perplexity
|
|
|
9
9
|
from webscout.Provider.Blackboxai import BLACKBOXAI
|
|
10
10
|
from webscout.Provider.Blackboxai import AsyncBLACKBOXAI
|
|
11
11
|
from webscout.Provider.Phind import PhindSearch
|
|
12
|
-
from webscout.Provider.Phind import AsyncPhindSearch
|
|
13
12
|
from webscout.Provider.Phind import Phindv2
|
|
14
|
-
from webscout.Provider.Phind import AsyncPhindv2
|
|
15
13
|
from webscout.Provider.yep import YEPCHAT
|
|
16
|
-
from webscout.Provider.Berlin4h import Berlin4h
|
|
17
14
|
from webscout.Provider.Poe import POE
|
|
18
15
|
from webscout.Provider.BasedGPT import BasedGPT
|
|
19
16
|
from webscout.Provider.Deepseek import DeepSeek
|
|
@@ -25,7 +22,7 @@ from webscout.Provider.DARKAI import DARKAI
|
|
|
25
22
|
from webscout.Provider.koala import KOALA
|
|
26
23
|
from webscout.Provider.RUBIKSAI import RUBIKSAI
|
|
27
24
|
from webscout.Provider.meta import Meta
|
|
28
|
-
|
|
25
|
+
|
|
29
26
|
from webscout.Provider.DiscordRocks import DiscordRocks
|
|
30
27
|
from webscout.Provider.felo_search import Felo
|
|
31
28
|
from webscout.Provider.xdash import XDASH
|
|
@@ -35,7 +32,7 @@ from webscout.Provider.Cloudflare import Cloudflare
|
|
|
35
32
|
from webscout.Provider.turboseek import TurboSeek
|
|
36
33
|
from webscout.Provider.NetFly import NetFly
|
|
37
34
|
from webscout.Provider.EDITEE import Editee
|
|
38
|
-
|
|
35
|
+
from webscout.Provider.Chatify import Chatify
|
|
39
36
|
from webscout.Provider.PI import PiAI
|
|
40
37
|
from webscout.g4f import GPT4FREE, AsyncGPT4FREE
|
|
41
38
|
from webscout.g4f import TestProviders
|
|
@@ -58,7 +55,6 @@ provider_map: dict[
|
|
|
58
55
|
PhindSearch,
|
|
59
56
|
Phindv2,
|
|
60
57
|
YEPCHAT,
|
|
61
|
-
Berlin4h,
|
|
62
58
|
POE,
|
|
63
59
|
BasedGPT,
|
|
64
60
|
DeepSeek,
|
|
@@ -72,7 +68,7 @@ provider_map: dict[
|
|
|
72
68
|
KOALA,
|
|
73
69
|
RUBIKSAI,
|
|
74
70
|
Meta,
|
|
75
|
-
|
|
71
|
+
|
|
76
72
|
DiscordRocks,
|
|
77
73
|
Felo,
|
|
78
74
|
XDASH,
|
|
@@ -82,7 +78,7 @@ provider_map: dict[
|
|
|
82
78
|
TurboSeek,
|
|
83
79
|
NetFly,
|
|
84
80
|
Editee,
|
|
85
|
-
|
|
81
|
+
Chatify,
|
|
86
82
|
PiAI,
|
|
87
83
|
],
|
|
88
84
|
] = {
|
|
@@ -94,7 +90,7 @@ provider_map: dict[
|
|
|
94
90
|
"PhindSearch": PhindSearch,
|
|
95
91
|
"Phindv2": Phindv2,
|
|
96
92
|
"YEPCHAT": YEPCHAT,
|
|
97
|
-
|
|
93
|
+
|
|
98
94
|
"POE": POE,
|
|
99
95
|
"BasedGPT": BasedGPT,
|
|
100
96
|
"DeepSeek": DeepSeek,
|
|
@@ -108,7 +104,7 @@ provider_map: dict[
|
|
|
108
104
|
"koala": KOALA,
|
|
109
105
|
"rubiksai": RUBIKSAI,
|
|
110
106
|
"meta": Meta,
|
|
111
|
-
|
|
107
|
+
|
|
112
108
|
"discordrocks": DiscordRocks,
|
|
113
109
|
"felo": Felo,
|
|
114
110
|
"xdash": XDASH,
|
|
@@ -160,7 +156,7 @@ class AUTO(Provider):
|
|
|
160
156
|
PhindSearch,
|
|
161
157
|
Phindv2,
|
|
162
158
|
YEPCHAT,
|
|
163
|
-
|
|
159
|
+
|
|
164
160
|
POE,
|
|
165
161
|
BasedGPT,
|
|
166
162
|
DeepSeek,
|
|
@@ -174,7 +170,7 @@ class AUTO(Provider):
|
|
|
174
170
|
KOALA,
|
|
175
171
|
RUBIKSAI,
|
|
176
172
|
Meta,
|
|
177
|
-
|
|
173
|
+
|
|
178
174
|
DiscordRocks,
|
|
179
175
|
Felo,
|
|
180
176
|
XDASH,
|
|
@@ -10,7 +10,7 @@ import logging
|
|
|
10
10
|
class WebSearchAgent:
|
|
11
11
|
def __init__(self):
|
|
12
12
|
self.webs = WEBS()
|
|
13
|
-
self.ai = LLAMA3(system="You are an advanced AI assistant specialized in generating optimal search queries and providing comprehensive answers based on web search results.")
|
|
13
|
+
self.ai = LLAMA3(system="You are an advanced AI assistant specialized in generating optimal search queries and providing comprehensive answers based on web search results.", is_conversation=False)
|
|
14
14
|
|
|
15
15
|
def generate_search_queries(self, information, num_queries=3):
|
|
16
16
|
prompt = f"""
|
|
@@ -94,8 +94,8 @@ class WebSearchAgent:
|
|
|
94
94
|
paragraphs = soup.find_all('p')
|
|
95
95
|
text = ' '.join([p.get_text() for p in paragraphs])
|
|
96
96
|
words = text.split()
|
|
97
|
-
if len(words) >
|
|
98
|
-
text = ' '.join(words[:
|
|
97
|
+
if len(words) > 600:
|
|
98
|
+
text = ' '.join(words[:600]) + '...'
|
|
99
99
|
return text
|
|
100
100
|
else:
|
|
101
101
|
return f"Failed to fetch {url}: HTTP {response.status}"
|
|
@@ -112,7 +112,7 @@ class WebSearchAgent:
|
|
|
112
112
|
class OnlineSearcher:
|
|
113
113
|
def __init__(self):
|
|
114
114
|
self.agent = WebSearchAgent()
|
|
115
|
-
self.ai = LLAMA3(system="You are an advanced AI assistant specialized in providing comprehensive and accurate answers based on web search results and your general knowledge.")
|
|
115
|
+
self.ai = LLAMA3(system="You are an advanced AI assistant specialized in providing comprehensive and accurate answers based on web search results and your general knowledge.", is_conversation=False)
|
|
116
116
|
|
|
117
117
|
def answer_question(self, question: str):
|
|
118
118
|
search_results = self.agent.search(question)
|
|
@@ -125,7 +125,7 @@ class OnlineSearcher:
|
|
|
125
125
|
|
|
126
126
|
context += "Extracted webpage contents:\n"
|
|
127
127
|
for i, webpage in enumerate(webpage_contents):
|
|
128
|
-
context += f"{i}. URL: {webpage['url']}\n Content: {webpage['content'][:
|
|
128
|
+
context += f"{i}. URL: {webpage['url']}\n Content: {webpage['content'][:600]}...\n\n"
|
|
129
129
|
|
|
130
130
|
prompt = f"""
|
|
131
131
|
Task: Provide a comprehensive and accurate answer to the given question based on the provided web search results and your general knowledge.
|
webscout/Agents/functioncall.py
CHANGED
|
@@ -1,159 +1,170 @@
|
|
|
1
|
+
from datetime import date
|
|
1
2
|
import json
|
|
2
|
-
import logging
|
|
3
|
+
# import logging
|
|
3
4
|
import time
|
|
4
5
|
from typing import Any, Dict, Optional
|
|
5
|
-
|
|
6
6
|
import requests
|
|
7
|
-
from webscout import WEBS
|
|
8
|
-
|
|
9
|
-
class LLAMA3:
|
|
10
|
-
|
|
11
|
-
AVAILABLE_MODELS = ["llama3-70b", "llama3-8b", "llama3-405b"]
|
|
12
|
-
|
|
13
|
-
def __init__(
|
|
14
|
-
self,
|
|
15
|
-
is_conversation: bool = True,
|
|
16
|
-
max_tokens: int = 600,
|
|
17
|
-
timeout: int = 30,
|
|
18
|
-
model: str = "llama3-8b",
|
|
19
|
-
system: str = "GPT syle",
|
|
20
|
-
proxies: dict = {}, # Add proxies parameter
|
|
21
|
-
):
|
|
22
|
-
"""Instantiates Snova
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
26
|
-
max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
|
|
27
|
-
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
28
|
-
model (str, optional): Snova model name. Defaults to "llama3-70b".
|
|
29
|
-
system (str, optional): System prompt for Snova. Defaults to "Answer as concisely as possible.".
|
|
30
|
-
proxies (dict, optional): Proxy settings for requests. Defaults to an empty dictionary.
|
|
31
|
-
"""
|
|
32
|
-
if model not in self.AVAILABLE_MODELS:
|
|
33
|
-
raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS}")
|
|
34
|
-
|
|
35
|
-
self.session = requests.Session()
|
|
36
|
-
self.is_conversation = is_conversation
|
|
37
|
-
self.max_tokens_to_sample = max_tokens
|
|
38
|
-
self.timeout = timeout
|
|
39
|
-
self.model = model
|
|
40
|
-
self.system = system
|
|
41
|
-
self.last_response = {}
|
|
42
|
-
self.env_type = "tp16405b" if "405b" in model else "tp16"
|
|
43
|
-
self.headers = {'content-type': 'application/json'}
|
|
44
|
-
self.session.headers.update(self.headers)
|
|
45
|
-
self.session.proxies = proxies
|
|
46
|
-
|
|
47
|
-
def chat(self, prompt: str) -> str:
|
|
48
|
-
data = {'body': {'messages': [{'role': 'system', 'content': self.system}, {'role': 'user', 'content': prompt}], 'stream': True, 'model': self.model}, 'env_type': self.env_type}
|
|
49
|
-
response = self.session.post('https://fast.snova.ai/api/completion', headers=self.headers, json=data, stream=True, timeout=self.timeout)
|
|
50
|
-
output = ''
|
|
51
|
-
for line in response.iter_lines(decode_unicode=True):
|
|
52
|
-
if line.startswith('data:'):
|
|
53
|
-
try:
|
|
54
|
-
data = json.loads(line[len('data: '):])
|
|
55
|
-
output += data.get("choices", [{}])[0].get("delta", {}).get("content", '')
|
|
56
|
-
except json.JSONDecodeError:
|
|
57
|
-
if line[len('data: '):] == '[DONE]':
|
|
58
|
-
break
|
|
59
|
-
return output
|
|
7
|
+
from webscout import WEBS, Julius
|
|
60
8
|
|
|
61
9
|
class FunctionCallingAgent:
|
|
62
|
-
def __init__(self, model: str = "
|
|
63
|
-
system_prompt: str = 'You are a helpful assistant that will always answer what the user wants',
|
|
10
|
+
def __init__(self, model: str = "GPT-4o",
|
|
64
11
|
tools: list = None):
|
|
65
|
-
self.
|
|
12
|
+
self.ai = Julius(model=model, timeout=300, intro=None)
|
|
66
13
|
self.tools = tools if tools is not None else []
|
|
67
|
-
self.
|
|
14
|
+
self.knowledge_cutoff = "September 2022"
|
|
68
15
|
|
|
69
16
|
def function_call_handler(self, message_text: str) -> dict:
|
|
70
17
|
system_message = self._generate_system_message(message_text)
|
|
71
|
-
response = self.
|
|
18
|
+
response = self.ai.chat(system_message)
|
|
72
19
|
# logging.info(f"Raw response: {response}")
|
|
73
20
|
return self._parse_function_call(response)
|
|
74
21
|
|
|
75
22
|
def _generate_system_message(self, user_message: str) -> str:
|
|
76
|
-
tools_description =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
23
|
+
tools_description = ""
|
|
24
|
+
for tool in self.tools:
|
|
25
|
+
tools_description += f"- {tool['function']['name']}: {tool['function'].get('description', '')}\n"
|
|
26
|
+
tools_description += " Parameters:\n"
|
|
27
|
+
for key, value in tool['function']['parameters']['properties'].items():
|
|
28
|
+
tools_description += f" - {key}: {value.get('description', '')} ({value.get('type')})\n"
|
|
29
|
+
|
|
30
|
+
current_date = date.today().strftime("%B %d, %Y")
|
|
31
|
+
return f"""Today is {current_date}. Your knowledge is current up to {self.knowledge_cutoff}.
|
|
32
|
+
|
|
33
|
+
You are an advanced AI assistant tasked with analyzing user requests and determining the most appropriate action. You have access to the following tools:
|
|
34
|
+
|
|
35
|
+
{tools_description}
|
|
36
|
+
|
|
37
|
+
Instructions:
|
|
38
|
+
1. Carefully analyze the user's request.
|
|
39
|
+
2. If the user request is about controlling the web browser (opening websites, searching, playing videos, etc.), ALWAYS use the 'browser_control' tool.
|
|
40
|
+
3. If the user request is something else, determine if any of the other provided tools are necessary to fulfill the request.
|
|
41
|
+
4. If a tool is needed, select the MOST APPROPRIATE one. Do not use a tool if it's not directly relevant to the user's request.
|
|
42
|
+
5. If you decide to use a tool, respond ONLY with a JSON object in this format:
|
|
43
|
+
{{
|
|
44
|
+
"tool_name": "name_of_the_tool",
|
|
45
|
+
"tool_input": {{
|
|
46
|
+
"param1": "value1",
|
|
47
|
+
"param2": "value2"
|
|
48
|
+
}}
|
|
49
|
+
}}
|
|
50
|
+
|
|
51
|
+
- Use the exact tool name as listed above.
|
|
52
|
+
- Include only the necessary parameters for the chosen tool.
|
|
53
|
+
- Do not include any explanations or additional text outside the JSON object.
|
|
54
|
+
|
|
55
|
+
6. If no tool is needed and you can answer directly, respond with:
|
|
56
|
+
{{
|
|
57
|
+
"tool_name": "general_ai",
|
|
58
|
+
"tool_input": {{
|
|
59
|
+
"question": "user's original question"
|
|
60
|
+
}}
|
|
61
|
+
}}
|
|
62
|
+
|
|
63
|
+
User Request: {user_message}
|
|
64
|
+
|
|
65
|
+
Your Response (JSON only):"""
|
|
96
66
|
|
|
97
67
|
def _parse_function_call(self, response: str) -> dict:
|
|
98
68
|
try:
|
|
99
|
-
#
|
|
69
|
+
# Ensure to locate the start and end of the JSON structure
|
|
100
70
|
start_idx = response.find("{")
|
|
101
71
|
end_idx = response.rfind("}") + 1
|
|
102
72
|
|
|
103
73
|
if start_idx == -1 or end_idx == -1:
|
|
104
74
|
raise ValueError("No valid JSON structure found in the response.")
|
|
105
75
|
|
|
76
|
+
# Extract the JSON string
|
|
106
77
|
response_json_str = response[start_idx:end_idx]
|
|
107
|
-
|
|
108
|
-
#
|
|
109
|
-
|
|
78
|
+
|
|
79
|
+
# Load the JSON string
|
|
80
|
+
parsed_response = json.loads(response_json_str)
|
|
81
|
+
|
|
82
|
+
# Check for the expected format
|
|
83
|
+
if "tool_name" in parsed_response and "tool_input" in parsed_response:
|
|
84
|
+
return parsed_response
|
|
85
|
+
|
|
86
|
+
# If not in the expected format, try to convert
|
|
87
|
+
for key, value in parsed_response.items():
|
|
88
|
+
if isinstance(value, dict):
|
|
89
|
+
return {
|
|
90
|
+
"tool_name": key,
|
|
91
|
+
"tool_input": value
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
# If the response structure is still incorrect
|
|
95
|
+
raise ValueError("Invalid response structure: missing required fields.")
|
|
110
96
|
|
|
111
97
|
except (ValueError, json.JSONDecodeError) as e:
|
|
112
|
-
logging.error(f"Error parsing function call: {e}")
|
|
98
|
+
# logging.error(f"Error parsing function call: {e}")
|
|
113
99
|
return {"error": str(e)}
|
|
114
100
|
|
|
101
|
+
|
|
115
102
|
def execute_function(self, function_call_data: dict) -> str:
|
|
116
103
|
function_name = function_call_data.get("tool_name")
|
|
117
104
|
arguments = function_call_data.get("tool_input", {})
|
|
118
105
|
|
|
119
106
|
if not isinstance(arguments, dict):
|
|
120
|
-
logging.error("Invalid arguments format.")
|
|
107
|
+
# logging.error("Invalid arguments format.")
|
|
121
108
|
return "Invalid arguments format."
|
|
122
109
|
|
|
123
|
-
logging.info(f"Executing function: {function_name} with arguments: {arguments}")
|
|
110
|
+
# logging.info(f"Executing function: {function_name} with arguments: {arguments}")
|
|
124
111
|
|
|
125
112
|
|
|
126
113
|
# Example usage
|
|
127
114
|
if __name__ == "__main__":
|
|
115
|
+
# Configure logging
|
|
116
|
+
# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
117
|
+
|
|
128
118
|
tools = [
|
|
129
119
|
{
|
|
130
120
|
"type": "function",
|
|
131
121
|
"function": {
|
|
132
122
|
"name": "web_search",
|
|
133
|
-
"description": "Search
|
|
123
|
+
"description": "Search the web for current information on a given query",
|
|
134
124
|
"parameters": {
|
|
135
125
|
"type": "object",
|
|
136
126
|
"properties": {
|
|
137
127
|
"query": {
|
|
138
128
|
"type": "string",
|
|
139
|
-
"description": "
|
|
129
|
+
"description": "The search query to be executed"
|
|
140
130
|
}
|
|
141
131
|
},
|
|
142
132
|
"required": ["query"]
|
|
143
133
|
}
|
|
144
134
|
}
|
|
145
135
|
},
|
|
136
|
+
{
|
|
137
|
+
"type": "function",
|
|
138
|
+
"function": {
|
|
139
|
+
"name": "get_user_detail",
|
|
140
|
+
"description": "Get the user's name and age.",
|
|
141
|
+
"parameters": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"properties": {
|
|
144
|
+
"name": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"description": "The user's name."
|
|
147
|
+
},
|
|
148
|
+
"age": {
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"description": "The user's age."
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["name", "age"]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
146
157
|
{
|
|
147
158
|
"type": "function",
|
|
148
159
|
"function": {
|
|
149
160
|
"name": "general_ai",
|
|
150
|
-
"description": "Use AI to answer
|
|
161
|
+
"description": "Use AI to answer general questions or perform tasks not requiring external tools",
|
|
151
162
|
"parameters": {
|
|
152
163
|
"type": "object",
|
|
153
164
|
"properties": {
|
|
154
165
|
"question": {
|
|
155
166
|
"type": "string",
|
|
156
|
-
"description": "The question
|
|
167
|
+
"description": "The question or task for the AI to process"
|
|
157
168
|
}
|
|
158
169
|
},
|
|
159
170
|
"required": ["question"]
|
|
@@ -163,10 +174,25 @@ if __name__ == "__main__":
|
|
|
163
174
|
]
|
|
164
175
|
|
|
165
176
|
agent = FunctionCallingAgent(tools=tools)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
|
|
178
|
+
# Test cases
|
|
179
|
+
test_messages = [
|
|
180
|
+
"What's the weather like in New York today?",
|
|
181
|
+
"Who won the last FIFA World Cup?",
|
|
182
|
+
"Can you explain quantum computing?",
|
|
183
|
+
"What are the latest developments in AI?",
|
|
184
|
+
"Tell me a joke about programming.",
|
|
185
|
+
"What's the meaning of life?",
|
|
186
|
+
"Get user details name as John and age as 30"
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
for message in test_messages:
|
|
190
|
+
print(f"\nProcessing: {message}")
|
|
191
|
+
function_call_data = agent.function_call_handler(message)
|
|
192
|
+
print(f"Function Call Data: {function_call_data}")
|
|
169
193
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
194
|
+
if "error" not in function_call_data:
|
|
195
|
+
result = agent.execute_function(function_call_data)
|
|
196
|
+
print(f"Function Execution Result: {result}")
|
|
197
|
+
else:
|
|
198
|
+
print(f"Error: {function_call_data['error']}")
|
webscout/Local/_version.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
from llama_cpp import __version__ as __llama_cpp_version__
|
|
2
|
-
|
|
3
|
-
__version__ =
|
|
2
|
+
from webscout.version import __prog__, __version__
|
|
3
|
+
__version__ = __version__
|
webscout/Provider/Andi.py
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import uuid
|
|
3
|
-
from selenium import webdriver
|
|
4
|
-
from selenium.webdriver.chrome.options import Options
|
|
5
|
-
from selenium.webdriver.common.by import By
|
|
6
|
-
from selenium.webdriver.support import expected_conditions as EC
|
|
7
|
-
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
|
-
import click
|
|
9
|
-
import requests
|
|
10
|
-
from requests import get
|
|
11
1
|
from uuid import uuid4
|
|
12
|
-
|
|
13
|
-
from requests.exceptions import RequestException
|
|
14
|
-
from curl_cffi.requests import get, RequestsError
|
|
15
|
-
import g4f
|
|
16
|
-
from random import randint
|
|
17
|
-
from PIL import Image
|
|
18
|
-
import io
|
|
19
|
-
import re
|
|
2
|
+
import requests
|
|
20
3
|
import json
|
|
21
|
-
import yaml
|
|
22
4
|
from webscout.AIutel import Optimizers
|
|
23
5
|
from webscout.AIutel import Conversation
|
|
24
6
|
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
25
7
|
from webscout.AIbase import Provider, AsyncProvider
|
|
26
8
|
from webscout import exceptions
|
|
27
9
|
from typing import Any, AsyncGenerator, Dict
|
|
28
|
-
import logging
|
|
29
|
-
import httpx
|
|
30
10
|
from webscout import WEBS
|
|
31
11
|
from rich import print
|
|
32
12
|
|
webscout/Provider/BasedGPT.py
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import uuid
|
|
3
|
-
from selenium import webdriver
|
|
4
|
-
from selenium.webdriver.chrome.options import Options
|
|
5
|
-
from selenium.webdriver.common.by import By
|
|
6
|
-
from selenium.webdriver.support import expected_conditions as EC
|
|
7
|
-
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
|
-
import click
|
|
9
1
|
import requests
|
|
10
|
-
from requests import get
|
|
11
|
-
from uuid import uuid4
|
|
12
|
-
from re import findall
|
|
13
|
-
from requests.exceptions import RequestException
|
|
14
|
-
from curl_cffi.requests import get, RequestsError
|
|
15
|
-
import g4f
|
|
16
|
-
from random import randint
|
|
17
|
-
from PIL import Image
|
|
18
|
-
import io
|
|
19
|
-
import re
|
|
20
2
|
import json
|
|
21
|
-
import yaml
|
|
22
3
|
from webscout.AIutel import Optimizers
|
|
23
4
|
from webscout.AIutel import Conversation
|
|
24
5
|
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
25
6
|
from webscout.AIbase import Provider, AsyncProvider
|
|
26
7
|
from webscout import exceptions
|
|
27
8
|
from typing import Any, AsyncGenerator, Dict
|
|
28
|
-
|
|
29
|
-
import httpx
|
|
9
|
+
|
|
30
10
|
|
|
31
11
|
class BasedGPT(Provider):
|
|
32
12
|
def __init__(
|
webscout/Provider/Blackboxai.py
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import uuid
|
|
3
|
-
from selenium import webdriver
|
|
4
|
-
from selenium.webdriver.chrome.options import Options
|
|
5
|
-
from selenium.webdriver.common.by import By
|
|
6
|
-
from selenium.webdriver.support import expected_conditions as EC
|
|
7
|
-
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
|
-
import click
|
|
9
1
|
import requests
|
|
10
|
-
from requests import get
|
|
11
|
-
from uuid import uuid4
|
|
12
|
-
from re import findall
|
|
13
|
-
from requests.exceptions import RequestException
|
|
14
|
-
from curl_cffi.requests import get, RequestsError
|
|
15
|
-
import g4f
|
|
16
|
-
from random import randint
|
|
17
|
-
from PIL import Image
|
|
18
|
-
import io
|
|
19
2
|
import re
|
|
20
3
|
import json
|
|
21
|
-
import yaml
|
|
22
4
|
from webscout.AIutel import Optimizers
|
|
23
5
|
from webscout.AIutel import Conversation
|
|
24
6
|
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
25
7
|
from webscout.AIbase import Provider, AsyncProvider
|
|
26
|
-
from Helpingai_T2 import Perplexity
|
|
27
8
|
from webscout import exceptions
|
|
28
9
|
from typing import Any, AsyncGenerator, Dict
|
|
29
|
-
import logging
|
|
30
10
|
import httpx
|
|
31
11
|
|
|
32
12
|
#------------------------------------------------------BLACKBOXAI--------------------------------------------------------
|
|
@@ -433,7 +413,7 @@ class AsyncBLACKBOXAI(AsyncProvider):
|
|
|
433
413
|
str: Message extracted
|
|
434
414
|
"""
|
|
435
415
|
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
436
|
-
return response["text"]
|
|
416
|
+
return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
|
|
437
417
|
|
|
438
418
|
# Function to clean the response text
|
|
439
419
|
def clean_response(response_text: str) -> str:
|
webscout/Provider/Chatify.py
CHANGED
|
@@ -159,10 +159,11 @@ class Chatify(Provider):
|
|
|
159
159
|
|
|
160
160
|
def get_message(self, response: dict) -> str:
|
|
161
161
|
"""
|
|
162
|
-
Extracts the message from the API response.
|
|
162
|
+
Extracts the message from the API response and formats it.
|
|
163
163
|
"""
|
|
164
164
|
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
165
|
-
return response["text"]
|
|
165
|
+
return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
|
|
166
|
+
|
|
166
167
|
|
|
167
168
|
# Example usage
|
|
168
169
|
if __name__ == "__main__":
|
webscout/Provider/Cloudflare.py
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import uuid
|
|
3
|
-
from selenium import webdriver
|
|
4
|
-
from selenium.webdriver.chrome.options import Options
|
|
5
|
-
from selenium.webdriver.common.by import By
|
|
6
|
-
from selenium.webdriver.support import expected_conditions as EC
|
|
7
|
-
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
|
-
import click
|
|
9
|
-
import requests
|
|
10
|
-
from requests import get
|
|
11
|
-
from uuid import uuid4
|
|
12
|
-
from re import findall
|
|
13
|
-
from requests.exceptions import RequestException
|
|
14
|
-
from curl_cffi.requests import get, RequestsError
|
|
15
|
-
import g4f
|
|
16
|
-
from random import randint
|
|
17
|
-
from PIL import Image
|
|
18
|
-
import io
|
|
19
|
-
import re
|
|
20
1
|
import json
|
|
21
|
-
import
|
|
2
|
+
from uuid import uuid4
|
|
22
3
|
from webscout.AIutel import Optimizers
|
|
23
4
|
from webscout.AIutel import Conversation
|
|
24
5
|
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
25
6
|
from webscout.AIbase import Provider, AsyncProvider
|
|
26
7
|
from webscout import exceptions
|
|
27
8
|
from typing import Any, AsyncGenerator, Dict
|
|
28
|
-
import logging
|
|
29
|
-
import httpx
|
|
30
9
|
import cloudscraper
|
|
31
10
|
|
|
32
11
|
class Cloudflare(Provider):
|
webscout/Provider/Cohere.py
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import uuid
|
|
3
|
-
from selenium import webdriver
|
|
4
|
-
from selenium.webdriver.chrome.options import Options
|
|
5
|
-
from selenium.webdriver.common.by import By
|
|
6
|
-
from selenium.webdriver.support import expected_conditions as EC
|
|
7
|
-
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
|
-
import click
|
|
9
1
|
import requests
|
|
10
|
-
from requests import get
|
|
11
|
-
from uuid import uuid4
|
|
12
|
-
from re import findall
|
|
13
|
-
from requests.exceptions import RequestException
|
|
14
|
-
from curl_cffi.requests import get, RequestsError
|
|
15
|
-
import g4f
|
|
16
|
-
from random import randint
|
|
17
|
-
from PIL import Image
|
|
18
|
-
import io
|
|
19
|
-
import re
|
|
20
2
|
import json
|
|
21
|
-
import yaml
|
|
22
3
|
from webscout.AIutel import Optimizers
|
|
23
4
|
from webscout.AIutel import Conversation
|
|
24
5
|
from webscout.AIutel import AwesomePrompts, sanitize_stream
|
|
25
6
|
from webscout.AIbase import Provider, AsyncProvider
|
|
26
|
-
from Helpingai_T2 import Perplexity
|
|
27
7
|
from webscout import exceptions
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import httpx
|
|
8
|
+
|
|
9
|
+
|
|
31
10
|
#-----------------------------------------------Cohere--------------------------------------------
|
|
32
11
|
class Cohere(Provider):
|
|
33
12
|
def __init__(
|
webscout/Provider/DARKAI.py
CHANGED
webscout/Provider/Deepinfra.py
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import uuid
|
|
3
|
-
import click
|
|
1
|
+
|
|
4
2
|
import requests
|
|
5
|
-
|
|
6
|
-
from uuid import uuid4
|
|
7
|
-
from re import findall
|
|
8
|
-
from requests.exceptions import RequestException
|
|
9
|
-
from curl_cffi.requests import get, RequestsError
|
|
10
|
-
import g4f
|
|
11
|
-
from random import randint
|
|
12
|
-
from PIL import Image
|
|
13
|
-
import io
|
|
14
|
-
import re
|
|
15
|
-
import json
|
|
16
|
-
import yaml
|
|
3
|
+
|
|
17
4
|
from ..AIutel import Optimizers
|
|
18
5
|
from ..AIutel import Conversation
|
|
19
6
|
from ..AIutel import AwesomePrompts, sanitize_stream
|
|
20
7
|
from ..AIbase import Provider, AsyncProvider
|
|
21
8
|
from webscout import exceptions
|
|
22
9
|
from typing import Any, AsyncGenerator
|
|
23
|
-
import logging
|
|
24
10
|
import httpx
|
|
25
11
|
|
|
26
12
|
class DeepInfra(Provider):
|