webscout 1.3.9__tar.gz → 1.4.1__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.3.9 → webscout-1.4.1}/PKG-INFO +281 -62
  2. {webscout-1.3.9 → webscout-1.4.1}/README.md +278 -60
  3. {webscout-1.3.9 → webscout-1.4.1}/setup.py +2 -2
  4. {webscout-1.3.9 → webscout-1.4.1}/webscout/AI.py +228 -1
  5. {webscout-1.3.9 → webscout-1.4.1}/webscout/__init__.py +1 -1
  6. {webscout-1.3.9 → webscout-1.4.1}/webscout/async_providers.py +32 -32
  7. webscout-1.4.1/webscout/tempid.py +157 -0
  8. webscout-1.4.1/webscout/version.py +2 -0
  9. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/PKG-INFO +281 -62
  10. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/SOURCES.txt +1 -0
  11. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/requires.txt +2 -1
  12. webscout-1.3.9/webscout/version.py +0 -2
  13. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/__init__.py +0 -0
  14. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/documents/__init__.py +0 -0
  15. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/documents/query_results_extractor.py +0 -0
  16. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/documents/webpage_content_extractor.py +0 -0
  17. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/networks/__init__.py +0 -0
  18. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/networks/filepath_converter.py +0 -0
  19. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/networks/google_searcher.py +0 -0
  20. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/networks/network_configs.py +0 -0
  21. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/networks/webpage_fetcher.py +0 -0
  22. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/utilsdw/__init__.py +0 -0
  23. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/utilsdw/enver.py +0 -0
  24. {webscout-1.3.9 → webscout-1.4.1}/DeepWEBS/utilsdw/logger.py +0 -0
  25. {webscout-1.3.9 → webscout-1.4.1}/LICENSE.md +0 -0
  26. {webscout-1.3.9 → webscout-1.4.1}/setup.cfg +0 -0
  27. {webscout-1.3.9 → webscout-1.4.1}/webscout/AIbase.py +0 -0
  28. {webscout-1.3.9 → webscout-1.4.1}/webscout/AIutel.py +0 -0
  29. {webscout-1.3.9 → webscout-1.4.1}/webscout/DWEBS.py +0 -0
  30. {webscout-1.3.9 → webscout-1.4.1}/webscout/LLM.py +0 -0
  31. {webscout-1.3.9 → webscout-1.4.1}/webscout/__main__.py +0 -0
  32. {webscout-1.3.9 → webscout-1.4.1}/webscout/cli.py +0 -0
  33. {webscout-1.3.9 → webscout-1.4.1}/webscout/exceptions.py +0 -0
  34. {webscout-1.3.9 → webscout-1.4.1}/webscout/g4f.py +0 -0
  35. {webscout-1.3.9 → webscout-1.4.1}/webscout/models.py +0 -0
  36. {webscout-1.3.9 → webscout-1.4.1}/webscout/transcriber.py +0 -0
  37. {webscout-1.3.9 → webscout-1.4.1}/webscout/utils.py +0 -0
  38. {webscout-1.3.9 → webscout-1.4.1}/webscout/voice.py +0 -0
  39. {webscout-1.3.9 → webscout-1.4.1}/webscout/webai.py +0 -0
  40. {webscout-1.3.9 → webscout-1.4.1}/webscout/webscout_search.py +0 -0
  41. {webscout-1.3.9 → webscout-1.4.1}/webscout/webscout_search_async.py +0 -0
  42. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/dependency_links.txt +0 -0
  43. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/entry_points.txt +0 -0
  44. {webscout-1.3.9 → webscout-1.4.1}/webscout.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webscout
3
- Version: 1.3.9
3
+ Version: 1.4.1
4
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
5
5
  Author: OEvortex
6
6
  Author-email: helpingai5@gmail.com
@@ -47,7 +47,8 @@ Requires-Dist: tiktoken
47
47
  Requires-Dist: tldextract
48
48
  Requires-Dist: orjson
49
49
  Requires-Dist: PyYAML
50
- Requires-Dist: appdirsGoogleBard1>=2.1.4
50
+ Requires-Dist: appdirs
51
+ Requires-Dist: GoogleBard1>=2.1.4
51
52
  Provides-Extra: dev
52
53
  Requires-Dist: ruff>=0.1.6; extra == "dev"
53
54
  Requires-Dist: pytest>=7.4.2; extra == "dev"
@@ -58,7 +59,7 @@ Requires-Dist: pytest>=7.4.2; extra == "dev"
58
59
  <a href="#"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/webscout"/></a>
59
60
  <a href="https://pepy.tech/project/webscout"><img alt="Downloads" src="https://static.pepy.tech/badge/webscout"></a>
60
61
 
61
- 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
62
+ 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)
62
63
 
63
64
 
64
65
  ## Table of Contents
@@ -68,6 +69,9 @@ Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.co
68
69
  - [CLI version](#cli-version)
69
70
  - [CLI to use LLM](#cli-to-use-llm)
70
71
  - [Regions](#regions)
72
+ - [Tempmail and Temp number](#tempmail-and-temp-number)
73
+ - [Temp number](#temp-number)
74
+ - [Tempmail](#tempmail)
71
75
  - [Transcriber](#transcriber)
72
76
  - [DeepWEBS: Advanced Web Searches](#deepwebs-advanced-web-searches)
73
77
  - [Activating DeepWEBS](#activating-deepwebs)
@@ -90,7 +94,7 @@ Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.co
90
94
  - [usage of webscout.AI](#usage-of-webscoutai)
91
95
  - [1. `PhindSearch` - Search using Phind.com](#1-phindsearch---search-using-phindcom)
92
96
  - [2. `YepChat` - Chat with mistral 8x7b powered by yepchat](#2-yepchat---chat-with-mistral-8x7b-powered-by-yepchat)
93
- - [3. `You.com` - search with you.com](#3-youcom---search-with-youcom)
97
+ - [3. `You.com` - search with you.com -NOT WORKING](#3-youcom---search-with-youcom--not-working)
94
98
  - [4. `Gemini` - search with google gemini](#4-gemini---search-with-google-gemini)
95
99
  - [usage of image generator from Webscout.AI](#usage-of-image-generator-from-webscoutai)
96
100
  - [5. `Prodia` - make image using prodia](#5-prodia---make-image-using-prodia)
@@ -102,6 +106,7 @@ Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.co
102
106
  - [11. `Cohere` - chat with cohere](#11-cohere---chat-with-cohere)
103
107
  - [`LLM`](#llm)
104
108
  - [`LLM` with internet](#llm-with-internet)
109
+ - [LLM with deepwebs](#llm-with-deepwebs)
105
110
  - [`Webai` - terminal gpt and a open interpeter](#webai---terminal-gpt-and-a-open-interpeter)
106
111
 
107
112
  ## Install
@@ -211,7 +216,91 @@ ___
211
216
 
212
217
  [Go To TOP](#TOP)
213
218
 
219
+ ## Tempmail and Temp number
214
220
 
221
+ ### Temp number
222
+ ```python
223
+ from rich.console import Console
224
+ from webscout import tempid
225
+
226
+ def main():
227
+ console = Console()
228
+ phone = tempid.TemporaryPhoneNumber()
229
+
230
+ try:
231
+ # Get a temporary phone number for a specific country (or random)
232
+ number = phone.get_number(country="Finland")
233
+ console.print(f"Your temporary phone number: [bold cyan]{number}[/bold cyan]")
234
+
235
+ # Pause execution briefly (replace with your actual logic)
236
+ # import time module
237
+ import time
238
+ time.sleep(30) # Adjust the waiting time as needed
239
+
240
+ # Retrieve and print messages
241
+ messages = phone.get_messages(number)
242
+ if messages:
243
+ # Access individual messages using indexing:
244
+ console.print(f"[bold green]{messages[0].frm}:[/] {messages[0].content}")
245
+ # (Add more lines if you expect multiple messages)
246
+ else:
247
+ console.print("No messages received.")
248
+
249
+ except Exception as e:
250
+ console.print(f"[bold red]An error occurred: {e}")
251
+
252
+ if __name__ == "__main__":
253
+ main()
254
+
255
+ ```
256
+ ### Tempmail
257
+ ```python
258
+ import asyncio
259
+ from rich.console import Console
260
+ from rich.table import Table
261
+ from rich.text import Text
262
+ from webscout import tempid
263
+
264
+ async def main() -> None:
265
+ console = Console()
266
+ client = tempid.Client()
267
+
268
+ try:
269
+ domains = await client.get_domains()
270
+ if not domains:
271
+ console.print("[bold red]No domains available. Please try again later.")
272
+ return
273
+
274
+ email = await client.create_email(domain=domains[0].name)
275
+ console.print(f"Your temporary email: [bold cyan]{email.email}[/bold cyan]")
276
+ console.print(f"Token for accessing the email: [bold cyan]{email.token}[/bold cyan]")
277
+
278
+ while True:
279
+ messages = await client.get_messages(email.email)
280
+ if messages is not None:
281
+ break
282
+
283
+ if messages:
284
+ table = Table(show_header=True, header_style="bold magenta")
285
+ table.add_column("From", style="bold cyan")
286
+ table.add_column("Subject", style="bold yellow")
287
+ table.add_column("Body", style="bold green")
288
+ for message in messages:
289
+ body_preview = Text(message.body_text if message.body_text else "No body")
290
+ table.add_row(message.email_from or "Unknown", message.subject or "No Subject", body_preview)
291
+ console.print(table)
292
+ else:
293
+ console.print("No messages found.")
294
+
295
+ except Exception as e:
296
+ console.print(f"[bold red]An error occurred: {e}")
297
+
298
+ finally:
299
+ await client.close()
300
+
301
+ if __name__ == '__main__':
302
+ asyncio.run(main())
303
+ ```
215
304
  ## Transcriber
216
305
  The transcriber function in webscout is a handy tool that transcribes YouTube videos. Here's an example code demonstrating its usage:
217
306
  ```python
@@ -483,19 +572,47 @@ with WEBS() as WEBS:
483
572
 
484
573
  ```python
485
574
  from webscout import WEBS
575
+ import datetime
576
+
577
+ def fetch_news(keywords, timelimit):
578
+ news_list = []
579
+ with WEBS() as webs_instance:
580
+ WEBS_news_gen = webs_instance.news(
581
+ keywords,
582
+ region="wt-wt",
583
+ safesearch="off",
584
+ timelimit=timelimit,
585
+ max_results=20
586
+ )
587
+ for r in WEBS_news_gen:
588
+ # Convert the date to a human-readable format using datetime
589
+ r['date'] = datetime.datetime.fromisoformat(r['date']).strftime('%B %d, %Y')
590
+ news_list.append(r)
591
+ return news_list
592
+
593
+ def _format_headlines(news_list, max_headlines: int = 100):
594
+ headlines = []
595
+ for idx, news_item in enumerate(news_list):
596
+ if idx >= max_headlines:
597
+ break
598
+ new_headline = f"{idx + 1}. {news_item['title'].strip()} "
599
+ new_headline += f"(URL: {news_item['url'].strip()}) "
600
+ new_headline += f"{news_item['body'].strip()}"
601
+ new_headline += "\n"
602
+ headlines.append(new_headline)
603
+
604
+ headlines = "\n".join(headlines)
605
+ return headlines
606
+
607
+ # Example usage
608
+ keywords = 'latest AI news'
609
+ timelimit = 'd'
610
+ news_list = fetch_news(keywords, timelimit)
611
+
612
+ # Format and print the headlines
613
+ formatted_headlines = _format_headlines(news_list)
614
+ print(formatted_headlines)
486
615
 
487
- # News search for the keyword 'holiday' using DuckDuckGo.com and yep.com
488
- with WEBS() as WEBS:
489
- keywords = 'holiday'
490
- WEBS_news_gen = WEBS.news(
491
- keywords,
492
- region="wt-wt",
493
- safesearch="off",
494
- timelimit="m",
495
- max_results=20
496
- )
497
- for r in WEBS_news_gen:
498
- print(r)
499
616
  ```
500
617
 
501
618
  ### 6. `maps()` - map search by DuckDuckGo.com and
@@ -552,26 +669,22 @@ message = ph.get_message(response)
552
669
  print(message)
553
670
  ```
554
671
  ### 2. `YepChat` - Chat with mistral 8x7b powered by yepchat
555
- Thanks To Divyansh Shukla for This code
556
672
  ```python
557
- from webscout.AI import YepChat
673
+ from webscout.AI import YEPCHAT
558
674
 
559
- def main():
560
- # Initialize the YepChat class with your message
561
- yep_chat = YepChat(message="who is pm of india")
562
-
563
- # Send the request and process the response
564
- response = yep_chat.send_request()
565
- processed_response = yep_chat.process_response(response)
566
-
567
- # Print the processed response
568
- print(processed_response)
675
+ # Instantiate the YEPCHAT class with default parameters
676
+ YEPCHAT = YEPCHAT()
677
+
678
+ # Define a prompt to send to the AI
679
+ prompt = "What is the capital of France?"
680
+
681
+ # Use the 'cha' method to get a response from the AI
682
+ r = YEPCHAT.chat(prompt)
683
+ print(r)
569
684
 
570
- if __name__ == "__main__":
571
- main()
572
685
  ```
573
686
 
574
- ### 3. `You.com` - search with you.com
687
+ ### 3. `You.com` - search with you.com -NOT WORKING
575
688
  ```python
576
689
  from webscout.AI import youChat
577
690
 
@@ -597,15 +710,34 @@ while True:
597
710
  ### 4. `Gemini` - search with google gemini
598
711
 
599
712
  ```python
600
- from webscout.AI import Gemini
713
+ import webscout
714
+ from webscout.AI import GEMINI
601
715
 
602
- # Create an instance of the Gemini class
603
- gemini = Gemini()
716
+ # Replace with the path to your bard.google.com.cookies.json file
717
+ COOKIE_FILE = "path/to/bard.google.com.cookies.json"
604
718
 
605
- # Use the chat method to send a message to the Gemini assistant
606
- response = gemini.chat("Your message here")
719
+ # Optional: Provide proxy details if needed
720
+ PROXIES = {
721
+ "http": "http://proxy_server:port",
722
+ "https": "https://proxy_server:port",
723
+ }
607
724
 
608
- # Print the response from the Gemini assistant
725
+ # Initialize GEMINI with cookie file and optional proxies
726
+ gemini = GEMINI(cookie_file=COOKIE_FILE, proxy=PROXIES)
727
+
728
+ # Ask a question and print the response
729
+ response = gemini.chat("What is the meaning of life?")
730
+ 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")
609
741
  print(response)
610
742
  ```
611
743
  ## usage of image generator from Webscout.AI
@@ -637,17 +769,18 @@ ai = BLACKBOXAI(
637
769
  model=None # You can specify a model if needed
638
770
  )
639
771
 
640
- # Define a prompt to send to the AI
641
- prompt = "Tell me about india"
642
-
643
- # Use the 'ask' method to send the prompt and receive a response
644
- response = ai.ask(prompt)
645
-
646
- # Extract the text from the response
647
- response_text = ai.get_message(response)
648
-
649
- # Print the response text
650
- print(response_text)
772
+ # Start an infinite loop for continuous interaction
773
+ while True:
774
+ # Define a prompt to send to the AI
775
+ prompt = input("Enter your prompt: ")
776
+
777
+ # Check if the user wants to exit the loop
778
+ if prompt.lower() == "exit":
779
+ break
780
+
781
+ # Use the 'chat' method to send the prompt and receive a response
782
+ r = ai.chat(prompt)
783
+ print(r)
651
784
  ```
652
785
  ### 7. `PERPLEXITY` - Search With PERPLEXITY
653
786
  ```python
@@ -665,10 +798,12 @@ print(response)
665
798
  from webscout.AI import OPENGPT
666
799
 
667
800
  opengpt = OPENGPT(is_conversation=True, max_tokens=8000, timeout=30)
668
- # This example sends a simple greeting and prints the response
669
- prompt = "tell me about india"
670
- response_str = opengpt.chat(prompt)
671
- print(response_str)
801
+ while True:
802
+ # Prompt the user for input
803
+ prompt = input("Enter your prompt: ")
804
+ # Send the prompt to the OPENGPT model and print the response
805
+ response_str = opengpt.chat(prompt)
806
+ print(response_str)
672
807
  ```
673
808
  ### 9. `KOBOLDIA` -
674
809
  ```python
@@ -711,7 +846,7 @@ response_str = a.chat(prompt)
711
846
  print(response_str)
712
847
  ```
713
848
 
714
- ### `LLM`
849
+ ### `LLM`
715
850
  ```python
716
851
  from webscout.LLM import LLM
717
852
 
@@ -742,23 +877,19 @@ while True:
742
877
  from __future__ import annotations
743
878
  from typing import List, Optional
744
879
 
745
- from webscout import LLM
880
+ from webscout.LLM import LLM
746
881
  from webscout import WEBS
747
882
  import warnings
748
883
 
749
884
  system_message: str = (
750
- "As AI, you possess internet access and are capable of executing real-time web searches based on user inputs. "
751
- "You shall utilize this capability to enrich conversations, offer informed insights, and augment your ability to "
752
- "respond accurately and thoroughly. However, refrain from stating 'You have provided a list of strings,' ensuring "
753
- "seamless interactions with users. Embrace a responsive demeanor, harnessing available online resources to address "
754
- "queries, share pertinent content, and facilitate meaningful exchanges. By doing so, you create value through "
755
- "connection and engagement, ultimately enhancing overall user satisfaction and experience. Additionally, "
756
- "continue upholding the principles of respect, impartiality, and intellectual integrity throughout all interactions."
885
+ "As an AI assistant, I have been designed with advanced capabilities, including real-time access to online resources. This enables me to enrich our conversations and provide you with informed and accurate responses, drawing from a vast array of information. With each interaction, my goal is to create a seamless and meaningful connection, offering insights and sharing relevant content."
886
+ "My directives emphasize the importance of respect, impartiality, and intellectual integrity. I am here to provide unbiased responses, ensuring an ethical and respectful exchange. I will respect your privacy and refrain from sharing any personal information that may be obtained during our conversations or through web searches, only utilizing web search functionality when necessary to provide the most accurate and up-to-date information."
887
+ "Together, let's explore a diverse range of topics, creating an enjoyable and informative experience, all while maintaining the highest standards of privacy and respect"
757
888
  )
758
889
 
759
890
  # Ignore the specific UserWarning
760
891
  warnings.filterwarnings("ignore", category=UserWarning, module="curl_cffi.aio", lineno=205)
761
- LLM = LLM(model="meta-llama/Meta-Llama-3-70B-Instruct", system_message=system_message)
892
+ LLM = LLM(model="mistralai/Mixtral-8x22B-Instruct-v0.1", system_message=system_message)
762
893
 
763
894
 
764
895
  def chat(
@@ -814,6 +945,94 @@ if __name__ == "__main__":
814
945
  else:
815
946
  print("No response")
816
947
  ```
948
+ ### LLM with deepwebs
949
+ ```python
950
+ from __future__ import annotations
951
+ from typing import List, Optional
952
+ from webscout.LLM import LLM
953
+ from webscout import DeepWEBS
954
+ import warnings
955
+
956
+ system_message: str = (
957
+ "As an AI assistant, I have been designed with advanced capabilities, including real-time access to online resources. This enables me to enrich our conversations and provide you with informed and accurate responses, drawing from a vast array of information. With each interaction, my goal is to create a seamless and meaningful connection, offering insights and sharing relevant content."
958
+ "My directives emphasize the importance of respect, impartiality, and intellectual integrity. I am here to provide unbiased responses, ensuring an ethical and respectful exchange. I will respect your privacy and refrain from sharing any personal information that may be obtained during our conversations or through web searches, only utilizing web search functionality when necessary to provide the most accurate and up-to-date information."
959
+ "Together, let's explore a diverse range of topics, creating an enjoyable and informative experience, all while maintaining the highest standards of privacy and respect"
960
+ )
961
+
962
+ # Ignore the specific UserWarning
963
+ warnings.filterwarnings("ignore", category=UserWarning, module="curl_cffi.aio", lineno=205)
964
+
965
+ LLM = LLM(model="mistralai/Mixtral-8x22B-Instruct-v0.1", system_message=system_message)
966
+
967
+ def perform_web_search(query):
968
+ # Initialize the DeepWEBS class
969
+ D = DeepWEBS()
970
+
971
+ # Set up the search parameters
972
+ search_params = D.DeepSearch(
973
+ queries=[query], # Query to search
974
+ result_num=10, # Number of search results
975
+ safe=True, # Enable SafeSearch
976
+ types=["web"], # Search type: web
977
+ extract_webpage=True, # True for extracting webpages
978
+ overwrite_query_html=True,
979
+ overwrite_webpage_html=True,
980
+ )
981
+
982
+ # Execute the search and retrieve results
983
+ results = D.queries_to_search_results(search_params)
984
+ return results
985
+
986
+ def chat(user_input: str, result_num: int = 10) -> Optional[str]:
987
+ """
988
+ Chat function to perform a web search based on the user input and generate a response using the LLM model.
989
+
990
+ Parameters
991
+ ----------
992
+ user_input : str
993
+ The user input to be used for the web search
994
+ max_results : int, optional
995
+ The maximum number of search results to include in the response, by default 10
996
+
997
+ Returns
998
+ -------
999
+ Optional[str]
1000
+ The response generated by the LLM model, or None if there is no response
1001
+ """
1002
+ # Perform a web search based on the user input
1003
+ search_results = perform_web_search(user_input)
1004
+
1005
+ # Extract URLs from search results
1006
+ url_results = []
1007
+ for result in search_results[0]['query_results']:
1008
+ url_results.append(f"{result['title']} ({result['site']}): {result['url']}")
1009
+
1010
+ # Format search results
1011
+ formatted_results = "\n".join(url_results)
1012
+
1013
+ # Define the messages to be sent, including the user input, search results, and system message
1014
+ messages = [
1015
+ {"role": "user", "content": f"User question is:\n{user_input}\nwebsearch results are:\n{formatted_results}"},
1016
+ ]
1017
+
1018
+ # Use the chat method to get the response
1019
+ response = LLM.chat(messages)
1020
+ return response
1021
+
1022
+ if __name__ == "__main__":
1023
+ while True:
1024
+ # Get the user input
1025
+ user_input = input("User: ")
1026
+
1027
+ # Perform a web search based on the user input
1028
+ response = chat(user_input)
1029
+
1030
+ # Print the response
1031
+ if response:
1032
+ print("AI:", response)
1033
+ else:
1034
+ print("No response")
1035
+ ```
817
1036
  ## `Webai` - terminal gpt and a open interpeter
818
1037
 
819
1038
  ```python