webscout 3.8__tar.gz → 4.0__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 (75) hide show
  1. {webscout-3.8/webscout.egg-info → webscout-4.0}/PKG-INFO +46 -332
  2. {webscout-3.8 → webscout-4.0}/README.md +45 -331
  3. {webscout-3.8 → webscout-4.0}/setup.py +1 -1
  4. {webscout-3.8 → webscout-4.0}/webscout/AIutel.py +5 -1
  5. webscout-4.0/webscout/Extra/__init__.py +4 -0
  6. webscout-4.0/webscout/Extra/weather.py +49 -0
  7. webscout-4.0/webscout/Extra/weather_ascii.py +18 -0
  8. {webscout-3.8 → webscout-4.0}/webscout/Local/_version.py +1 -1
  9. webscout-4.0/webscout/Provider/Geminiflash.py +152 -0
  10. webscout-4.0/webscout/Provider/Geminipro.py +152 -0
  11. {webscout-3.8 → webscout-4.0}/webscout/Provider/Youchat.py +5 -1
  12. {webscout-3.8 → webscout-4.0}/webscout/Provider/__init__.py +6 -0
  13. webscout-4.0/webscout/YTdownloader.py +1105 -0
  14. {webscout-3.8 → webscout-4.0}/webscout/__init__.py +6 -1
  15. webscout-4.0/webscout/cli.py +346 -0
  16. webscout-4.0/webscout/version.py +2 -0
  17. {webscout-3.8 → webscout-4.0}/webscout/webai.py +44 -0
  18. {webscout-3.8 → webscout-4.0/webscout.egg-info}/PKG-INFO +46 -332
  19. {webscout-3.8 → webscout-4.0}/webscout.egg-info/SOURCES.txt +5 -0
  20. webscout-3.8/webscout/Extra/__init__.py +0 -2
  21. webscout-3.8/webscout/cli.py +0 -451
  22. webscout-3.8/webscout/version.py +0 -2
  23. {webscout-3.8 → webscout-4.0}/LICENSE.md +0 -0
  24. {webscout-3.8 → webscout-4.0}/setup.cfg +0 -0
  25. {webscout-3.8 → webscout-4.0}/webscout/AIauto.py +0 -0
  26. {webscout-3.8 → webscout-4.0}/webscout/AIbase.py +0 -0
  27. {webscout-3.8 → webscout-4.0}/webscout/DWEBS.py +0 -0
  28. {webscout-3.8 → webscout-4.0}/webscout/Extra/autollama.py +0 -0
  29. {webscout-3.8 → webscout-4.0}/webscout/Extra/gguf.py +0 -0
  30. {webscout-3.8 → webscout-4.0}/webscout/LLM.py +0 -0
  31. {webscout-3.8 → webscout-4.0}/webscout/Local/__init__.py +0 -0
  32. {webscout-3.8 → webscout-4.0}/webscout/Local/formats.py +0 -0
  33. {webscout-3.8 → webscout-4.0}/webscout/Local/model.py +0 -0
  34. {webscout-3.8 → webscout-4.0}/webscout/Local/rawdog.py +0 -0
  35. {webscout-3.8 → webscout-4.0}/webscout/Local/samplers.py +0 -0
  36. {webscout-3.8 → webscout-4.0}/webscout/Local/thread.py +0 -0
  37. {webscout-3.8 → webscout-4.0}/webscout/Local/utils.py +0 -0
  38. {webscout-3.8 → webscout-4.0}/webscout/Provider/BasedGPT.py +0 -0
  39. {webscout-3.8 → webscout-4.0}/webscout/Provider/Berlin4h.py +0 -0
  40. {webscout-3.8 → webscout-4.0}/webscout/Provider/Blackboxai.py +0 -0
  41. {webscout-3.8 → webscout-4.0}/webscout/Provider/ChatGPTUK.py +0 -0
  42. {webscout-3.8 → webscout-4.0}/webscout/Provider/Cohere.py +0 -0
  43. {webscout-3.8 → webscout-4.0}/webscout/Provider/Deepinfra.py +0 -0
  44. {webscout-3.8 → webscout-4.0}/webscout/Provider/Deepseek.py +0 -0
  45. {webscout-3.8 → webscout-4.0}/webscout/Provider/Gemini.py +0 -0
  46. {webscout-3.8 → webscout-4.0}/webscout/Provider/Groq.py +0 -0
  47. {webscout-3.8 → webscout-4.0}/webscout/Provider/Koboldai.py +0 -0
  48. {webscout-3.8 → webscout-4.0}/webscout/Provider/Leo.py +0 -0
  49. {webscout-3.8 → webscout-4.0}/webscout/Provider/Llama2.py +0 -0
  50. {webscout-3.8 → webscout-4.0}/webscout/Provider/OpenGPT.py +0 -0
  51. {webscout-3.8 → webscout-4.0}/webscout/Provider/Openai.py +0 -0
  52. {webscout-3.8 → webscout-4.0}/webscout/Provider/Perplexity.py +0 -0
  53. {webscout-3.8 → webscout-4.0}/webscout/Provider/Phind.py +0 -0
  54. {webscout-3.8 → webscout-4.0}/webscout/Provider/Poe.py +0 -0
  55. {webscout-3.8 → webscout-4.0}/webscout/Provider/Reka.py +0 -0
  56. {webscout-3.8 → webscout-4.0}/webscout/Provider/ThinkAnyAI.py +0 -0
  57. {webscout-3.8 → webscout-4.0}/webscout/Provider/VTLchat.py +0 -0
  58. {webscout-3.8 → webscout-4.0}/webscout/Provider/Xjai.py +0 -0
  59. {webscout-3.8 → webscout-4.0}/webscout/Provider/Yepchat.py +0 -0
  60. {webscout-3.8 → webscout-4.0}/webscout/__main__.py +0 -0
  61. {webscout-3.8 → webscout-4.0}/webscout/async_providers.py +0 -0
  62. {webscout-3.8 → webscout-4.0}/webscout/exceptions.py +0 -0
  63. {webscout-3.8 → webscout-4.0}/webscout/g4f.py +0 -0
  64. {webscout-3.8 → webscout-4.0}/webscout/models.py +0 -0
  65. {webscout-3.8 → webscout-4.0}/webscout/tempid.py +0 -0
  66. {webscout-3.8 → webscout-4.0}/webscout/transcriber.py +0 -0
  67. {webscout-3.8 → webscout-4.0}/webscout/utils.py +0 -0
  68. {webscout-3.8 → webscout-4.0}/webscout/voice.py +0 -0
  69. {webscout-3.8 → webscout-4.0}/webscout/webscout_search.py +0 -0
  70. {webscout-3.8 → webscout-4.0}/webscout/webscout_search_async.py +0 -0
  71. {webscout-3.8 → webscout-4.0}/webscout/websx_search.py +0 -0
  72. {webscout-3.8 → webscout-4.0}/webscout.egg-info/dependency_links.txt +0 -0
  73. {webscout-3.8 → webscout-4.0}/webscout.egg-info/entry_points.txt +0 -0
  74. {webscout-3.8 → webscout-4.0}/webscout.egg-info/requires.txt +0 -0
  75. {webscout-3.8 → webscout-4.0}/webscout.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webscout
3
- Version: 3.8
3
+ Version: 4.0
4
4
  Summary: Search for anything using Google, DuckDuckGo, brave, qwant, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs and more
5
5
  Author: OEvortex
6
6
  Author-email: helpingai5@gmail.com
@@ -92,7 +92,7 @@ Requires-Dist: huggingface_hub[cli]; extra == "local"
92
92
  <a href="#"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/webscout"/></a>
93
93
  <a href="https://pepy.tech/project/webscout"><img alt="Downloads" src="https://static.pepy.tech/badge/webscout"></a>
94
94
 
95
- Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs
95
+ Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs and more
96
96
 
97
97
 
98
98
  ## Table of Contents
@@ -249,10 +249,49 @@ python -m webscout --help
249
249
  ve-es for Venezuela
250
250
  vn-vi for Vietnam
251
251
  wt-wt for No region
252
- ___
252
+
253
+
253
254
  </details>
254
255
 
256
+
255
257
  [Go To TOP](#TOP)
258
+ ## YTdownloader -webscout can now download yt videos
259
+
260
+ ```python
261
+ from os import rename, getcwd
262
+ from webscout import YTdownloader
263
+ def download_audio(video_id):
264
+ youtube_link = video_id
265
+ handler = YTdownloader.Handler(query=youtube_link)
266
+ for third_query_data in handler.run(format='mp3', quality='128kbps', limit=1):
267
+ audio_path = handler.save(third_query_data, dir=getcwd())
268
+ rename(audio_path, "audio.mp3")
269
+
270
+ def download_video(video_id):
271
+ youtube_link = video_id
272
+ handler = YTdownloader.Handler(query=youtube_link)
273
+ for third_query_data in handler.run(format='mp4', quality='auto', limit=1):
274
+ video_path = handler.save(third_query_data, dir=getcwd())
275
+ rename(video_path, "video.mp4")
276
+
277
+ if __name__ == "__main__":
278
+ # download_audio("https://www.youtube.com/watch?v=c0tMvzB0OKw")
279
+ download_video("https://www.youtube.com/watch?v=c0tMvzB0OKw")
280
+ ```
281
+
282
+ ## Weather - webscout can now forcast weather
283
+ 1. weather
284
+ ```python
285
+ from webscout import weather as w
286
+ weather = w.get("Qazigund")
287
+ w.print_weather(weather)
288
+ ```
289
+ 2. weather ascii
290
+ ```python
291
+ from webscout import weather_ascii as w
292
+ weather = w.get("Qazigund")
293
+ print(weather)
294
+ ```
256
295
 
257
296
  ## Tempmail and Temp number
258
297
 
@@ -1421,6 +1460,9 @@ provider = VTLchat()
1421
1460
  response = provider.chat("Hello, how are you?")
1422
1461
  print(response)
1423
1462
  ```
1463
+
1464
+ ### 21. GeminiFlash and geminipro
1465
+ **Usage similar to other providers**
1424
1466
  ### `LLM`
1425
1467
  ```python
1426
1468
  from webscout.LLM import LLM
@@ -1698,335 +1740,7 @@ if __name__ == "__main__":
1698
1740
  ```
1699
1741
 
1700
1742
  ## `Webai` - terminal gpt and a open interpeter
1701
-
1702
- ```python
1703
- import time
1704
- import uuid
1705
- from typing import Dict, Any, Optional, AsyncGenerator
1706
- from rich.console import Console
1707
- from rich.markdown import Markdown
1708
- from rich.panel import Panel
1709
- from rich.style import Style
1710
- import webscout
1711
- import webscout.AIutel
1712
- import g4f
1713
- from webscout.g4f import *
1714
- from webscout.async_providers import mapper as async_provider_map
1715
-
1716
- class TaskExecutor:
1717
- """
1718
- Manages an interactive chat session, handling user input, AI responses,
1719
- and optional features like web search, code execution, and text-to-speech.
1720
- """
1721
-
1722
- def __init__(self) -> None:
1723
- """Initializes the conversational assistant with default settings."""
1724
- self._console: Console = Console()
1725
-
1726
- # Session configuration
1727
- self._selected_provider: str = "phind"
1728
- self._selected_model: str = "Phind Model"
1729
- self._conversation_enabled: bool = True
1730
- self._max_tokens: int = 600
1731
- self._temperature: float = 0.2
1732
- self._top_k: int = -1
1733
- self._top_p: float = 0.999
1734
- self._timeout: int = 30
1735
- self._auth_token: str = None # API key, if required
1736
- self._chat_completion_enabled: bool = True # g4fauto
1737
- self._ignore_working: bool = False # Ignore working status of providers
1738
- self._proxy_path: str = None # Path to proxy configuration
1739
-
1740
- # History Management
1741
- self._history_filepath: str = "history.txt"
1742
- self._update_history_file: bool = True
1743
- self._history_offset: int = 10250
1744
-
1745
- # Prompt Engineering
1746
- self._initial_prompt: str = None
1747
- self._awesome_prompt_content: str = None
1748
-
1749
- # Optional Features
1750
- self._web_search_enabled: bool = False # Enable web search
1751
- self._rawdog_enabled: bool = True
1752
- self._internal_script_execution_enabled: bool = True
1753
- self._script_confirmation_required: bool = False
1754
- self._selected_interpreter: str = "python"
1755
- self._selected_optimizer: str = "code"
1756
- self._suppress_output: bool = False # Suppress verbose output
1757
-
1758
- # AI provider mapping
1759
- self._ai_provider_mapping: Dict[str, Any] = {
1760
- "phind": webscout.PhindSearch,
1761
- "opengpt": webscout.OPENGPT,
1762
- "koboldai": webscout.KOBOLDAI,
1763
- "blackboxai": webscout.BLACKBOXAI,
1764
- "llama2": webscout.LLAMA2,
1765
- "yepchat": webscout.YEPCHAT,
1766
- "leo": webscout.LEO,
1767
- "groq": webscout.GROQ,
1768
- "openai": webscout.OPENAI,
1769
- "perplexity": webscout.PERPLEXITY,
1770
- "you": webscout.YouChat,
1771
- "xjai": webscout.Xjai,
1772
- "cohere": webscout.Cohere,
1773
- "reka": webscout.REKA,
1774
- "thinkany": webscout.ThinkAnyAI,
1775
- "gemini": webscout.GEMINI,
1776
- "berlin4h": webscout.Berlin4h,
1777
- "chatgptuk": webscout.ChatGPTUK,
1778
- "poe": webscout.POE,
1779
- "basedgpt": webscout.BasedGPT,
1780
- "deepseek": webscout.DeepSeek,
1781
- "deepinfra": webscout.DeepInfra,
1782
- "opengenptv2": webscout.OPENGPTv2
1783
- }
1784
-
1785
- # Initialize Rawdog if enabled
1786
- if self._rawdog_enabled:
1787
- self._rawdog_instance: webscout.AIutel.RawDog = webscout.AIutel.RawDog(
1788
- quiet=self._suppress_output,
1789
- internal_exec=self._internal_script_execution_enabled,
1790
- confirm_script=self._script_confirmation_required,
1791
- interpreter=self._selected_interpreter,
1792
- )
1793
-
1794
- self._initial_prompt = self._rawdog_instance.intro_prompt
1795
-
1796
- # Initialize the selected AI model
1797
- self._ai_model = self._get_ai_model()
1798
-
1799
- def _get_ai_model(self):
1800
- """
1801
- Determines the appropriate AI model based on the selected provider,
1802
- including automatic provider selection and g4fauto support.
1803
- """
1804
- if self._selected_provider == "g4fauto":
1805
- # Automatically select the best provider from g4f
1806
- test = TestProviders(quiet=self._suppress_output, timeout=self._timeout)
1807
- g4fauto = test.best if not self._ignore_working else test.auto
1808
- if isinstance(g4fauto, str):
1809
- self._selected_provider = "g4fauto+" + g4fauto
1810
- self._ai_model = self._create_g4f_model(g4fauto)
1811
- else:
1812
- raise Exception(
1813
- "No working g4f provider found. "
1814
- "Consider running 'webscout.webai gpt4free test -y' first"
1815
- )
1816
- else:
1817
- # Use the specified provider
1818
- self._ai_model = self._ai_provider_mapping[self._selected_provider](
1819
- is_conversation=self._conversation_enabled,
1820
- max_tokens=self._max_tokens,
1821
- timeout=self._timeout,
1822
- intro=self._initial_prompt,
1823
- filepath=self._history_filepath,
1824
- update_file=self._update_history_file,
1825
- proxies={}, # Load proxies from config if needed
1826
- history_offset=self._history_offset,
1827
- act=self._awesome_prompt_content,
1828
- model=self._selected_model,
1829
- quiet=self._suppress_output,
1830
- # auth=self._auth_token, # Pass API key if required
1831
- )
1832
- return self._ai_model
1833
-
1834
- def _create_g4f_model(self, provider: str):
1835
- """
1836
- Creates a g4f model instance using the provided provider and webscout.WEBS for web search.
1837
- """
1838
- return webscout.g4f.GPT4FREE(
1839
- provider=provider,
1840
- auth=self._auth_token,
1841
- max_tokens=self._max_tokens,
1842
- chat_completion=self._chat_completion_enabled,
1843
- ignore_working=self._ignore_working,
1844
- timeout=self._timeout,
1845
- intro=self._initial_prompt,
1846
- filepath=self._history_filepath,
1847
- update_file=self._update_history_file,
1848
- proxies={}, # Load proxies from config if needed
1849
- history_offset=self._history_offset,
1850
- act=self._awesome_prompt_content,
1851
- )
1852
-
1853
- def process_query(self, query: str) -> None:
1854
- """
1855
- Processes a user query, potentially enhancing it with web search results,
1856
- passing it to the AI model, and handling the response.
1857
-
1858
- Args:
1859
- query: The user's text input.
1860
-
1861
- Returns:
1862
- None
1863
- """
1864
- if self._web_search_enabled:
1865
- query = self._augment_query_with_web_search(query)
1866
-
1867
- # Apply code optimization if configured
1868
- if self._selected_optimizer == "code":
1869
- query = webscout.AIutel.Optimizers.code(query)
1870
-
1871
- try:
1872
- response: str = self._ai_model.chat(query)
1873
- except webscout.exceptions.FailedToGenerateResponseError as e:
1874
- self._console.print(Markdown(f"LLM: [red]{e}[/red]"))
1875
- return
1876
-
1877
- # Handle Rawdog responses if enabled
1878
- if self._rawdog_enabled:
1879
- self._handle_rawdog_response(response)
1880
- else:
1881
- self._console.print(Markdown(f"LLM: {response}"))
1882
-
1883
- def _augment_query_with_web_search(self, query: str) -> str:
1884
- """Performs a web search and appends the results to the query.
1885
-
1886
- Args:
1887
- query: The user's text input.
1888
-
1889
- Returns:
1890
- str: The augmented query with web search results.
1891
- """
1892
- web_search_results = webscout.WEBS().text(query, max_results=3)
1893
- if web_search_results:
1894
- formatted_results = "\n".join(
1895
- f"{i+1}. {result['title']} - {result['href']}\n\nBody: {result['body']}"
1896
- for i, result in enumerate(web_search_results)
1897
- )
1898
- query += f"\n\n## Web Search Results are:\n\n{formatted_results}"
1899
- return query
1900
-
1901
- def _handle_rawdog_response(self, response: str) -> None:
1902
- """Handles AI responses, potentially executing them as code with Rawdog.
1903
-
1904
- Args:
1905
- response: The AI model's response.
1906
-
1907
- Returns:
1908
- None
1909
- """
1910
- try:
1911
- is_feedback = self._rawdog_instance.main(response)
1912
- if is_feedback and "PREVIOUS SCRIPT EXCEPTION" in is_feedback:
1913
- self._console.print(Markdown(f"LLM: {is_feedback}"))
1914
- error_message = is_feedback.split("PREVIOUS SCRIPT EXCEPTION:\n")[1].strip()
1915
- # Generate a solution for the error and execute it
1916
- error_solution_query = (
1917
- f"The following code was executed and resulted in an error:\n\n"
1918
- f"{response}\n\n"
1919
- f"Error: {error_message}\n\n"
1920
- f"Please provide a solution to fix this error in the code and execute it."
1921
- )
1922
- try:
1923
- new_response = self._ai_model.chat(error_solution_query)
1924
- self._handle_rawdog_response(new_response)
1925
- except webscout.exceptions.FailedToGenerateResponseError as e:
1926
- self._console.print(Markdown(f"LLM: [red]Error while generating solution: {e}[/red]"))
1927
- else:
1928
- self._console.print(Markdown("LLM: (Script executed successfully)"))
1929
- except Exception as e:
1930
- self._console.print(Markdown(f"LLM: [red]Error: {e}[/red]"))
1931
-
1932
-
1933
- async def process_async_query(self, query: str) -> None:
1934
- """
1935
- Asynchronously processes a user query, potentially enhancing it with web search results,
1936
- passing it to the AI model, and handling the response.
1937
-
1938
- Args:
1939
- query: The user's text input.
1940
-
1941
- Returns:
1942
- None
1943
- """
1944
- if self._web_search_enabled:
1945
- query = self._augment_query_with_web_search(query)
1946
-
1947
- # Apply code optimization if configured
1948
- if self._selected_optimizer == "code":
1949
- query = webscout.AIutel.Optimizers.code(query)
1950
-
1951
- async_model = self._get_async_ai_model()
1952
-
1953
- try:
1954
- async for response in async_model.chat(query, stream=True):
1955
- self._console.print(Markdown(f"LLM: {response}"), end="")
1956
- except webscout.exceptions.FailedToGenerateResponseError as e:
1957
- self._console.print(Markdown(f"LLM: [red]{e}[/red]"))
1958
- return
1959
-
1960
- # Handle Rawdog responses if enabled
1961
- if self._rawdog_enabled:
1962
- self._handle_rawdog_response(response)
1963
- else:
1964
- self._console.print(Markdown(f"LLM: {response}"))
1965
-
1966
- def _get_async_ai_model(self):
1967
- """
1968
- Determines the appropriate asynchronous AI model based on the selected provider.
1969
- """
1970
- if self._selected_provider == "g4fauto":
1971
- # Automatically select the best provider from g4f
1972
- test = TestProviders(quiet=self._suppress_output, timeout=self._timeout)
1973
- g4fauto = test.best if not self._ignore_working else test.auto
1974
- if isinstance(g4fauto, str):
1975
- self._selected_provider = "g4fauto+" + g4fauto
1976
- self._ai_model = self._create_async_g4f_model(g4fauto)
1977
- else:
1978
- raise Exception(
1979
- "No working g4f provider found. "
1980
- "Consider running 'webscout gpt4free test -y' first"
1981
- )
1982
- else:
1983
- # Use the specified provider
1984
- if self._selected_provider in async_provider_map:
1985
- self._ai_model = async_provider_map[self._selected_provider](
1986
- is_conversation=self._conversation_enabled,
1987
- max_tokens=self._max_tokens,
1988
- timeout=self._timeout,
1989
- intro=self._initial_prompt,
1990
- filepath=self._history_filepath,
1991
- update_file=self._update_history_file,
1992
- proxies={}, # Load proxies from config if needed
1993
- history_offset=self._history_offset,
1994
- act=self._awesome_prompt_content,
1995
- model=self._selected_model,
1996
- quiet=self._suppress_output,
1997
- auth=self._auth_token, # Pass API key if required
1998
- )
1999
- else:
2000
- raise Exception(
2001
- f"Asynchronous provider '{self._selected_provider}' is not yet supported"
2002
- )
2003
- return self._ai_model
2004
-
2005
- def _create_async_g4f_model(self, provider: str):
2006
- """
2007
- Creates an asynchronous g4f model instance using the provided provider and webscout.WEBS for web search.
2008
- """
2009
- return webscout.g4f.AsyncGPT4FREE(
2010
- provider=provider,
2011
- auth=self._auth_token,
2012
- max_tokens=self._max_tokens,
2013
- chat_completion=self._chat_completion_enabled,
2014
- ignore_working=self._ignore_working,
2015
- timeout=self._timeout,
2016
- intro=self._initial_prompt,
2017
- filepath=self._history_filepath,
2018
- update_file=self._update_history_file,
2019
- proxies={}, # Load proxies from config if needed
2020
- history_offset=self._history_offset,
2021
- act=self._awesome_prompt_content,
2022
- )
2023
-
2024
- if __name__ == "__main__":
2025
- assistant = TaskExecutor()
2026
- while True:
2027
- input_query = input("Enter your query: ")
2028
- assistant.process_query(input_query)
2029
-
1743
+ Code is in rawdog.py file
2030
1744
  ```
2031
1745
  ```shell
2032
1746
  python -m webscout.webai webai --provider "phind" --rawdog