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

Files changed (122) hide show
  1. webscout/AIutel.py +226 -14
  2. webscout/Bard.py +579 -206
  3. webscout/DWEBS.py +78 -35
  4. webscout/Extra/gguf.py +2 -0
  5. webscout/Extra/tempmail/base.py +1 -1
  6. webscout/Provider/AISEARCH/hika_search.py +4 -0
  7. webscout/Provider/AISEARCH/scira_search.py +2 -5
  8. webscout/Provider/Aitopia.py +75 -51
  9. webscout/Provider/AllenAI.py +181 -147
  10. webscout/Provider/ChatGPTClone.py +97 -86
  11. webscout/Provider/ChatSandbox.py +342 -0
  12. webscout/Provider/Cloudflare.py +79 -32
  13. webscout/Provider/Deepinfra.py +135 -94
  14. webscout/Provider/ElectronHub.py +103 -39
  15. webscout/Provider/ExaChat.py +36 -20
  16. webscout/Provider/GPTWeb.py +103 -47
  17. webscout/Provider/GithubChat.py +52 -49
  18. webscout/Provider/GizAI.py +283 -0
  19. webscout/Provider/Glider.py +39 -28
  20. webscout/Provider/Groq.py +222 -91
  21. webscout/Provider/HeckAI.py +93 -69
  22. webscout/Provider/HuggingFaceChat.py +113 -106
  23. webscout/Provider/Hunyuan.py +94 -83
  24. webscout/Provider/Jadve.py +104 -79
  25. webscout/Provider/LambdaChat.py +142 -123
  26. webscout/Provider/Llama3.py +94 -39
  27. webscout/Provider/MCPCore.py +315 -0
  28. webscout/Provider/Marcus.py +95 -37
  29. webscout/Provider/Netwrck.py +94 -52
  30. webscout/Provider/OPENAI/__init__.py +4 -1
  31. webscout/Provider/OPENAI/ai4chat.py +286 -0
  32. webscout/Provider/OPENAI/chatgptclone.py +35 -14
  33. webscout/Provider/OPENAI/deepinfra.py +37 -0
  34. webscout/Provider/OPENAI/exachat.py +4 -0
  35. webscout/Provider/OPENAI/groq.py +354 -0
  36. webscout/Provider/OPENAI/heckai.py +6 -2
  37. webscout/Provider/OPENAI/mcpcore.py +376 -0
  38. webscout/Provider/OPENAI/multichat.py +368 -0
  39. webscout/Provider/OPENAI/netwrck.py +3 -1
  40. webscout/Provider/OPENAI/scirachat.py +2 -4
  41. webscout/Provider/OPENAI/textpollinations.py +20 -22
  42. webscout/Provider/OPENAI/toolbaz.py +1 -0
  43. webscout/Provider/OpenGPT.py +48 -38
  44. webscout/Provider/PI.py +178 -93
  45. webscout/Provider/PizzaGPT.py +66 -36
  46. webscout/Provider/StandardInput.py +42 -30
  47. webscout/Provider/TeachAnything.py +95 -52
  48. webscout/Provider/TextPollinationsAI.py +138 -78
  49. webscout/Provider/TwoAI.py +162 -81
  50. webscout/Provider/TypliAI.py +305 -0
  51. webscout/Provider/Venice.py +97 -58
  52. webscout/Provider/VercelAI.py +33 -14
  53. webscout/Provider/WiseCat.py +65 -28
  54. webscout/Provider/Writecream.py +37 -11
  55. webscout/Provider/WritingMate.py +135 -63
  56. webscout/Provider/__init__.py +9 -27
  57. webscout/Provider/ai4chat.py +6 -7
  58. webscout/Provider/asksteve.py +53 -44
  59. webscout/Provider/cerebras.py +77 -31
  60. webscout/Provider/chatglm.py +47 -37
  61. webscout/Provider/copilot.py +0 -3
  62. webscout/Provider/elmo.py +109 -60
  63. webscout/Provider/granite.py +102 -54
  64. webscout/Provider/hermes.py +95 -48
  65. webscout/Provider/koala.py +1 -1
  66. webscout/Provider/learnfastai.py +113 -54
  67. webscout/Provider/llama3mitril.py +86 -51
  68. webscout/Provider/llmchat.py +88 -46
  69. webscout/Provider/llmchatco.py +110 -115
  70. webscout/Provider/meta.py +41 -37
  71. webscout/Provider/multichat.py +67 -28
  72. webscout/Provider/scira_chat.py +49 -30
  73. webscout/Provider/scnet.py +106 -53
  74. webscout/Provider/searchchat.py +87 -88
  75. webscout/Provider/sonus.py +113 -63
  76. webscout/Provider/toolbaz.py +115 -82
  77. webscout/Provider/turboseek.py +90 -43
  78. webscout/Provider/tutorai.py +82 -64
  79. webscout/Provider/typefully.py +85 -35
  80. webscout/Provider/typegpt.py +118 -61
  81. webscout/Provider/uncovr.py +132 -76
  82. webscout/Provider/x0gpt.py +69 -26
  83. webscout/Provider/yep.py +79 -66
  84. webscout/cli.py +256 -0
  85. webscout/conversation.py +34 -22
  86. webscout/exceptions.py +23 -0
  87. webscout/prompt_manager.py +56 -42
  88. webscout/version.py +1 -1
  89. webscout/webscout_search.py +65 -47
  90. webscout/webscout_search_async.py +81 -126
  91. webscout/yep_search.py +93 -43
  92. {webscout-8.2.3.dist-info → webscout-8.2.5.dist-info}/METADATA +183 -50
  93. {webscout-8.2.3.dist-info → webscout-8.2.5.dist-info}/RECORD +97 -113
  94. {webscout-8.2.3.dist-info → webscout-8.2.5.dist-info}/WHEEL +1 -1
  95. webscout-8.2.5.dist-info/entry_points.txt +3 -0
  96. {webscout-8.2.3.dist-info → webscout-8.2.5.dist-info}/top_level.txt +0 -1
  97. inferno/__init__.py +0 -6
  98. inferno/__main__.py +0 -9
  99. inferno/cli.py +0 -6
  100. webscout/Local/__init__.py +0 -12
  101. webscout/Local/__main__.py +0 -9
  102. webscout/Local/api.py +0 -576
  103. webscout/Local/cli.py +0 -516
  104. webscout/Local/config.py +0 -75
  105. webscout/Local/llm.py +0 -287
  106. webscout/Local/model_manager.py +0 -253
  107. webscout/Local/server.py +0 -721
  108. webscout/Local/utils.py +0 -93
  109. webscout/Provider/C4ai.py +0 -432
  110. webscout/Provider/ChatGPTES.py +0 -237
  111. webscout/Provider/Chatify.py +0 -175
  112. webscout/Provider/DeepSeek.py +0 -196
  113. webscout/Provider/Llama.py +0 -200
  114. webscout/Provider/Phind.py +0 -535
  115. webscout/Provider/WebSim.py +0 -228
  116. webscout/Provider/askmyai.py +0 -158
  117. webscout/Provider/gaurish.py +0 -244
  118. webscout/Provider/labyrinth.py +0 -340
  119. webscout/Provider/lepton.py +0 -194
  120. webscout/Provider/llamatutor.py +0 -192
  121. webscout-8.2.3.dist-info/entry_points.txt +0 -5
  122. {webscout-8.2.3.dist-info → webscout-8.2.5.dist-info/licenses}/LICENSE.md +0 -0
@@ -1,200 +0,0 @@
1
- import requests
2
- import json
3
-
4
- from webscout.AIutel import Optimizers
5
- from webscout.AIutel import Conversation
6
- from webscout.AIutel import AwesomePrompts, sanitize_stream
7
- from webscout.AIbase import Provider, AsyncProvider
8
- from webscout import exceptions
9
- from typing import Any, AsyncGenerator, Dict, Union
10
-
11
-
12
- class LLAMA(Provider):
13
- def __init__(
14
- self,
15
- is_conversation: bool = True,
16
- max_tokens: int = 600,
17
- timeout: int = 30,
18
- intro: str = None,
19
- filepath: str = None,
20
- update_file: bool = True,
21
- proxies: dict = {},
22
- history_offset: int = 10250,
23
- act: str = None,
24
- ):
25
- """Instantiates LLAMA
26
-
27
- Args:
28
- is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
29
- max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
30
- timeout (int, optional): Http request timeout. Defaults to 30.
31
- intro (str, optional): Conversation introductory prompt. Defaults to None.
32
- filepath (str, optional): Path to file containing conversation history. Defaults to None.
33
- update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
34
- proxies (dict, optional): Http request proxies. Defaults to {}.
35
- history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
36
- act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
37
- model (str, optional): LLM model name. Defaults to "llama3-70b-8192".
38
- """
39
- self.is_conversation = is_conversation
40
- self.max_tokens_to_sample = max_tokens
41
- self.timeout = timeout
42
- self.last_response = {}
43
- self.model = "llama3-70b-8192",
44
- self.api_endpoint = "https://api.safone.dev/llama"
45
- self.headers = {
46
- "accept": "application/json",
47
- }
48
-
49
- self.__available_optimizers = (
50
- method
51
- for method in dir(Optimizers)
52
- if callable(getattr(Optimizers, method)) and not method.startswith("__")
53
- )
54
- Conversation.intro = (
55
- AwesomePrompts().get_act(
56
- act, raise_not_found=True, default=None, case_insensitive=True
57
- )
58
- if act
59
- else intro or Conversation.intro
60
- )
61
- self.conversation = Conversation(
62
- is_conversation, self.max_tokens_to_sample, filepath, update_file
63
- )
64
- self.conversation.history_offset = history_offset
65
- self.session = requests.Session()
66
- self.session.proxies = proxies
67
-
68
- def ask(
69
- self,
70
- prompt: str,
71
- stream: bool = False,
72
- raw: bool = False,
73
- optimizer: str = None,
74
- conversationally: bool = False,
75
- ) -> Union[dict, AsyncGenerator]:
76
- """Chat with AI
77
-
78
- Args:
79
- prompt (str): Prompt to be send.
80
- stream (bool, optional): Flag for streaming response. Defaults to False.
81
- raw (bool, optional): Stream back raw response as received. Defaults to False.
82
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
83
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
84
- Returns:
85
- dict|AsyncGenerator : ai content
86
- ```json
87
- {
88
- "text" : "print('How may I help you today?')"
89
- }
90
- ```
91
- """
92
- conversation_prompt = self.conversation.gen_complete_prompt(prompt)
93
- if optimizer:
94
- if optimizer in self.__available_optimizers:
95
- conversation_prompt = getattr(Optimizers, optimizer)(
96
- conversation_prompt if conversationally else prompt
97
- )
98
- else:
99
- raise Exception(
100
- f"Optimizer is not one of {self.__available_optimizers}"
101
- )
102
-
103
- self.session.headers.update(self.headers)
104
- payload = {
105
- "message": conversation_prompt
106
- }
107
-
108
- def for_stream():
109
- response = self.session.get(
110
- self.api_endpoint, params=payload, stream=True, timeout=self.timeout
111
- )
112
- if not response.ok:
113
- raise exceptions.FailedToGenerateResponseError(
114
- f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
115
- )
116
-
117
- message_load = ""
118
- for chunk in response.iter_lines():
119
- try:
120
- resp = json.loads(chunk)
121
- message_load += resp['message']
122
- yield chunk if raw else dict(text=message_load)
123
- self.last_response.update(resp)
124
- except:
125
- pass
126
- self.conversation.update_chat_history(
127
- prompt, self.get_message(self.last_response)
128
- )
129
-
130
- def for_non_stream():
131
- response = self.session.get(
132
- self.api_endpoint, params=payload, stream=False, timeout=self.timeout
133
- )
134
- if not response.ok:
135
- raise exceptions.FailedToGenerateResponseError(
136
- f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
137
- )
138
- resp = response.json()
139
- self.last_response.update(resp)
140
- self.conversation.update_chat_history(
141
- prompt, self.get_message(self.last_response)
142
- )
143
- return resp
144
-
145
- return for_stream() if stream else for_non_stream()
146
-
147
- def chat(
148
- self,
149
- prompt: str,
150
- stream: bool = False,
151
- optimizer: str = None,
152
- conversationally: bool = False,
153
- ) -> Union[str, AsyncGenerator]:
154
- """Generate response `str`
155
- Args:
156
- prompt (str): Prompt to be send.
157
- stream (bool, optional): Flag for streaming response. Defaults to False.
158
- optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
159
- conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
160
- Returns:
161
- str: Response generated
162
- """
163
-
164
- def for_stream():
165
- for response in self.ask(
166
- prompt, True, optimizer=optimizer, conversationally=conversationally
167
- ):
168
- yield self.get_message(response)
169
-
170
- def for_non_stream():
171
- return self.get_message(
172
- self.ask(
173
- prompt,
174
- False,
175
- optimizer=optimizer,
176
- conversationally=conversationally,
177
- )
178
- )
179
-
180
- return for_stream() if stream else for_non_stream()
181
-
182
- def get_message(self, response: dict) -> str:
183
- """Retrieves message only from response
184
-
185
- Args:
186
- response (dict): Response generated by `self.ask`
187
-
188
- Returns:
189
- str: Message extracted
190
- """
191
- assert isinstance(response, dict), "Response should be of dict data-type only"
192
- return response["message"]
193
- if __name__ == "__main__":
194
- from rich import print
195
-
196
- ai = LLAMA()
197
- # Stream the response
198
- response = ai.chat(input(">>> "))
199
- for chunk in response:
200
- print(chunk, end="", flush=True)