webscout 1.4.5__py3-none-any.whl → 2.0__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.

@@ -0,0 +1,57 @@
1
+ # webscout/providers/__init__.py
2
+
3
+ from .ThinkAnyAI import ThinkAnyAI
4
+ from .Xjai import Xjai
5
+ from .Llama2 import LLAMA2
6
+ from .Llama2 import AsyncLLAMA2
7
+ from .Cohere import Cohere
8
+ from .Reka import REKA
9
+ from .Groq import GROQ
10
+ from .Groq import AsyncGROQ
11
+ from .Openai import OPENAI
12
+ from .Openai import AsyncOPENAI
13
+ from .Leo import LEO
14
+ from .Leo import AsyncLEO
15
+ from .Koboldai import KOBOLDAI
16
+ from .Koboldai import AsyncKOBOLDAI
17
+ from .OpenGPT import OPENGPT
18
+ from .OpenGPT import AsyncOPENGPT
19
+ from .Perplexity import PERPLEXITY
20
+ from .Blackboxai import BLACKBOXAI
21
+ from .Blackboxai import AsyncBLACKBOXAI
22
+ from .Phind import PhindSearch
23
+ from .Phind import AsyncPhindSearch
24
+ from .Yepchat import YEPCHAT
25
+ from .Yepchat import AsyncYEPCHAT
26
+ from .Youchat import YouChat
27
+ from .Gemini import GEMINI
28
+ from .ChatGPTlogin import ChatGPTlogin
29
+
30
+ __all__ = [
31
+ 'ThinkAnyAI',
32
+ 'Xjai',
33
+ 'LLAMA2',
34
+ 'AsyncLLAMA2',
35
+ 'Cohere',
36
+ 'REKA',
37
+ 'GROQ',
38
+ 'AsyncGROQ',
39
+ 'OPENAI',
40
+ 'AsyncOPENAI',
41
+ 'LEO',
42
+ 'AsyncLEO',
43
+ 'KOBOLDAI',
44
+ 'AsyncKOBOLDAI',
45
+ 'OPENGPT',
46
+ 'AsyncOPENGPT',
47
+ 'PERPLEXITY',
48
+ 'BLACKBOXAI',
49
+ 'AsyncBLACKBOXAI',
50
+ 'PhindSearch',
51
+ 'AsyncPhindSearch',
52
+ 'YEPCHAT',
53
+ 'AsyncYEPCHAT',
54
+ 'YouChat',
55
+ 'GEMINI',
56
+ 'ChatGPTlogin',
57
+ ]
webscout/__init__.py CHANGED
@@ -2,15 +2,44 @@
2
2
 
3
3
  Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI models, can transcribe yt videos, temporary email and phone number generation, have TTS support and webai(terminal gpt and open interpeter)
4
4
  """
5
- import g4f
6
- import logging
7
- from .webscout_search import WEBS
8
- from .webscout_search_async import AsyncWEBS
5
+ # webscout/__init__.py
6
+
7
+ from .webscout_search import WEBS
8
+ from .webscout_search_async import AsyncWEBS
9
9
  from .version import __version__
10
- from .DWEBS import DeepWEBS
10
+ from .DWEBS import DeepWEBS
11
11
  from .transcriber import transcriber
12
12
  from .voice import play_audio
13
-
13
+ import g4f
14
+ # Import provider classes for direct access
15
+ from .Provider import (
16
+ ThinkAnyAI,
17
+ Xjai,
18
+ LLAMA2,
19
+ AsyncLLAMA2,
20
+ Cohere,
21
+ REKA,
22
+ GROQ,
23
+ AsyncGROQ,
24
+ OPENAI,
25
+ AsyncOPENAI,
26
+ LEO,
27
+ AsyncLEO,
28
+ KOBOLDAI,
29
+ AsyncKOBOLDAI,
30
+ OPENGPT,
31
+ AsyncOPENGPT,
32
+ PERPLEXITY,
33
+ BLACKBOXAI,
34
+ AsyncBLACKBOXAI,
35
+ PhindSearch,
36
+ AsyncPhindSearch,
37
+ YEPCHAT,
38
+ AsyncYEPCHAT,
39
+ YouChat,
40
+ GEMINI,
41
+ ChatGPTlogin,
42
+ )
14
43
 
15
44
  __repo__ = "https://github.com/OE-LUCIFER/Webscout"
16
45
 
@@ -30,7 +59,9 @@ webai = [
30
59
  "yepchat",
31
60
  "you",
32
61
  "xjai",
33
- "thinkany"
62
+ "thinkany",
63
+ # "chatgptlogin",
64
+ "auto",
34
65
  ]
35
66
 
36
67
  gpt4free_providers = [
@@ -39,6 +70,45 @@ gpt4free_providers = [
39
70
 
40
71
  available_providers = webai + gpt4free_providers
41
72
 
42
- __all__ = ["WEBS", "AsyncWEBS", "__version__", "cli"]
73
+ # Add all the provider classes you want to directly import to __all__
74
+ __all__ = [
75
+ "WEBS",
76
+ "AsyncWEBS",
77
+ "__version__",
78
+ "cli",
79
+ "DeepWEBS",
80
+ "transcriber",
81
+ "play_audio",
82
+
83
+ # AI Providers
84
+ "ThinkAnyAI",
85
+ "Xjai",
86
+ "LLAMA2",
87
+ "AsyncLLAMA2",
88
+ "Cohere",
89
+ "REKA",
90
+ "GROQ",
91
+ "AsyncGROQ",
92
+ "OPENAI",
93
+ "AsyncOPENAI",
94
+ "LEO",
95
+ "AsyncLEO",
96
+ "KOBOLDAI",
97
+ "AsyncKOBOLDAI",
98
+ "OPENGPT",
99
+ "AsyncOPENGPT",
100
+ "PERPLEXITY",
101
+ "BLACKBOXAI",
102
+ "AsyncBLACKBOXAI",
103
+ "PhindSearch",
104
+ "AsyncPhindSearch",
105
+ "YEPCHAT",
106
+ "AsyncYEPCHAT",
107
+ "YouChat",
108
+ "GEMINI",
109
+ "ChatGPTlogin",
110
+ ]
43
111
 
44
- logging.getLogger("webscout").addHandler(logging.NullHandler())
112
+ # Set up basic logger
113
+ import logging
114
+ logging.getLogger("webscout").addHandler(logging.NullHandler())
@@ -7,7 +7,7 @@ from webscout.AI import AsyncLEO
7
7
  from webscout.AI import AsyncKOBOLDAI
8
8
  from webscout.AI import AsyncGROQ
9
9
  from webscout.AI import AsyncBLACKBOXAI
10
- from webscout.AI import AsyncGPT4FREE
10
+ from webscout.g4f import AsyncGPT4FREE
11
11
 
12
12
  mapper: dict[str, object] = {
13
13
  "phind": AsyncPhindSearch,
@@ -21,13 +21,3 @@ mapper: dict[str, object] = {
21
21
  "groq": AsyncGROQ,
22
22
  "openai": AsyncOPENAI,
23
23
  }
24
-
25
- tgpt_mapper: dict[str, object] = {
26
- "phind": AsyncPhindSearch,
27
- "opengpt": AsyncOPENGPT,
28
- "koboldai": AsyncKOBOLDAI,
29
- # "gpt4free": AsyncGPT4FREE,
30
- "blackboxai": AsyncBLACKBOXAI,
31
- "llama2": AsyncLLAMA2,
32
- "yepchat": AsyncYEPCHAT,
33
- }
webscout/exceptions.py CHANGED
@@ -10,4 +10,9 @@ class TimeoutE(Exception):
10
10
  """Raised for timeout errors during API requests."""
11
11
 
12
12
  class FailedToGenerateResponseError(Exception):
13
+
13
14
  """Provider failed to fetch response"""
15
+ class AllProvidersFailure(Exception):
16
+ """None of the providers generated response successfully"""
17
+
18
+ pass
webscout/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "1.4.5"
1
+ __version__ = "2.0"
2
2
 
webscout/webai.py CHANGED
@@ -25,16 +25,17 @@ from rich.table import Table
25
25
  from rich.prompt import Prompt
26
26
  from rich.progress import Progress
27
27
  from typing import Iterator
28
- from webscout.AIutel import Optimizers
29
- from webscout.AIutel import default_path
30
- from webscout.AIutel import AwesomePrompts
31
- from webscout.AIutel import RawDog
32
- from webscout.AIutel import Audio
28
+ from .AIutel import Optimizers
29
+ from .AIutel import default_path
30
+ from .AIutel import AwesomePrompts
31
+ from .AIutel import RawDog
32
+ from .AIutel import Audio
33
33
  from webscout import available_providers
34
34
  from colorama import Fore
35
35
  from colorama import init as init_colorama
36
36
  from dotenv import load_dotenv
37
37
  import g4f
38
+ import webscout
38
39
  import webscout.AIutel
39
40
 
40
41
  init_colorama(autoreset=True)
@@ -414,7 +415,7 @@ class Main(cmd.Cmd):
414
415
  )
415
416
 
416
417
  elif provider == "leo":
417
- from webscout.AI import LEO
418
+ from webscout import LEO
418
419
 
419
420
  self.bot = LEO(
420
421
  is_conversation=disable_conversation,
@@ -437,7 +438,7 @@ class Main(cmd.Cmd):
437
438
  assert auth, (
438
439
  "OpenAI's API-key is required. " "Use the flag `--key` or `-k`"
439
440
  )
440
- from webscout.AI import OPENAI
441
+ from webscout import OPENAI
441
442
 
442
443
  self.bot = OPENAI(
443
444
  api_key=auth,
@@ -456,9 +457,22 @@ class Main(cmd.Cmd):
456
457
  history_offset=history_offset,
457
458
  act=awesome_prompt,
458
459
  )
460
+ if provider == "auto":
461
+ from webscout import AUTO
459
462
 
463
+ self.bot = AUTO(
464
+ is_conversation=disable_conversation,
465
+ max_tokens=max_tokens,
466
+ timeout=timeout,
467
+ intro=intro,
468
+ filepath=filepath,
469
+ update_file=update_file,
470
+ proxies=proxies,
471
+ history_offset=history_offset,
472
+ act=awesome_prompt,
473
+ )
460
474
  elif provider == "opengpt":
461
- from webscout.AI import OPENGPT
475
+ from webscout import OPENGPT
462
476
 
463
477
  self.bot = OPENGPT(
464
478
  is_conversation=disable_conversation,
@@ -470,9 +484,10 @@ class Main(cmd.Cmd):
470
484
  proxies=proxies,
471
485
  history_offset=history_offset,
472
486
  act=awesome_prompt,
487
+ assistant_id="bca37014-6f97-4f2b-8928-81ea8d478d88"
473
488
  )
474
489
  elif provider == "thinkany":
475
- from webscout.AI import ThinkAnyAI
490
+ from webscout import ThinkAnyAI
476
491
 
477
492
  self.bot = ThinkAnyAI(
478
493
  is_conversation=disable_conversation,
@@ -485,8 +500,22 @@ class Main(cmd.Cmd):
485
500
  history_offset=history_offset,
486
501
  act=awesome_prompt,
487
502
  )
503
+ # elif provider == "chatgptlogin":
504
+ # from webscout import ChatGPTlogin
505
+
506
+ # self.bot = ChatGPTlogin(
507
+ # is_conversation=disable_conversation,
508
+ # max_tokens=max_tokens,
509
+ # timeout=timeout,
510
+ # intro=intro,
511
+ # filepath=filepath,
512
+ # update_file=update_file,
513
+ # proxies=proxies,
514
+ # history_offset=history_offset,
515
+ # act=awesome_prompt,
516
+ # )
488
517
  elif provider == "yepchat":
489
- from webscout.AI import YEPCHAT
518
+ from webscout import YEPCHAT
490
519
 
491
520
  self.bot = YEPCHAT(
492
521
  is_conversation=disable_conversation,
@@ -508,7 +537,7 @@ class Main(cmd.Cmd):
508
537
  assert auth, (
509
538
  "GROQ's API-key is required. " "Use the flag `--key` or `-k`"
510
539
  )
511
- from webscout.AI import GROQ
540
+ from webscout import GROQ
512
541
 
513
542
 
514
543
  self.bot = GROQ(
@@ -532,7 +561,7 @@ class Main(cmd.Cmd):
532
561
  assert auth, (
533
562
  "Cohere's API-key is required. Use the flag `--key` or `-k`"
534
563
  )
535
- from webscout.AI import Cohere
564
+ from webscout import Cohere
536
565
  self.bot = Cohere(
537
566
  api_key=auth,
538
567
  is_conversation=disable_conversation,
@@ -550,7 +579,7 @@ class Main(cmd.Cmd):
550
579
  act=awesome_prompt,
551
580
  )
552
581
  elif provider == "reka":
553
- from webscout.AI import REKA
582
+ from webscout import REKA
554
583
 
555
584
  self.bot = REKA(
556
585
  api_key=auth,
@@ -568,7 +597,7 @@ class Main(cmd.Cmd):
568
597
  )
569
598
 
570
599
  elif provider == "koboldai":
571
- from webscout.AI import KOBOLDAI
600
+ from webscout import KOBOLDAI
572
601
 
573
602
  self.bot = KOBOLDAI(
574
603
  is_conversation=disable_conversation,
@@ -584,7 +613,7 @@ class Main(cmd.Cmd):
584
613
  act=awesome_prompt,
585
614
  )
586
615
  elif provider == "xjai":
587
- from webscout.AI import Xjai
616
+ from webscout import Xjai
588
617
 
589
618
  self.bot = Xjai(
590
619
  is_conversation=disable_conversation,
@@ -601,7 +630,7 @@ class Main(cmd.Cmd):
601
630
  )
602
631
 
603
632
  elif provider == "gemini":
604
- from webscout.AI import GEMINI
633
+ from webscout import GEMINI
605
634
 
606
635
  assert auth, (
607
636
  "Path to gemini.google.com.cookies.json file is required. "
@@ -614,7 +643,7 @@ class Main(cmd.Cmd):
614
643
  )
615
644
 
616
645
  elif provider == "phind":
617
- from webscout.AI import PhindSearch
646
+ from webscout import PhindSearch
618
647
 
619
648
  self.bot = PhindSearch(
620
649
  is_conversation=disable_conversation,
@@ -632,7 +661,7 @@ class Main(cmd.Cmd):
632
661
 
633
662
  elif provider == "blackboxai":
634
663
 
635
- from webscout.AI import BLACKBOXAI
664
+ from webscout import BLACKBOXAI
636
665
 
637
666
  self.bot = BLACKBOXAI(
638
667
  is_conversation=disable_conversation,
@@ -647,7 +676,7 @@ class Main(cmd.Cmd):
647
676
  )
648
677
  elif provider == "you":
649
678
 
650
- from webscout.AI import YouChat
679
+ from webscout import YouChat
651
680
 
652
681
  self.bot = YouChat(
653
682
  is_conversation=disable_conversation,
@@ -683,7 +712,7 @@ class Main(cmd.Cmd):
683
712
 
684
713
 
685
714
  elif provider == "perplexity":
686
- from webscout.AI import PERPLEXITY
715
+ from webscout import PERPLEXITY
687
716
 
688
717
  self.bot = PERPLEXITY(
689
718
  is_conversation=disable_conversation,
@@ -725,7 +754,13 @@ class Main(cmd.Cmd):
725
754
  self.__init_time = time.time()
726
755
  self.__start_time = time.time()
727
756
  self.__end_time = time.time()
728
-
757
+
758
+ @property
759
+ def get_provider(self):
760
+ if self.provider == "auto" and self.bot.provider_name is not None:
761
+ return self.bot.provider_name
762
+ else:
763
+ return self.provider
729
764
  @property
730
765
  def prompt(self):
731
766
  current_time = datetime.datetime.now().strftime("%H:%M:%S")
@@ -740,7 +775,7 @@ class Main(cmd.Cmd):
740
775
  if not self.disable_coloring:
741
776
  cmd_prompt = (
742
777
  f"╭─[`{Fore.GREEN}{getpass.getuser().capitalize()}@webai]`"
743
- f"(`{Fore.YELLOW}{self.provider})`"
778
+ f"(`{Fore.YELLOW}{self.get_provider})`"
744
779
  f"~[`{Fore.LIGHTWHITE_EX}⏰{Fore.MAGENTA}{current_time}-`"
745
780
  f"{Fore.LIGHTWHITE_EX}💻{Fore.BLUE}{find_range(self.__init_time, time.time(), True)}-`"
746
781
  f"{Fore.LIGHTWHITE_EX}⚡️{Fore.RED}{find_range(self.__start_time, self.__end_time)}s]`"
@@ -753,7 +788,7 @@ class Main(cmd.Cmd):
753
788
 
754
789
  else:
755
790
  return (
756
- f"╭─[{getpass.getuser().capitalize()}@webscout]({self.provider})"
791
+ f"╭─[{getpass.getuser().capitalize()}@webscout]({self.get_provider})"
757
792
  f"~[⏰{current_time}"
758
793
  f"-💻{find_range(self.__init_time, time.time(), True)}"
759
794
  f"-⚡️{find_range(self.__start_time, self.__end_time)}s]"
@@ -1125,7 +1160,7 @@ class Main(cmd.Cmd):
1125
1160
  busy_bar.stop_spinning()
1126
1161
  this.stream_output(
1127
1162
  generated_response,
1128
- title="AI Response",
1163
+ title="Webscout",
1129
1164
  is_markdown=self.prettify,
1130
1165
  style=Style(
1131
1166
  color=self.color,
@@ -4,12 +4,6 @@ from threading import Thread
4
4
  import sys
5
5
  from types import TracebackType
6
6
  from typing import Any, Awaitable, Dict, Optional, Type, Union
7
- if sys.platform == 'win32':
8
- try:
9
- asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
10
- except AttributeError:
11
- # If WindowsSelectorEventLoopPolicy is not available, do nothing
12
- pass
13
7
  from .webscout_search_async import AsyncWEBS
14
8
 
15
9
 
@@ -24,7 +18,7 @@ class WEBS(AsyncWEBS):
24
18
  proxies: Union[Dict[str, str], str, None] = None, # deprecated
25
19
  timeout: Optional[int] = 10,
26
20
  ) -> None:
27
- """Initialize the DDGS object.
21
+ """Initialize the WEBS object.
28
22
 
29
23
  Args:
30
24
  headers (dict, optional): Dictionary of headers for the HTTP client. Defaults to None.
@@ -81,4 +75,4 @@ class WEBS(AsyncWEBS):
81
75
  return self._run_async_in_thread(super().maps(*args, **kwargs))
82
76
 
83
77
  def translate(self, *args: Any, **kwargs: Any) -> Any:
84
- return self._run_async_in_thread(super().translate(*args, **kwargs))
78
+ return self._run_async_in_thread(super().translate(*args, **kwargs))