webscout 1.4.1__tar.gz → 1.4.3__tar.gz

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.

Files changed (44) hide show
  1. {webscout-1.4.1 → webscout-1.4.3}/PKG-INFO +51 -34
  2. {webscout-1.4.1 → webscout-1.4.3}/README.md +48 -32
  3. {webscout-1.4.1 → webscout-1.4.3}/setup.py +4 -3
  4. {webscout-1.4.1 → webscout-1.4.3}/webscout/AI.py +294 -185
  5. {webscout-1.4.1 → webscout-1.4.3}/webscout/AIutel.py +2 -0
  6. {webscout-1.4.1 → webscout-1.4.3}/webscout/__init__.py +4 -2
  7. {webscout-1.4.1 → webscout-1.4.3}/webscout/g4f.py +1 -1
  8. webscout-1.4.3/webscout/version.py +2 -0
  9. {webscout-1.4.1 → webscout-1.4.3}/webscout/webai.py +31 -15
  10. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/PKG-INFO +51 -34
  11. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/requires.txt +1 -0
  12. webscout-1.4.1/webscout/version.py +0 -2
  13. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/__init__.py +0 -0
  14. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/documents/__init__.py +0 -0
  15. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/documents/query_results_extractor.py +0 -0
  16. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/documents/webpage_content_extractor.py +0 -0
  17. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/networks/__init__.py +0 -0
  18. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/networks/filepath_converter.py +0 -0
  19. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/networks/google_searcher.py +0 -0
  20. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/networks/network_configs.py +0 -0
  21. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/networks/webpage_fetcher.py +0 -0
  22. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/utilsdw/__init__.py +0 -0
  23. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/utilsdw/enver.py +0 -0
  24. {webscout-1.4.1 → webscout-1.4.3}/DeepWEBS/utilsdw/logger.py +0 -0
  25. {webscout-1.4.1 → webscout-1.4.3}/LICENSE.md +0 -0
  26. {webscout-1.4.1 → webscout-1.4.3}/setup.cfg +0 -0
  27. {webscout-1.4.1 → webscout-1.4.3}/webscout/AIbase.py +0 -0
  28. {webscout-1.4.1 → webscout-1.4.3}/webscout/DWEBS.py +0 -0
  29. {webscout-1.4.1 → webscout-1.4.3}/webscout/LLM.py +0 -0
  30. {webscout-1.4.1 → webscout-1.4.3}/webscout/__main__.py +0 -0
  31. {webscout-1.4.1 → webscout-1.4.3}/webscout/async_providers.py +0 -0
  32. {webscout-1.4.1 → webscout-1.4.3}/webscout/cli.py +0 -0
  33. {webscout-1.4.1 → webscout-1.4.3}/webscout/exceptions.py +0 -0
  34. {webscout-1.4.1 → webscout-1.4.3}/webscout/models.py +0 -0
  35. {webscout-1.4.1 → webscout-1.4.3}/webscout/tempid.py +0 -0
  36. {webscout-1.4.1 → webscout-1.4.3}/webscout/transcriber.py +0 -0
  37. {webscout-1.4.1 → webscout-1.4.3}/webscout/utils.py +0 -0
  38. {webscout-1.4.1 → webscout-1.4.3}/webscout/voice.py +0 -0
  39. {webscout-1.4.1 → webscout-1.4.3}/webscout/webscout_search.py +0 -0
  40. {webscout-1.4.1 → webscout-1.4.3}/webscout/webscout_search_async.py +0 -0
  41. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/SOURCES.txt +0 -0
  42. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/dependency_links.txt +0 -0
  43. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/entry_points.txt +0 -0
  44. {webscout-1.4.1 → webscout-1.4.3}/webscout.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webscout
3
- Version: 1.4.1
4
- Summary: Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
3
+ Version: 1.4.3
4
+ Summary: 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)
5
5
  Author: OEvortex
6
6
  Author-email: helpingai5@gmail.com
7
7
  License: HelpingAI Simplified Universal License
@@ -49,6 +49,7 @@ Requires-Dist: orjson
49
49
  Requires-Dist: PyYAML
50
50
  Requires-Dist: appdirs
51
51
  Requires-Dist: GoogleBard1>=2.1.4
52
+ Requires-Dist: tls_client
52
53
  Provides-Extra: dev
53
54
  Requires-Dist: ruff>=0.1.6; extra == "dev"
54
55
  Requires-Dist: pytest>=7.4.2; extra == "dev"
@@ -94,9 +95,8 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
94
95
  - [usage of webscout.AI](#usage-of-webscoutai)
95
96
  - [1. `PhindSearch` - Search using Phind.com](#1-phindsearch---search-using-phindcom)
96
97
  - [2. `YepChat` - Chat with mistral 8x7b powered by yepchat](#2-yepchat---chat-with-mistral-8x7b-powered-by-yepchat)
97
- - [3. `You.com` - search with you.com -NOT WORKING](#3-youcom---search-with-youcom--not-working)
98
+ - [3. `You.com` - search/chat with you.com](#3-youcom---searchchat-with-youcom)
98
99
  - [4. `Gemini` - search with google gemini](#4-gemini---search-with-google-gemini)
99
- - [usage of image generator from Webscout.AI](#usage-of-image-generator-from-webscoutai)
100
100
  - [5. `Prodia` - make image using prodia](#5-prodia---make-image-using-prodia)
101
101
  - [6. `BlackBox` - Search/chat With BlackBox](#6-blackbox---searchchat-with-blackbox)
102
102
  - [7. `PERPLEXITY` - Search With PERPLEXITY](#7-perplexity---search-with-perplexity)
@@ -104,6 +104,7 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
104
104
  - [9. `KOBOLDIA` -](#9-koboldia--)
105
105
  - [10. `Reka` - chat with reka](#10-reka---chat-with-reka)
106
106
  - [11. `Cohere` - chat with cohere](#11-cohere---chat-with-cohere)
107
+ - [12. `Xjai` - chat with free gpt 3.5](#12-xjai---chat-with-free-gpt-35)
107
108
  - [`LLM`](#llm)
108
109
  - [`LLM` with internet](#llm-with-internet)
109
110
  - [LLM with deepwebs](#llm-with-deepwebs)
@@ -684,27 +685,31 @@ print(r)
684
685
 
685
686
  ```
686
687
 
687
- ### 3. `You.com` - search with you.com -NOT WORKING
688
+ ### 3. `You.com` - search/chat with you.com
688
689
  ```python
689
- from webscout.AI import youChat
690
690
 
691
- # Instantiate the youchat class
692
- youChat = youChat()
691
+ from webscout.AI import YouChat
692
+ from rich import print
693
693
 
694
- while True:
695
- # Ask the user for a prompt
696
- prompt = input("💡 Enter a prompt (or type 'exit' to quit): ")
697
-
698
- # Exit condition
699
- if prompt.lower() == 'exit':
700
- break
701
-
702
- # Generate a completion based on the prompt
703
- try:
704
- completion = youChat.create(prompt)
705
- print("💬:", completion)
706
- except Exception as e:
707
- print("⚠️ An error occurred:", e)
694
+ ai = YouChat(
695
+ is_conversation=True,
696
+ max_tokens=800,
697
+ timeout=30,
698
+ intro=None,
699
+ filepath=None,
700
+ update_file=True,
701
+ proxies={},
702
+ history_offset=10250,
703
+ act=None,
704
+ )
705
+
706
+ prompt = "what is meaning of life"
707
+
708
+ response = ai.ask(prompt)
709
+
710
+ # Extract and print the message from the response
711
+ message = ai.get_message(response)
712
+ print(message)
708
713
  ```
709
714
 
710
715
  ### 4. `Gemini` - search with google gemini
@@ -728,19 +733,7 @@ gemini = GEMINI(cookie_file=COOKIE_FILE, proxy=PROXIES)
728
733
  # Ask a question and print the response
729
734
  response = gemini.chat("What is the meaning of life?")
730
735
  print(response)
731
-
732
- # Ask another question, this time streaming the response
733
- for chunk in gemini.chat("Tell me a story", stream=True):
734
- print(chunk, end="")
735
-
736
- # Reset the conversation to start a new interaction
737
- gemini.reset()
738
-
739
- # Ask a question with the code optimizer
740
- response = gemini.chat("Write Python code to print 'Hello, world!'", optimizer="code")
741
- print(response)
742
736
  ```
743
- ## usage of image generator from Webscout.AI
744
737
  ### 5. `Prodia` - make image using prodia
745
738
  ```python
746
739
  from webscout.AI import Prodia
@@ -846,6 +839,30 @@ response_str = a.chat(prompt)
846
839
  print(response_str)
847
840
  ```
848
841
 
842
+ ### 12. `Xjai` - chat with free gpt 3.5
843
+ Gratitude to [Devs do Code](http://www.youtube.com/@DevsDoCode) for their assistance.
844
+ ```python
845
+ from webscout.AI import Xjai
846
+ from rich import print
847
+
848
+ ai = Xjai(
849
+ is_conversation=True,
850
+ max_tokens=800,
851
+ timeout=30,
852
+ intro=None,
853
+ filepath=None,
854
+ update_file=True,
855
+ proxies={},
856
+ history_offset=10250,
857
+ act=None,
858
+ )
859
+
860
+ prompt = "Tell me about india"
861
+
862
+ response = ai.chat(prompt)
863
+ print(response)
864
+ ```
865
+
849
866
  ### `LLM`
850
867
  ```python
851
868
  from webscout.LLM import LLM
@@ -39,9 +39,8 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
39
39
  - [usage of webscout.AI](#usage-of-webscoutai)
40
40
  - [1. `PhindSearch` - Search using Phind.com](#1-phindsearch---search-using-phindcom)
41
41
  - [2. `YepChat` - Chat with mistral 8x7b powered by yepchat](#2-yepchat---chat-with-mistral-8x7b-powered-by-yepchat)
42
- - [3. `You.com` - search with you.com -NOT WORKING](#3-youcom---search-with-youcom--not-working)
42
+ - [3. `You.com` - search/chat with you.com](#3-youcom---searchchat-with-youcom)
43
43
  - [4. `Gemini` - search with google gemini](#4-gemini---search-with-google-gemini)
44
- - [usage of image generator from Webscout.AI](#usage-of-image-generator-from-webscoutai)
45
44
  - [5. `Prodia` - make image using prodia](#5-prodia---make-image-using-prodia)
46
45
  - [6. `BlackBox` - Search/chat With BlackBox](#6-blackbox---searchchat-with-blackbox)
47
46
  - [7. `PERPLEXITY` - Search With PERPLEXITY](#7-perplexity---search-with-perplexity)
@@ -49,6 +48,7 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
49
48
  - [9. `KOBOLDIA` -](#9-koboldia--)
50
49
  - [10. `Reka` - chat with reka](#10-reka---chat-with-reka)
51
50
  - [11. `Cohere` - chat with cohere](#11-cohere---chat-with-cohere)
51
+ - [12. `Xjai` - chat with free gpt 3.5](#12-xjai---chat-with-free-gpt-35)
52
52
  - [`LLM`](#llm)
53
53
  - [`LLM` with internet](#llm-with-internet)
54
54
  - [LLM with deepwebs](#llm-with-deepwebs)
@@ -629,27 +629,31 @@ print(r)
629
629
 
630
630
  ```
631
631
 
632
- ### 3. `You.com` - search with you.com -NOT WORKING
632
+ ### 3. `You.com` - search/chat with you.com
633
633
  ```python
634
- from webscout.AI import youChat
635
634
 
636
- # Instantiate the youchat class
637
- youChat = youChat()
635
+ from webscout.AI import YouChat
636
+ from rich import print
638
637
 
639
- while True:
640
- # Ask the user for a prompt
641
- prompt = input("💡 Enter a prompt (or type 'exit' to quit): ")
642
-
643
- # Exit condition
644
- if prompt.lower() == 'exit':
645
- break
646
-
647
- # Generate a completion based on the prompt
648
- try:
649
- completion = youChat.create(prompt)
650
- print("💬:", completion)
651
- except Exception as e:
652
- print("⚠️ An error occurred:", e)
638
+ ai = YouChat(
639
+ is_conversation=True,
640
+ max_tokens=800,
641
+ timeout=30,
642
+ intro=None,
643
+ filepath=None,
644
+ update_file=True,
645
+ proxies={},
646
+ history_offset=10250,
647
+ act=None,
648
+ )
649
+
650
+ prompt = "what is meaning of life"
651
+
652
+ response = ai.ask(prompt)
653
+
654
+ # Extract and print the message from the response
655
+ message = ai.get_message(response)
656
+ print(message)
653
657
  ```
654
658
 
655
659
  ### 4. `Gemini` - search with google gemini
@@ -673,19 +677,7 @@ gemini = GEMINI(cookie_file=COOKIE_FILE, proxy=PROXIES)
673
677
  # Ask a question and print the response
674
678
  response = gemini.chat("What is the meaning of life?")
675
679
  print(response)
676
-
677
- # Ask another question, this time streaming the response
678
- for chunk in gemini.chat("Tell me a story", stream=True):
679
- print(chunk, end="")
680
-
681
- # Reset the conversation to start a new interaction
682
- gemini.reset()
683
-
684
- # Ask a question with the code optimizer
685
- response = gemini.chat("Write Python code to print 'Hello, world!'", optimizer="code")
686
- print(response)
687
680
  ```
688
- ## usage of image generator from Webscout.AI
689
681
  ### 5. `Prodia` - make image using prodia
690
682
  ```python
691
683
  from webscout.AI import Prodia
@@ -791,6 +783,30 @@ response_str = a.chat(prompt)
791
783
  print(response_str)
792
784
  ```
793
785
 
786
+ ### 12. `Xjai` - chat with free gpt 3.5
787
+ Gratitude to [Devs do Code](http://www.youtube.com/@DevsDoCode) for their assistance.
788
+ ```python
789
+ from webscout.AI import Xjai
790
+ from rich import print
791
+
792
+ ai = Xjai(
793
+ is_conversation=True,
794
+ max_tokens=800,
795
+ timeout=30,
796
+ intro=None,
797
+ filepath=None,
798
+ update_file=True,
799
+ proxies={},
800
+ history_offset=10250,
801
+ act=None,
802
+ )
803
+
804
+ prompt = "Tell me about india"
805
+
806
+ response = ai.chat(prompt)
807
+ print(response)
808
+ ```
809
+
794
810
  ### `LLM`
795
811
  ```python
796
812
  from webscout.LLM import LLM
@@ -5,8 +5,8 @@ with open("README.md", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="webscout",
8
- version="1.4.1",
9
- description="Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support",
8
+ version="1.4.3",
9
+ description="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)",
10
10
  long_description=README,
11
11
  long_description_content_type="text/markdown",
12
12
  author="OEvortex",
@@ -52,7 +52,8 @@ setup(
52
52
  "orjson",
53
53
  "PyYAML",
54
54
  "appdirs",
55
- "GoogleBard1>=2.1.4"
55
+ "GoogleBard1>=2.1.4",
56
+ "tls_client",
56
57
  ],
57
58
  entry_points={
58
59
  "console_scripts": [
@@ -1,4 +1,5 @@
1
1
  import time
2
+ import uuid
2
3
  from selenium import webdriver
3
4
  from selenium.webdriver.chrome.options import Options
4
5
  from selenium.webdriver.common.by import By
@@ -27,6 +28,206 @@ from webscout import exceptions
27
28
  from typing import Any, AsyncGenerator
28
29
  import logging
29
30
  import httpx
31
+ #-----------------------------------------------xjai-------------------------------------------
32
+ class Xjai(Provider):
33
+ def __init__(
34
+ self,
35
+ is_conversation: bool = True,
36
+ max_tokens: int = 600,
37
+ temperature: float = 0.8,
38
+ top_p: float = 1,
39
+ timeout: int = 30,
40
+ intro: str = None,
41
+ filepath: str = None,
42
+ update_file: bool = True,
43
+ proxies: dict = {},
44
+ history_offset: int = 10250,
45
+ act: str = None,
46
+ ):
47
+ """
48
+ Initializes the Xjai class for interacting with the Xjai AI chat API.
49
+
50
+ Args:
51
+ is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
52
+ max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
53
+ temperature (float, optional): The creativity level of the AI's response. Defaults to 0.8.
54
+ top_p (float, optional): The probability threshold for token selection. Defaults to 1.
55
+ timeout (int, optional): Http request timeout. Defaults to 30.
56
+ intro (str, optional): Conversation introductory prompt. Defaults to None.
57
+ filepath (str, optional): Path to file containing conversation history. Defaults to None.
58
+ update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
59
+ proxies (dict, optional): Http request proxies. Defaults to {}.
60
+ history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
61
+ act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
62
+ """
63
+ self.session = requests.Session()
64
+ self.is_conversation = is_conversation
65
+ self.max_tokens_to_sample = max_tokens
66
+ self.temperature = temperature
67
+ self.top_p = top_p
68
+ self.chat_endpoint = "https://p1api.xjai.pro/freeapi/chat-process"
69
+ self.stream_chunk_size = 1 # Process response line by line
70
+ self.timeout = timeout
71
+ self.last_response = {}
72
+
73
+ self.__available_optimizers = (
74
+ method
75
+ for method in dir(Optimizers)
76
+ if callable(getattr(Optimizers, method)) and not method.startswith("__")
77
+ )
78
+ Conversation.intro = (
79
+ AwesomePrompts().get_act(
80
+ act, raise_not_found=True, default=None, case_insensitive=True
81
+ )
82
+ if act
83
+ else intro or Conversation.intro
84
+ )
85
+ self.conversation = Conversation(
86
+ is_conversation, self.max_tokens_to_sample, filepath, update_file
87
+ )
88
+ self.conversation.history_offset = history_offset
89
+ self.session.proxies = proxies
90
+
91
+ def ask(
92
+ self,
93
+ prompt: str,
94
+ stream: bool = False,
95
+ raw: bool = False,
96
+ optimizer: str = None,
97
+ conversationally: bool = False,
98
+ ) -> Any:
99
+ """
100
+ Sends a chat request to the Xjai AI chat API and returns the response.
101
+
102
+ Args:
103
+ prompt (str): The query to send to the AI.
104
+ stream (bool, optional): Flag for streaming response. Defaults to False.
105
+ raw (bool, optional): Stream back raw response as received. Defaults to False.
106
+ optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
107
+ conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
108
+
109
+ Returns:
110
+ Any: The response from the AI, either as a dictionary or a generator
111
+ depending on the `stream` and `raw` parameters.
112
+ """
113
+ conversation_prompt = self.conversation.gen_complete_prompt(prompt)
114
+ if optimizer:
115
+ if optimizer in self.__available_optimizers:
116
+ conversation_prompt = getattr(Optimizers, optimizer)(
117
+ conversation_prompt if conversationally else prompt
118
+ )
119
+ else:
120
+ raise Exception(
121
+ f"Optimizer is not one of {self.__available_optimizers}"
122
+ )
123
+
124
+ headers = {
125
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
126
+ "(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
127
+ }
128
+
129
+ payload = {
130
+ "prompt": conversation_prompt + "\n\nReply in English Only",
131
+ "systemMessage": "Reply in English Only",
132
+ "temperature": self.temperature,
133
+ "top_p": self.top_p
134
+ }
135
+
136
+ def generate_response():
137
+ response = self.session.post(
138
+ self.chat_endpoint, headers=headers, json=payload, stream=True, timeout=self.timeout
139
+ )
140
+ output = ""
141
+ print_next = False
142
+
143
+ for line in response.iter_lines(decode_unicode=True, chunk_size=self.stream_chunk_size):
144
+ line_content = line.decode("utf-8")
145
+ # Filter out irrelevant content
146
+ if '[ChatAI](https://srv.aiflarepro.com/#/?cid=4111)' in line_content:
147
+ continue
148
+ if '&KFw6loC9Qvy&' in line_content:
149
+ parts = line_content.split('&KFw6loC9Qvy&')
150
+ if print_next:
151
+ output += parts[0]
152
+ print_next = False
153
+ else:
154
+ output += parts[1]
155
+ print_next = True
156
+ if len(parts) > 2:
157
+ print_next = False
158
+ elif print_next:
159
+ output += line_content + '\n'
160
+
161
+ # Update chat history
162
+ self.conversation.update_chat_history(prompt, output)
163
+
164
+ return output
165
+
166
+ def for_stream():
167
+ response = generate_response()
168
+ for line in response.splitlines():
169
+ yield line if raw else dict(text=line)
170
+
171
+ def for_non_stream():
172
+ response = generate_response()
173
+ return response if raw else dict(text=response)
174
+
175
+ return for_stream() if stream else for_non_stream()
176
+
177
+ def chat(
178
+ self,
179
+ prompt: str,
180
+ stream: bool = False,
181
+ optimizer: str = None,
182
+ conversationally: bool = False,
183
+ ) -> Any:
184
+ """
185
+ Generates a response from the Xjai AI chat API.
186
+
187
+ Args:
188
+ prompt (str): The query to send to the AI.
189
+ stream (bool, optional): Flag for streaming response. Defaults to False.
190
+ optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
191
+ conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
192
+
193
+ Returns:
194
+ Any: The response from the AI, either as a string or a generator
195
+ depending on the `stream` parameter.
196
+ """
197
+
198
+ def for_stream():
199
+ for response in self.ask(
200
+ prompt, True, optimizer=optimizer, conversationally=conversationally
201
+ ):
202
+ yield self.get_message(response)
203
+
204
+ def for_non_stream():
205
+ return self.get_message(
206
+ self.ask(
207
+ prompt,
208
+ False,
209
+ optimizer=optimizer,
210
+ conversationally=conversationally,
211
+ )
212
+ )
213
+
214
+ return for_stream() if stream else for_non_stream()
215
+
216
+ def get_message(self, response: Any) -> str:
217
+ """
218
+ Retrieves the message from the AI's response.
219
+
220
+ Args:
221
+ response (Any): The response from the AI, either a dictionary
222
+ or a raw string.
223
+
224
+ Returns:
225
+ str: The extracted message from the AI's response.
226
+ """
227
+ if isinstance(response, dict):
228
+ return response["text"]
229
+ else: # Assume raw string
230
+ return response
30
231
  #-----------------------------------------------llama 3-------------------------------------------
31
232
  class LLAMA2(Provider):
32
233
  def __init__(
@@ -4373,8 +4574,6 @@ class YEPCHAT(Provider):
4373
4574
  return response["choices"][0]["message"]["content"]
4374
4575
  except KeyError:
4375
4576
  return ""
4376
-
4377
-
4378
4577
  class AsyncYEPCHAT(AsyncProvider):
4379
4578
  def __init__(
4380
4579
  self,
@@ -4598,16 +4797,13 @@ class AsyncYEPCHAT(AsyncProvider):
4598
4797
  return response["choices"][0]["message"]["content"]
4599
4798
  except KeyError:
4600
4799
  return ""
4601
- class AsyncYEPCHAT(AsyncProvider):
4800
+
4801
+ #-------------------------------------------------------youchat--------------------------------------------------------
4802
+ class YouChat(Provider):
4602
4803
  def __init__(
4603
4804
  self,
4604
4805
  is_conversation: bool = True,
4605
4806
  max_tokens: int = 600,
4606
- temperature: float = 0.6,
4607
- presence_penalty: int = 0,
4608
- frequency_penalty: int = 0,
4609
- top_p: float = 0.7,
4610
- model: str = "Mixtral-8x7B-Instruct-v0.1",
4611
4807
  timeout: int = 30,
4612
4808
  intro: str = None,
4613
4809
  filepath: str = None,
@@ -4616,43 +4812,34 @@ class AsyncYEPCHAT(AsyncProvider):
4616
4812
  history_offset: int = 10250,
4617
4813
  act: str = None,
4618
4814
  ):
4619
- """Instantiates YEPCHAT
4620
-
4621
- Args:
4622
- is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
4623
- max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
4624
- temperature (float, optional): Charge of the generated text's randomness. Defaults to 0.6.
4625
- presence_penalty (int, optional): Chances of topic being repeated. Defaults to 0.
4626
- frequency_penalty (int, optional): Chances of word being repeated. Defaults to 0.
4627
- top_p (float, optional): Sampling threshold during inference time. Defaults to 0.7.
4628
- model (str, optional): LLM model name. Defaults to "gpt-3.5-turbo".
4629
- timeout (int, optional): Http request timeout. Defaults to 30.
4630
- intro (str, optional): Conversation introductory prompt. Defaults to None.
4631
- filepath (str, optional): Path to file containing conversation history. Defaults to None.
4632
- update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
4633
- proxies (dict, optional): Http request proxies. Defaults to {}.
4634
- history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
4635
- act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
4636
- """
4815
+ self.session = requests.Session()
4637
4816
  self.is_conversation = is_conversation
4638
4817
  self.max_tokens_to_sample = max_tokens
4639
- self.model = model
4640
- self.temperature = temperature
4641
- self.presence_penalty = presence_penalty
4642
- self.frequency_penalty = frequency_penalty
4643
- self.top_p = top_p
4644
- self.chat_endpoint = "https://api.yep.com/v1/chat/completions"
4818
+ self.chat_endpoint = "https://you.com/api/streamingSearch"
4645
4819
  self.stream_chunk_size = 64
4646
4820
  self.timeout = timeout
4647
4821
  self.last_response = {}
4822
+
4823
+ self.payload = {
4824
+ "q": "",
4825
+ "page": 1,
4826
+ "count": 10,
4827
+ "safeSearch": "Off",
4828
+ "onShoppingPage": False,
4829
+ "mkt": "",
4830
+ "responseFilter": "WebPages,Translations,TimeZone,Computation,RelatedSearches",
4831
+ "domain": "youchat",
4832
+ "queryTraceId": uuid.uuid4(),
4833
+ "conversationTurnId": uuid.uuid4(),
4834
+ "pastChatLength": 0,
4835
+ "selectedChatMode": "default",
4836
+ "chat": "[]",
4837
+ }
4838
+
4648
4839
  self.headers = {
4649
- "Accept": "*/*",
4650
- "Accept-Encoding": "gzip, deflate",
4651
- "Accept-Language": "en-US,en;q=0.9",
4652
- "Content-Type": "application/json; charset=utf-8",
4653
- "Origin": "https://yep.com",
4654
- "Referer": "https://yep.com/",
4655
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
4840
+ "cache-control": "no-cache",
4841
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
4842
+ 'Referer': f'https://you.com/search?q={self.payload["q"]}&fromSearchBar=true&tbm=youchat&chatMode=default'
4656
4843
  }
4657
4844
 
4658
4845
  self.__available_optimizers = (
@@ -4660,6 +4847,7 @@ class AsyncYEPCHAT(AsyncProvider):
4660
4847
  for method in dir(Optimizers)
4661
4848
  if callable(getattr(Optimizers, method)) and not method.startswith("__")
4662
4849
  )
4850
+ self.session.headers.update(self.headers)
4663
4851
  Conversation.intro = (
4664
4852
  AwesomePrompts().get_act(
4665
4853
  act, raise_not_found=True, default=None, case_insensitive=True
@@ -4671,12 +4859,9 @@ class AsyncYEPCHAT(AsyncProvider):
4671
4859
  is_conversation, self.max_tokens_to_sample, filepath, update_file
4672
4860
  )
4673
4861
  self.conversation.history_offset = history_offset
4674
- self.session = httpx.AsyncClient(
4675
- headers=self.headers,
4676
- proxies=proxies,
4677
- )
4862
+ self.session.proxies = proxies
4678
4863
 
4679
- async def ask(
4864
+ def ask(
4680
4865
  self,
4681
4866
  prompt: str,
4682
4867
  stream: bool = False,
@@ -4684,35 +4869,6 @@ class AsyncYEPCHAT(AsyncProvider):
4684
4869
  optimizer: str = None,
4685
4870
  conversationally: bool = False,
4686
4871
  ) -> dict:
4687
- """Chat with AI asynchronously.
4688
-
4689
- Args:
4690
- prompt (str): Prompt to be send.
4691
- stream (bool, optional): Flag for streaming response. Defaults to False.
4692
- raw (bool, optional): Stream back raw response as received. Defaults to False.
4693
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
4694
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
4695
- Returns:
4696
- dict : {}
4697
- ```json
4698
- {
4699
- "id": "cmpl-c61c1c88de4e4ad3a79134775d17ea0c",
4700
- "object": "chat.completion.chunk",
4701
- "created": 1713876886,
4702
- "model": "Mixtral-8x7B-Instruct-v0.1",
4703
- "choices": [
4704
- {
4705
- "index": 0,
4706
- "delta": {
4707
- "role": null,
4708
- "content": " Sure, I can help with that. Are you looking for information on how to start coding, or do you need help with a specific coding problem? We can discuss various programming languages like Python, JavaScript, Java, C++, or others. Please provide more details so I can assist you better."
4709
- },
4710
- "finish_reason": null
4711
- }
4712
- ]
4713
- }
4714
- ```
4715
- """
4716
4872
  conversation_prompt = self.conversation.gen_complete_prompt(prompt)
4717
4873
  if optimizer:
4718
4874
  if optimizer in self.__available_optimizers:
@@ -4723,58 +4879,60 @@ class AsyncYEPCHAT(AsyncProvider):
4723
4879
  raise Exception(
4724
4880
  f"Optimizer is not one of {self.__available_optimizers}"
4725
4881
  )
4726
- payload = {
4727
- "stream": True,
4728
- "max_tokens": 1280,
4729
- "top_p": self.top_p,
4730
- "temperature": self.temperature,
4731
- "messages": [{"content": conversation_prompt, "role": "user"}],
4732
- "model": self.model,
4733
- }
4882
+ self.session.headers.update(self.headers)
4883
+ self.session.headers.update(
4884
+ dict(
4885
+ cookie=f"safesearch_guest=Off; uuid_guest={str(uuid4())}",
4886
+ )
4887
+ )
4888
+ self.payload["q"] = prompt
4734
4889
 
4735
- async def for_stream():
4736
- async with self.session.stream(
4737
- "POST", self.chat_endpoint, json=payload, timeout=self.timeout
4738
- ) as response:
4739
- if not response.is_success:
4740
- raise exceptions.FailedToGenerateResponseError(
4741
- f"Failed to generate response - ({response.status_code}, {response.reason_phrase}) - {response.text}"
4742
- )
4890
+ def for_stream():
4891
+ response = self.session.get(
4892
+ self.chat_endpoint,
4893
+ params=self.payload,
4894
+ stream=True,
4895
+ timeout=self.timeout,
4896
+ )
4743
4897
 
4744
- message_load = ""
4745
- async for value in response.aiter_lines():
4746
- try:
4747
- resp = sanitize_stream(value)
4748
- incomplete_message = await self.get_message(resp)
4749
- if incomplete_message:
4750
- message_load += incomplete_message
4751
- resp["choices"][0]["delta"]["content"] = message_load
4752
- self.last_response.update(resp)
4753
- yield value if raw else resp
4754
- elif raw:
4755
- yield value
4756
- except json.decoder.JSONDecodeError:
4757
- pass
4898
+ if not response.ok:
4899
+ raise exceptions.FailedToGenerateResponseError(
4900
+ f"Failed to generate response - ({response.status_code}, {response.reason})"
4901
+ )
4758
4902
 
4903
+ streaming_response = ""
4904
+ for line in response.iter_lines(decode_unicode=True, chunk_size=64):
4905
+ if line:
4906
+ modified_value = re.sub("data:", "", line)
4907
+ try:
4908
+ json_modified_value = json.loads(modified_value)
4909
+ if "youChatToken" in json_modified_value:
4910
+ streaming_response += json_modified_value["youChatToken"]
4911
+ if print:
4912
+ print(json_modified_value["youChatToken"], end="")
4913
+ except:
4914
+ continue
4915
+ self.last_response.update(dict(text=streaming_response))
4759
4916
  self.conversation.update_chat_history(
4760
- prompt, await self.get_message(self.last_response)
4917
+ prompt, self.get_message(self.last_response)
4761
4918
  )
4919
+ return streaming_response
4762
4920
 
4763
- async def for_non_stream():
4764
- async for _ in for_stream():
4921
+ def for_non_stream():
4922
+ for _ in for_stream():
4765
4923
  pass
4766
4924
  return self.last_response
4767
4925
 
4768
- return for_stream() if stream else await for_non_stream()
4926
+ return for_stream() if stream else for_non_stream()
4769
4927
 
4770
- async def chat(
4928
+ def chat(
4771
4929
  self,
4772
4930
  prompt: str,
4773
4931
  stream: bool = False,
4774
4932
  optimizer: str = None,
4775
4933
  conversationally: bool = False,
4776
4934
  ) -> str:
4777
- """Generate response `str` asynchronously.
4935
+ """Generate response `str`
4778
4936
  Args:
4779
4937
  prompt (str): Prompt to be send.
4780
4938
  stream (bool, optional): Flag for streaming response. Defaults to False.
@@ -4784,17 +4942,32 @@ class AsyncYEPCHAT(AsyncProvider):
4784
4942
  str: Response generated
4785
4943
  """
4786
4944
 
4787
- async def for_stream():
4788
- async_ask = await self.ask(
4789
- prompt, True, optimizer=optimizer, conversationally=conversationally
4790
- )
4945
+ def chat(
4946
+ self,
4947
+ prompt: str,
4948
+ stream: bool = False,
4949
+ optimizer: str = None,
4950
+ conversationally: bool = False,
4951
+ ) -> str:
4952
+ """Generate response `str`
4953
+ Args:
4954
+ prompt (str): Prompt to be send.
4955
+ stream (bool, optional): Flag for streaming response. Defaults to False.
4956
+ optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
4957
+ conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
4958
+ Returns:
4959
+ str: Response generated
4960
+ """
4791
4961
 
4792
- async for response in async_ask:
4793
- yield await self.get_message(response)
4962
+ def for_stream():
4963
+ for response in self.ask(
4964
+ prompt, True, optimizer=optimizer, conversationally=conversationally
4965
+ ):
4966
+ yield self.get_message(response)
4794
4967
 
4795
- async def for_non_stream():
4796
- return await self.get_message(
4797
- await self.ask(
4968
+ def for_non_stream():
4969
+ return self.get_message(
4970
+ self.ask(
4798
4971
  prompt,
4799
4972
  False,
4800
4973
  optimizer=optimizer,
@@ -4802,9 +4975,9 @@ class AsyncYEPCHAT(AsyncProvider):
4802
4975
  )
4803
4976
  )
4804
4977
 
4805
- return for_stream() if stream else await for_non_stream()
4978
+ return for_stream() if stream else for_non_stream()
4806
4979
 
4807
- async def get_message(self, response: dict) -> str:
4980
+ def get_message(self, response: dict) -> str:
4808
4981
  """Retrieves message only from response
4809
4982
 
4810
4983
  Args:
@@ -4814,71 +4987,7 @@ class AsyncYEPCHAT(AsyncProvider):
4814
4987
  str: Message extracted
4815
4988
  """
4816
4989
  assert isinstance(response, dict), "Response should be of dict data-type only"
4817
- try:
4818
- if response["choices"][0].get("delta"):
4819
- return response["choices"][0]["delta"]["content"]
4820
- return response["choices"][0]["message"]["content"]
4821
- except KeyError:
4822
- return ""
4823
- #-------------------------------------------------------youchat--------------------------------------------------------
4824
- class youChat:
4825
- """
4826
- This class provides methods for generating completions based on prompts.
4827
- """
4828
- def create(self, prompt):
4829
- """
4830
- Generate a completion based on the provided prompt.
4831
-
4832
- Args:
4833
- prompt (str): The input prompt to generate a completion from.
4834
-
4835
- Returns:
4836
- str: The generated completion as a text string.
4837
-
4838
- Raises:
4839
- Exception: If the response does not contain the expected "youChatToken".
4840
- """
4841
- resp = get(
4842
- "https://you.com/api/streamingSearch",
4843
- headers={
4844
- "cache-control": "no-cache",
4845
- "referer": "https://you.com/search?q=gpt4&tbm=youchat",
4846
- "cookie": f"safesearch_guest=Off; uuid_guest={str(uuid4())}",
4847
- },
4848
- params={
4849
- "q": prompt,
4850
- "page": 1,
4851
- "count": 10,
4852
- "safeSearch": "Off",
4853
- "onShoppingPage": False,
4854
- "mkt": "",
4855
- "responseFilter": "WebPages,Translations,TimeZone,Computation,RelatedSearches",
4856
- "domain": "youchat",
4857
- "queryTraceId": str(uuid4()),
4858
- "chat": [],
4859
- },
4860
- impersonate="chrome107",
4861
- )
4862
- if "youChatToken" not in resp.text:
4863
- raise RequestsError("Unable to fetch the response.")
4864
- return (
4865
- "".join(
4866
- findall(
4867
- r"{\"youChatToken\": \"(.*?)\"}",
4868
- resp.content.decode("unicode-escape"),
4869
- )
4870
- )
4871
- .replace("\\n", "\n")
4872
- .replace("\\\\", "\\")
4873
- .replace('\\"', '"')
4874
- )
4875
-
4876
- @staticmethod
4877
- def chat_cli(prompt):
4878
- """Generate completion based on the provided prompt"""
4879
- you_chat = youChat()
4880
- completion = you_chat.create(prompt)
4881
- print(completion)
4990
+ return response["text"]
4882
4991
  #-------------------------------------------------------Gemini--------------------------------------------------------
4883
4992
  from Bard import Chatbot
4884
4993
  import logging
@@ -38,6 +38,8 @@ webai = [
38
38
  "reka",
39
39
  "cohere",
40
40
  "yepchat",
41
+ "you",
42
+ "xjai"
41
43
  ]
42
44
 
43
45
  gpt4free_providers = [
@@ -1,6 +1,6 @@
1
1
  """Webscout.
2
2
 
3
- Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
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
5
  import g4f
6
6
  import logging
@@ -10,7 +10,7 @@ from .version import __version__
10
10
  from .DWEBS import DeepWEBS
11
11
  from .transcriber import transcriber
12
12
  from .voice import play_audio
13
- from .tempid import *
13
+
14
14
 
15
15
  __repo__ = "https://github.com/OE-LUCIFER/Webscout"
16
16
 
@@ -28,6 +28,8 @@ webai = [
28
28
  "reka",
29
29
  "cohere",
30
30
  "yepchat",
31
+ "you",
32
+ "xjai"
31
33
  ]
32
34
 
33
35
  gpt4free_providers = [
@@ -4,7 +4,7 @@ from webscout.AIutel import Conversation
4
4
  from webscout.AIutel import AwesomePrompts
5
5
  from webscout.AIbase import Provider, AsyncProvider
6
6
  from webscout.AIutel import available_providers
7
-
7
+ from typing import Any, AsyncGenerator
8
8
 
9
9
  g4f.debug.version_check = False
10
10
 
@@ -0,0 +1,2 @@
1
+ __version__ = "1.4.3"
2
+
@@ -514,20 +514,6 @@ class Main(cmd.Cmd):
514
514
  history_offset=history_offset,
515
515
  act=awesome_prompt,
516
516
  )
517
- elif provider == "sean":
518
- from webscout.AI import Sean
519
-
520
- self.bot = Sean(
521
- is_conversation=disable_conversation,
522
- max_tokens=max_tokens,
523
- timeout=timeout,
524
- intro=intro,
525
- filepath=filepath,
526
- update_file=update_file,
527
- proxies=proxies,
528
- history_offset=history_offset,
529
- act=awesome_prompt,
530
- )
531
517
  elif provider == "cohere":
532
518
  assert auth, (
533
519
  "Cohere's API-key is required. Use the flag `--key` or `-k`"
@@ -583,6 +569,22 @@ class Main(cmd.Cmd):
583
569
  history_offset=history_offset,
584
570
  act=awesome_prompt,
585
571
  )
572
+ elif provider == "xjai":
573
+ from webscout.AI import Xjai
574
+
575
+ self.bot = Xjai(
576
+ is_conversation=disable_conversation,
577
+ max_tokens=max_tokens,
578
+ temperature=temperature,
579
+ top_p=top_p,
580
+ timeout=timeout,
581
+ intro=intro,
582
+ filepath=filepath,
583
+ update_file=update_file,
584
+ proxies=proxies,
585
+ history_offset=history_offset,
586
+ act=awesome_prompt,
587
+ )
586
588
 
587
589
  elif provider == "gemini":
588
590
  from webscout.AI import GEMINI
@@ -629,7 +631,21 @@ class Main(cmd.Cmd):
629
631
  history_offset=history_offset,
630
632
  act=awesome_prompt,
631
633
  )
634
+ elif provider == "you":
635
+
636
+ from webscout.AI import YouChat
632
637
 
638
+ self.bot = YouChat(
639
+ is_conversation=disable_conversation,
640
+ max_tokens=max_tokens,
641
+ timeout=timeout,
642
+ intro=intro,
643
+ filepath=filepath,
644
+ update_file=update_file,
645
+ proxies=proxies,
646
+ history_offset=history_offset,
647
+ act=awesome_prompt,
648
+ )
633
649
 
634
650
  elif provider in webscout.gpt4free_providers:
635
651
  from webscout.g4f import GPT4FREE
@@ -2351,7 +2367,7 @@ class Utils:
2351
2367
  source = "git+" + webscout.__repo__ + ".git"
2352
2368
  source = "webscout" if source is None else source
2353
2369
  assert (
2354
- "tgpt" in source or source == "."
2370
+ "webscout" in source or source == "."
2355
2371
  ), f"Cannot update webscout from the source '{source}'"
2356
2372
  click.secho(
2357
2373
  f"[*] Updating from '{'pip' if source=='webscout' else source}'",
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webscout
3
- Version: 1.4.1
4
- Summary: Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
3
+ Version: 1.4.3
4
+ Summary: 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)
5
5
  Author: OEvortex
6
6
  Author-email: helpingai5@gmail.com
7
7
  License: HelpingAI Simplified Universal License
@@ -49,6 +49,7 @@ Requires-Dist: orjson
49
49
  Requires-Dist: PyYAML
50
50
  Requires-Dist: appdirs
51
51
  Requires-Dist: GoogleBard1>=2.1.4
52
+ Requires-Dist: tls_client
52
53
  Provides-Extra: dev
53
54
  Requires-Dist: ruff>=0.1.6; extra == "dev"
54
55
  Requires-Dist: pytest>=7.4.2; extra == "dev"
@@ -94,9 +95,8 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
94
95
  - [usage of webscout.AI](#usage-of-webscoutai)
95
96
  - [1. `PhindSearch` - Search using Phind.com](#1-phindsearch---search-using-phindcom)
96
97
  - [2. `YepChat` - Chat with mistral 8x7b powered by yepchat](#2-yepchat---chat-with-mistral-8x7b-powered-by-yepchat)
97
- - [3. `You.com` - search with you.com -NOT WORKING](#3-youcom---search-with-youcom--not-working)
98
+ - [3. `You.com` - search/chat with you.com](#3-youcom---searchchat-with-youcom)
98
99
  - [4. `Gemini` - search with google gemini](#4-gemini---search-with-google-gemini)
99
- - [usage of image generator from Webscout.AI](#usage-of-image-generator-from-webscoutai)
100
100
  - [5. `Prodia` - make image using prodia](#5-prodia---make-image-using-prodia)
101
101
  - [6. `BlackBox` - Search/chat With BlackBox](#6-blackbox---searchchat-with-blackbox)
102
102
  - [7. `PERPLEXITY` - Search With PERPLEXITY](#7-perplexity---search-with-perplexity)
@@ -104,6 +104,7 @@ Search for anything using the Google, DuckDuckGo, phind.com. Also containes AI m
104
104
  - [9. `KOBOLDIA` -](#9-koboldia--)
105
105
  - [10. `Reka` - chat with reka](#10-reka---chat-with-reka)
106
106
  - [11. `Cohere` - chat with cohere](#11-cohere---chat-with-cohere)
107
+ - [12. `Xjai` - chat with free gpt 3.5](#12-xjai---chat-with-free-gpt-35)
107
108
  - [`LLM`](#llm)
108
109
  - [`LLM` with internet](#llm-with-internet)
109
110
  - [LLM with deepwebs](#llm-with-deepwebs)
@@ -684,27 +685,31 @@ print(r)
684
685
 
685
686
  ```
686
687
 
687
- ### 3. `You.com` - search with you.com -NOT WORKING
688
+ ### 3. `You.com` - search/chat with you.com
688
689
  ```python
689
- from webscout.AI import youChat
690
690
 
691
- # Instantiate the youchat class
692
- youChat = youChat()
691
+ from webscout.AI import YouChat
692
+ from rich import print
693
693
 
694
- while True:
695
- # Ask the user for a prompt
696
- prompt = input("💡 Enter a prompt (or type 'exit' to quit): ")
697
-
698
- # Exit condition
699
- if prompt.lower() == 'exit':
700
- break
701
-
702
- # Generate a completion based on the prompt
703
- try:
704
- completion = youChat.create(prompt)
705
- print("💬:", completion)
706
- except Exception as e:
707
- print("⚠️ An error occurred:", e)
694
+ ai = YouChat(
695
+ is_conversation=True,
696
+ max_tokens=800,
697
+ timeout=30,
698
+ intro=None,
699
+ filepath=None,
700
+ update_file=True,
701
+ proxies={},
702
+ history_offset=10250,
703
+ act=None,
704
+ )
705
+
706
+ prompt = "what is meaning of life"
707
+
708
+ response = ai.ask(prompt)
709
+
710
+ # Extract and print the message from the response
711
+ message = ai.get_message(response)
712
+ print(message)
708
713
  ```
709
714
 
710
715
  ### 4. `Gemini` - search with google gemini
@@ -728,19 +733,7 @@ gemini = GEMINI(cookie_file=COOKIE_FILE, proxy=PROXIES)
728
733
  # Ask a question and print the response
729
734
  response = gemini.chat("What is the meaning of life?")
730
735
  print(response)
731
-
732
- # Ask another question, this time streaming the response
733
- for chunk in gemini.chat("Tell me a story", stream=True):
734
- print(chunk, end="")
735
-
736
- # Reset the conversation to start a new interaction
737
- gemini.reset()
738
-
739
- # Ask a question with the code optimizer
740
- response = gemini.chat("Write Python code to print 'Hello, world!'", optimizer="code")
741
- print(response)
742
736
  ```
743
- ## usage of image generator from Webscout.AI
744
737
  ### 5. `Prodia` - make image using prodia
745
738
  ```python
746
739
  from webscout.AI import Prodia
@@ -846,6 +839,30 @@ response_str = a.chat(prompt)
846
839
  print(response_str)
847
840
  ```
848
841
 
842
+ ### 12. `Xjai` - chat with free gpt 3.5
843
+ Gratitude to [Devs do Code](http://www.youtube.com/@DevsDoCode) for their assistance.
844
+ ```python
845
+ from webscout.AI import Xjai
846
+ from rich import print
847
+
848
+ ai = Xjai(
849
+ is_conversation=True,
850
+ max_tokens=800,
851
+ timeout=30,
852
+ intro=None,
853
+ filepath=None,
854
+ update_file=True,
855
+ proxies={},
856
+ history_offset=10250,
857
+ act=None,
858
+ )
859
+
860
+ prompt = "Tell me about india"
861
+
862
+ response = ai.chat(prompt)
863
+ print(response)
864
+ ```
865
+
849
866
  ### `LLM`
850
867
  ```python
851
868
  from webscout.LLM import LLM
@@ -23,6 +23,7 @@ orjson
23
23
  PyYAML
24
24
  appdirs
25
25
  GoogleBard1>=2.1.4
26
+ tls_client
26
27
 
27
28
  [dev]
28
29
  ruff>=0.1.6
@@ -1,2 +0,0 @@
1
- __version__ = "1.4.1"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes