webscout 5.4__py3-none-any.whl → 5.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.
Files changed (48) hide show
  1. webscout/Agents/Onlinesearcher.py +3 -3
  2. webscout/Agents/__init__.py +0 -1
  3. webscout/Agents/functioncall.py +3 -3
  4. webscout/Provider/Bing.py +243 -0
  5. webscout/Provider/Chatify.py +1 -1
  6. webscout/Provider/Cloudflare.py +1 -1
  7. webscout/Provider/DARKAI.py +1 -1
  8. webscout/Provider/DiscordRocks.py +109 -246
  9. webscout/Provider/Farfalle.py +1 -1
  10. webscout/Provider/Free2GPT.py +234 -0
  11. webscout/{Agents/ai.py → Provider/GPTWeb.py} +40 -33
  12. webscout/Provider/Llama3.py +65 -62
  13. webscout/Provider/OLLAMA.py +1 -1
  14. webscout/Provider/PizzaGPT.py +1 -1
  15. webscout/Provider/RUBIKSAI.py +13 -3
  16. webscout/Provider/Reka.py +0 -1
  17. webscout/Provider/TTI/Nexra.py +120 -0
  18. webscout/Provider/TTI/__init__.py +4 -1
  19. webscout/Provider/TTI/aiforce.py +137 -0
  20. webscout/Provider/TTI/blackboximage.py +153 -0
  21. webscout/Provider/TTI/deepinfra.py +2 -2
  22. webscout/Provider/TeachAnything.py +1 -1
  23. webscout/Provider/Youchat.py +1 -1
  24. webscout/Provider/__init__.py +11 -6
  25. webscout/Provider/{NetFly.py → aigames.py} +76 -79
  26. webscout/Provider/cleeai.py +1 -1
  27. webscout/Provider/elmo.py +1 -1
  28. webscout/Provider/felo_search.py +1 -1
  29. webscout/Provider/genspark.py +1 -1
  30. webscout/Provider/julius.py +7 -1
  31. webscout/Provider/lepton.py +1 -1
  32. webscout/Provider/meta.py +1 -1
  33. webscout/Provider/turboseek.py +1 -1
  34. webscout/Provider/upstage.py +230 -0
  35. webscout/Provider/x0gpt.py +1 -1
  36. webscout/Provider/xdash.py +1 -1
  37. webscout/Provider/yep.py +2 -2
  38. webscout/tempid.py +46 -2
  39. webscout/version.py +1 -1
  40. webscout/webai.py +1 -1
  41. webscout/webscout_search_async.py +9 -9
  42. {webscout-5.4.dist-info → webscout-5.6.dist-info}/METADATA +7 -30
  43. {webscout-5.4.dist-info → webscout-5.6.dist-info}/RECORD +47 -42
  44. webscout/Provider/ThinkAnyAI.py +0 -219
  45. {webscout-5.4.dist-info → webscout-5.6.dist-info}/LICENSE.md +0 -0
  46. {webscout-5.4.dist-info → webscout-5.6.dist-info}/WHEEL +0 -0
  47. {webscout-5.4.dist-info → webscout-5.6.dist-info}/entry_points.txt +0 -0
  48. {webscout-5.4.dist-info → webscout-5.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,120 @@
1
+ import requests
2
+ import json
3
+ import os
4
+ import time
5
+ from typing import List, Optional
6
+ from requests.exceptions import RequestException
7
+
8
+ from webscout.AIbase import ImageProvider
9
+
10
+ class NexraImager(ImageProvider):
11
+ """Image provider for Nexra API"""
12
+
13
+ AVAILABLE_MODELS = {
14
+ "standard": ["emi", "stablediffusion-1.5", "stablediffusion-2.1", "sdxl-lora", "dalle", "dalle2", "dalle-mini"],
15
+ "prodia": [
16
+ "dreamshaperXL10_alpha2.safetensors [c8afe2ef]",
17
+ "dynavisionXL_0411.safetensors [c39cc051]",
18
+ "juggernautXL_v45.safetensors [e75f5471]",
19
+ "realismEngineSDXL_v10.safetensors [af771c3f]",
20
+ "sd_xl_base_1.0.safetensors [be9edd61]",
21
+ "animagineXLV3_v30.safetensors [75f2f05b]",
22
+ "sd_xl_base_1.0_inpainting_0.1.safetensors [5679a81a]",
23
+ "turbovisionXL_v431.safetensors [78890989]",
24
+ "devlishphotorealism_sdxl15.safetensors [77cba69f]",
25
+ "realvisxlV40.safetensors [f7fdcb51]"
26
+ ]
27
+ }
28
+
29
+ def __init__(self, timeout: int = 60, proxies: dict = {}):
30
+ self.url = "https://nexra.aryahcr.cc/api/image/complements"
31
+ self.headers = {"Content-Type": "application/json"}
32
+ self.session = requests.Session()
33
+ self.session.headers.update(self.headers)
34
+ self.session.proxies.update(proxies)
35
+ self.timeout = timeout
36
+ self.prompt: str = "AI-generated image - webscout"
37
+ self.image_extension: str = "png"
38
+
39
+ def generate(
40
+ self, prompt: str, model: str = "emi", amount: int = 1,
41
+ max_retries: int = 3, retry_delay: int = 5,
42
+ additional_params: Optional[dict] = None
43
+ ) -> List[bytes]:
44
+ assert bool(prompt), "Prompt cannot be null"
45
+ assert isinstance(amount, int) and amount > 0, "Amount should be a positive integer"
46
+
47
+ self.prompt = prompt
48
+ response = []
49
+
50
+ payload = {
51
+ "prompt": prompt,
52
+ "model": "prodia" if model in self.AVAILABLE_MODELS["prodia"] else model,
53
+ }
54
+
55
+ if model in self.AVAILABLE_MODELS["prodia"]:
56
+ payload["data"] = {
57
+ "model": model,
58
+ "steps": 25,
59
+ "cfg_scale": 7,
60
+ "sampler": "DPM++ 2M Karras",
61
+ "negative_prompt": ""
62
+ }
63
+ if additional_params:
64
+ payload.update(additional_params)
65
+
66
+ for _ in range(max_retries):
67
+ try:
68
+ resp = self.session.post(self.url, json=payload, timeout=self.timeout)
69
+ resp.raise_for_status()
70
+
71
+ # Remove leading underscores and then parse JSON
72
+ response_data = json.loads(resp.text.lstrip("_"))
73
+
74
+ if response_data.get("status") and "images" in response_data:
75
+ for image_url in response_data["images"]:
76
+ img_resp = requests.get(image_url)
77
+ img_resp.raise_for_status()
78
+ response.append(img_resp.content)
79
+ break
80
+ else:
81
+ raise Exception("Failed to generate image: " + str(response_data))
82
+ except json.JSONDecodeError as json_err:
83
+ print(f"JSON Decode Error: {json_err}")
84
+ print(f"Raw response: {resp.text}")
85
+ if _ == max_retries - 1:
86
+ raise
87
+ except RequestException as e:
88
+ print(f"Request Exception: {e}")
89
+ if _ == max_retries - 1:
90
+ raise
91
+ print(f"Retrying in {retry_delay} seconds...")
92
+ time.sleep(retry_delay)
93
+
94
+ return response
95
+
96
+ def save(
97
+ self,
98
+ response: List[bytes],
99
+ name: str = None,
100
+ dir: str = os.getcwd(),
101
+ filenames_prefix: str = "",
102
+ ) -> List[str]:
103
+ assert isinstance(response, list), f"Response should be a list, not {type(response)}"
104
+ name = self.prompt if name is None else name
105
+
106
+ filenames = []
107
+ for i, image in enumerate(response):
108
+ filename = f"{filenames_prefix}{name}_{i}.{self.image_extension}"
109
+ filepath = os.path.join(dir, filename)
110
+
111
+ with open(filepath, "wb") as fh:
112
+ fh.write(image)
113
+ filenames.append(filename)
114
+
115
+ return filenames
116
+
117
+ if __name__ == "__main__":
118
+ bot = NexraImager()
119
+ resp_standard = bot.generate("AI-generated image - webscout", "emi", 1)
120
+ print(bot.save(resp_standard))
@@ -1,2 +1,5 @@
1
1
  from .deepinfra import *
2
- from .PollinationsAI import *
2
+ from .PollinationsAI import *
3
+ from .aiforce import *
4
+ from .blackboximage import *
5
+ from .Nexra import *
@@ -0,0 +1,137 @@
1
+ import requests
2
+ import os
3
+ import time
4
+ from typing import List
5
+ from string import punctuation
6
+ from random import choice
7
+ from requests.exceptions import RequestException
8
+
9
+ from webscout.AIbase import ImageProvider
10
+
11
+ class AiForceimagger(ImageProvider):
12
+ """Image provider for pollinations.ai"""
13
+
14
+ def __init__(self, timeout: int = 60, proxies: dict = {}):
15
+ """Initializes the PollinationsAI class.
16
+
17
+ Args:
18
+ timeout (int, optional): HTTP request timeout in seconds. Defaults to 60.
19
+ proxies (dict, optional): HTTP request proxies (socks). Defaults to {}.
20
+ """
21
+ self.image_gen_endpoint = "https://api.airforce/v1/imagine2?prompt={prompt}"
22
+ self.headers = {
23
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
24
+ "Accept-Language": "en-US,en;q=0.5",
25
+ "Accept-Encoding": "gzip, deflate",
26
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0",
27
+ }
28
+ self.session = requests.Session()
29
+ self.session.headers.update(self.headers)
30
+ self.session.proxies.update(proxies)
31
+ self.timeout = timeout
32
+ self.prompt: str = "AI-generated image - webscout"
33
+ self.image_extension: str = "png"
34
+
35
+ def generate(
36
+ self, prompt: str, amount: int = 1, additives: bool = True,
37
+ max_retries: int = 3, retry_delay: int = 5
38
+ ) -> List[bytes]:
39
+ """Generate image from prompt
40
+
41
+ Args:
42
+ prompt (str): Image description.
43
+ amount (int): Total images to be generated. Defaults to 1.
44
+ additives (bool, optional): Try to make each prompt unique. Defaults to True.
45
+ width (int, optional): Width of the generated image. Defaults to 768.
46
+ height (int, optional): Height of the generated image. Defaults to 768.
47
+ model (str, optional): The model to use for image generation. Defaults to "flux".
48
+ max_retries (int, optional): Maximum number of retry attempts. Defaults to 3.
49
+ retry_delay (int, optional): Delay between retries in seconds. Defaults to 5.
50
+
51
+ Returns:
52
+ List[bytes]: List of generated images as bytes.
53
+ """
54
+ assert bool(prompt), "Prompt cannot be null"
55
+ assert isinstance(amount, int), f"Amount should be an integer only not {type(amount)}"
56
+ assert amount > 0, "Amount should be greater than 0"
57
+
58
+ ads = lambda: (
59
+ ""
60
+ if not additives
61
+ else choice(punctuation)
62
+ + choice(punctuation)
63
+ + choice(punctuation)
64
+ + choice(punctuation)
65
+ + choice(punctuation)
66
+ )
67
+
68
+ self.prompt = prompt
69
+ response = []
70
+ for _ in range(amount):
71
+ url = self.image_gen_endpoint.format(
72
+ prompt=prompt
73
+ )
74
+
75
+ for attempt in range(max_retries):
76
+ try:
77
+ resp = self.session.get(url, timeout=self.timeout)
78
+ resp.raise_for_status()
79
+ response.append(resp.content)
80
+ break
81
+ except RequestException as e:
82
+ if attempt == max_retries - 1:
83
+ print(f"Failed to generate image after {max_retries} attempts: {e}")
84
+ raise
85
+ else:
86
+ print(f"Attempt {attempt + 1} failed. Retrying in {retry_delay} seconds...")
87
+ time.sleep(retry_delay)
88
+
89
+ return response
90
+
91
+ def save(
92
+ self,
93
+ response: List[bytes],
94
+ name: str = None,
95
+ dir: str = os.getcwd(),
96
+ filenames_prefix: str = "",
97
+ ) -> List[str]:
98
+ """Save generated images
99
+
100
+ Args:
101
+ response (List[bytes]): List of generated images as bytes.
102
+ name (str): Filename for the images. Defaults to the last prompt.
103
+ dir (str, optional): Directory for saving images. Defaults to os.getcwd().
104
+ filenames_prefix (str, optional): String to be prefixed at each filename to be returned.
105
+
106
+ Returns:
107
+ List[str]: List of saved filenames.
108
+ """
109
+ assert isinstance(response, list), f"Response should be of {list} not {type(response)}"
110
+ name = self.prompt if name is None else name
111
+
112
+ filenames = []
113
+ count = 0
114
+ for image in response:
115
+ def complete_path():
116
+ count_value = "" if count == 0 else f"_{count}"
117
+ return os.path.join(dir, name + count_value + "." + self.image_extension)
118
+
119
+ while os.path.isfile(complete_path()):
120
+ count += 1
121
+
122
+ absolute_path_to_file = complete_path()
123
+ filenames.append(filenames_prefix + os.path.split(absolute_path_to_file)[1])
124
+
125
+ with open(absolute_path_to_file, "wb") as fh:
126
+ fh.write(image)
127
+
128
+ return filenames
129
+
130
+
131
+ if __name__ == "__main__":
132
+ bot = AiForceimagger()
133
+ try:
134
+ resp = bot.generate("AI-generated image - webscout", 1)
135
+ print(bot.save(resp))
136
+ except Exception as e:
137
+ print(f"An error occurred: {e}")
@@ -0,0 +1,153 @@
1
+ import requests
2
+ import json
3
+ import uuid
4
+ import os
5
+ import time
6
+ from typing import List
7
+ from requests.exceptions import RequestException
8
+
9
+ from webscout.AIbase import ImageProvider
10
+
11
+ class BlackboxAIImager(ImageProvider):
12
+ """Image provider for Blackbox AI"""
13
+
14
+ def __init__(self, timeout: int = 60, proxies: dict = {}):
15
+ """Initializes the BlackboxAIImager class.
16
+
17
+ Args:
18
+ timeout (int, optional): HTTP request timeout in seconds. Defaults to 60.
19
+ proxies (dict, optional): HTTP request proxies. Defaults to {}.
20
+ """
21
+ self.url = "https://www.blackbox.ai/api/chat"
22
+ self.headers = {
23
+ "Content-Type": "application/json",
24
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0",
25
+ "Origin": "https://www.blackbox.ai",
26
+ "Referer": "https://www.blackbox.ai/agent/ImageGenerationLV45LJp"
27
+ }
28
+ self.session = requests.Session()
29
+ self.session.headers.update(self.headers)
30
+ self.session.proxies.update(proxies)
31
+ self.timeout = timeout
32
+ self.prompt: str = "AI-generated image - webscout"
33
+ self.image_extension: str = "jpg"
34
+
35
+ def generate(
36
+ self, prompt: str, amount: int = 1,
37
+ max_retries: int = 3, retry_delay: int = 5
38
+ ) -> List[bytes]:
39
+ """Generate image from prompt
40
+
41
+ Args:
42
+ prompt (str): Image description.
43
+ amount (int): Total images to be generated. Defaults to 1.
44
+ max_retries (int, optional): Maximum number of retry attempts. Defaults to 3.
45
+ retry_delay (int, optional): Delay between retries in seconds. Defaults to 5.
46
+
47
+ Returns:
48
+ List[bytes]: List of generated images as bytes.
49
+ """
50
+ assert bool(prompt), "Prompt cannot be null"
51
+ assert isinstance(amount, int), f"Amount should be an integer only not {type(amount)}"
52
+ assert amount > 0, "Amount should be greater than 0"
53
+
54
+ self.prompt = prompt
55
+ response = []
56
+
57
+ for _ in range(amount):
58
+ message_id = str(uuid.uuid4())
59
+ payload = {
60
+ "messages": [
61
+ {
62
+ "id": message_id,
63
+ "content": prompt,
64
+ "role": "user"
65
+ }
66
+ ],
67
+ "id": message_id,
68
+ "previewToken": None,
69
+ "userId": None,
70
+ "codeModelMode": True,
71
+ "agentMode": {
72
+ "mode": True,
73
+ "id": "ImageGenerationLV45LJp",
74
+ "name": "Image Generation"
75
+ },
76
+ "trendingAgentMode": {},
77
+ "isMicMode": False,
78
+ "maxTokens": 1024,
79
+ "isChromeExt": False,
80
+ "githubToken": None,
81
+ "clickedAnswer2": False,
82
+ "clickedAnswer3": False,
83
+ "clickedForceWebSearch": False,
84
+ "visitFromDelta": False,
85
+ "mobileClient": False
86
+ }
87
+
88
+ for attempt in range(max_retries):
89
+ try:
90
+ resp = self.session.post(self.url, json=payload, timeout=self.timeout)
91
+ resp.raise_for_status()
92
+ response_data = resp.text
93
+ image_url = response_data.split("(")[1].split(")")[0]
94
+ image_response = requests.get(image_url)
95
+ image_response.raise_for_status()
96
+ response.append(image_response.content)
97
+ break
98
+ except RequestException as e:
99
+ if attempt == max_retries - 1:
100
+ print(f"Failed to generate image after {max_retries} attempts: {e}")
101
+ raise
102
+ else:
103
+ print(f"Attempt {attempt + 1} failed. Retrying in {retry_delay} seconds...")
104
+ time.sleep(retry_delay)
105
+
106
+ return response
107
+
108
+ def save(
109
+ self,
110
+ response: List[bytes],
111
+ name: str = None,
112
+ dir: str = os.getcwd(),
113
+ filenames_prefix: str = "",
114
+ ) -> List[str]:
115
+ """Save generated images
116
+
117
+ Args:
118
+ response (List[bytes]): List of generated images as bytes.
119
+ name (str): Filename for the images. Defaults to the last prompt.
120
+ dir (str, optional): Directory for saving images. Defaults to os.getcwd().
121
+ filenames_prefix (str, optional): String to be prefixed at each filename to be returned.
122
+
123
+ Returns:
124
+ List[str]: List of saved filenames.
125
+ """
126
+ assert isinstance(response, list), f"Response should be of {list} not {type(response)}"
127
+ name = self.prompt if name is None else name
128
+
129
+ filenames = []
130
+ count = 0
131
+ for image in response:
132
+ def complete_path():
133
+ count_value = "" if count == 0 else f"_{count}"
134
+ return os.path.join(dir, name + count_value + "." + self.image_extension)
135
+
136
+ while os.path.isfile(complete_path()):
137
+ count += 1
138
+
139
+ absolute_path_to_file = complete_path()
140
+ filenames.append(filenames_prefix + os.path.split(absolute_path_to_file)[1])
141
+
142
+ with open(absolute_path_to_file, "wb") as fh:
143
+ fh.write(image)
144
+
145
+ return filenames
146
+
147
+ if __name__ == "__main__":
148
+ bot = BlackboxAIImager()
149
+ try:
150
+ resp = bot.generate("AI-generated image - webscout", 1)
151
+ print(bot.save(resp))
152
+ except Exception as e:
153
+ print(f"An error occurred: {e}")
@@ -13,7 +13,7 @@ class DeepInfraImager(ImageProvider):
13
13
 
14
14
  def __init__(
15
15
  self,
16
- model: str = "black-forest-labs/FLUX-1-dev",
16
+ model: str = "black-forest-labs/FLUX-1-schnell",
17
17
  timeout: int = 60,
18
18
  proxies: dict = {},
19
19
  ):
@@ -21,7 +21,7 @@ class DeepInfraImager(ImageProvider):
21
21
 
22
22
  Args:
23
23
  model (str, optional): The name of the DeepInfra model to use.
24
- Defaults to "black-forest-labs/FLUX-1-dev".
24
+ Defaults to "black-forest-labs/FLUX-1-schnell".
25
25
  timeout (int, optional): Http request timeout. Defaults to 60 seconds.
26
26
  proxies (dict, optional): Http request proxies (socks). Defaults to {}.
27
27
  """
@@ -172,6 +172,6 @@ class TeachAnything:
172
172
  if __name__ == '__main__':
173
173
  from rich import print
174
174
  ai = TeachAnything()
175
- response = ai.chat(input(">>> "))
175
+ response = ai.chat("hi")
176
176
  for chunk in response:
177
177
  print(chunk, end="", flush=True)
@@ -225,6 +225,6 @@ class YouChat(Provider):
225
225
  if __name__ == '__main__':
226
226
  from rich import print
227
227
  ai = YouChat()
228
- response = ai.chat(input(">>> "))
228
+ response = ai.chat("hi")
229
229
  for chunk in response:
230
230
  print(chunk, end="", flush=True)
@@ -1,6 +1,4 @@
1
1
  # webscout/providers/__init__.py
2
-
3
- from .ThinkAnyAI import ThinkAnyAI
4
2
  from .PI import *
5
3
  from .Llama import LLAMA
6
4
  from .Cohere import Cohere
@@ -40,7 +38,7 @@ from .Youchat import *
40
38
  from .yep import *
41
39
  from .Cloudflare import *
42
40
  from .turboseek import *
43
- from .NetFly import *
41
+ from .Free2GPT import *
44
42
  from .EDITEE import *
45
43
  from .TeachAnything import *
46
44
  from .AI21 import *
@@ -51,8 +49,11 @@ from .lepton import *
51
49
  from .geminiapi import *
52
50
  from .elmo import *
53
51
  from .genspark import *
52
+ from .upstage import *
53
+ from .Bing import *
54
+ from .GPTWeb import *
55
+ from .aigames import *
54
56
  __all__ = [
55
- 'ThinkAnyAI',
56
57
  'Farfalle',
57
58
  'LLAMA',
58
59
  'Cohere',
@@ -93,7 +94,6 @@ __all__ = [
93
94
  'YEPCHAT',
94
95
  'Cloudflare',
95
96
  'TurboSeek',
96
- 'NetFly',
97
97
  'Editee',
98
98
  'TeachAnything',
99
99
  'AI21',
@@ -104,6 +104,11 @@ __all__ = [
104
104
  'GEMINIAPI',
105
105
  'Cleeai',
106
106
  'Elmo',
107
- 'Genspark'
107
+ 'Genspark',
108
+ 'Upstage',
109
+ 'Free2GPT',
110
+ 'Bing',
111
+ 'GPTWeb',
112
+ 'AIGameIO',
108
113
 
109
114
  ]