webscout 6.2b0__py3-none-any.whl → 6.4__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.
- webscout/AIauto.py +191 -176
- webscout/AIbase.py +112 -239
- webscout/AIutel.py +488 -1130
- webscout/Agents/functioncall.py +248 -198
- webscout/Bing_search.py +250 -153
- webscout/DWEBS.py +454 -178
- webscout/Extra/__init__.py +2 -1
- webscout/Extra/autocoder/__init__.py +9 -0
- webscout/Extra/autocoder/autocoder_utiles.py +121 -0
- webscout/Extra/autocoder/rawdog.py +681 -0
- webscout/Extra/autollama.py +246 -195
- webscout/Extra/gguf.py +441 -226
- webscout/Extra/weather.py +172 -67
- webscout/LLM.py +442 -100
- webscout/Litlogger/__init__.py +681 -0
- webscout/Local/formats.py +4 -2
- webscout/Provider/Amigo.py +19 -10
- webscout/Provider/Andi.py +0 -33
- webscout/Provider/Blackboxai.py +4 -204
- webscout/Provider/DARKAI.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/Llama3.py +1 -1
- webscout/Provider/Marcus.py +137 -0
- webscout/Provider/NinjaChat.py +1 -1
- webscout/Provider/PI.py +221 -207
- webscout/Provider/Perplexity.py +598 -598
- webscout/Provider/RoboCoders.py +206 -0
- webscout/Provider/TTI/AiForce/__init__.py +22 -0
- webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
- webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
- webscout/Provider/TTI/Nexra/__init__.py +22 -0
- webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
- webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
- webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
- webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
- webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
- webscout/Provider/TTI/__init__.py +3 -4
- webscout/Provider/TTI/artbit/__init__.py +22 -0
- webscout/Provider/TTI/artbit/async_artbit.py +184 -0
- webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
- webscout/Provider/TTI/blackbox/__init__.py +4 -0
- webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
- webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
- webscout/Provider/TTI/deepinfra/__init__.py +4 -0
- webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
- webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
- webscout/Provider/TTI/huggingface/__init__.py +22 -0
- webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
- webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
- webscout/Provider/TTI/imgninza/__init__.py +4 -0
- webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
- webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
- webscout/Provider/TTI/talkai/__init__.py +4 -0
- webscout/Provider/TTI/talkai/async_talkai.py +229 -0
- webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
- webscout/Provider/__init__.py +146 -132
- webscout/Provider/askmyai.py +158 -0
- webscout/Provider/cerebras.py +227 -206
- webscout/Provider/geminiapi.py +208 -198
- webscout/Provider/llama3mitril.py +180 -0
- webscout/Provider/llmchat.py +203 -0
- webscout/Provider/mhystical.py +176 -0
- webscout/Provider/perplexitylabs.py +265 -0
- webscout/Provider/talkai.py +196 -0
- webscout/Provider/twitterclone.py +251 -244
- webscout/Provider/typegpt.py +359 -0
- webscout/__init__.py +28 -23
- webscout/__main__.py +5 -5
- webscout/cli.py +327 -347
- webscout/conversation.py +227 -0
- webscout/exceptions.py +161 -29
- webscout/litagent/__init__.py +172 -0
- webscout/litprinter/__init__.py +831 -0
- webscout/optimizers.py +270 -0
- webscout/prompt_manager.py +279 -0
- webscout/swiftcli/__init__.py +810 -0
- webscout/transcriber.py +479 -551
- webscout/update_checker.py +125 -0
- webscout/version.py +1 -1
- webscout-6.4.dist-info/LICENSE.md +211 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/METADATA +34 -55
- webscout-6.4.dist-info/RECORD +154 -0
- webscout/Provider/TTI/AIuncensored.py +0 -103
- webscout/Provider/TTI/Nexra.py +0 -120
- webscout/Provider/TTI/PollinationsAI.py +0 -138
- webscout/Provider/TTI/WebSimAI.py +0 -142
- webscout/Provider/TTI/aiforce.py +0 -160
- webscout/Provider/TTI/artbit.py +0 -141
- webscout/Provider/TTI/deepinfra.py +0 -148
- webscout/Provider/TTI/huggingface.py +0 -155
- webscout/models.py +0 -23
- webscout-6.2b0.dist-info/LICENSE.md +0 -50
- webscout-6.2b0.dist-info/RECORD +0 -118
- /webscout/{g4f.py → gpt4free.py} +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/WHEEL +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/entry_points.txt +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/top_level.txt +0 -0
|
@@ -1,244 +1,251 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
from webscout.
|
|
5
|
-
from webscout import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
self.
|
|
43
|
-
self.
|
|
44
|
-
self.
|
|
45
|
-
self.
|
|
46
|
-
self.
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"accept
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"sec-ch-ua
|
|
62
|
-
"sec-
|
|
63
|
-
"sec-
|
|
64
|
-
"sec-fetch-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
"""
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
import random
|
|
4
|
+
from webscout.AIutel import Optimizers, Conversation, AwesomePrompts
|
|
5
|
+
from webscout.AIbase import Provider
|
|
6
|
+
from webscout import exceptions
|
|
7
|
+
|
|
8
|
+
class AIUncensored(Provider):
|
|
9
|
+
"""
|
|
10
|
+
A class to interact with the AIUncensored.info API.
|
|
11
|
+
"""
|
|
12
|
+
|
|
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
|
+
system_prompt: str = "You are a helpful AI assistant.",
|
|
25
|
+
):
|
|
26
|
+
"""
|
|
27
|
+
Initializes the AIUncensored.info API with given parameters.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
31
|
+
max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
|
|
32
|
+
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
33
|
+
intro (str, optional): Conversation introductory prompt. Defaults to None.
|
|
34
|
+
filepath (str, optional): Path to file containing conversation history. Defaults to None.
|
|
35
|
+
update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
|
|
36
|
+
proxies (dict, optional): Http request proxies. Defaults to {}.
|
|
37
|
+
history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
|
|
38
|
+
act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
|
|
39
|
+
system_prompt (str, optional): System prompt for AIUncensored.
|
|
40
|
+
Defaults to "You are a helpful AI assistant.".
|
|
41
|
+
"""
|
|
42
|
+
self.session = requests.Session()
|
|
43
|
+
self.is_conversation = is_conversation
|
|
44
|
+
self.max_tokens_to_sample = max_tokens
|
|
45
|
+
self.api_endpoint = ['https://twitterclone-i0wr.onrender.com/api/chat', 'https://twitterclone-4e8t.onrender.com/api/chat', 'https://twitterclone-8wd1.onrender.com/api/chat']
|
|
46
|
+
self.endpoint_index = 0
|
|
47
|
+
self.stream_chunk_size = 64
|
|
48
|
+
self.timeout = timeout
|
|
49
|
+
self.last_response = {}
|
|
50
|
+
self.system_prompt = system_prompt
|
|
51
|
+
self.headers = {
|
|
52
|
+
"authority": "twitterclone-i0wr.onrender.com",
|
|
53
|
+
"accept": "*/*",
|
|
54
|
+
"accept-encoding": "gzip, deflate, br, zstd",
|
|
55
|
+
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
56
|
+
"content-type": "application/json",
|
|
57
|
+
"dnt": "1",
|
|
58
|
+
"origin": "https://www.aiuncensored.info",
|
|
59
|
+
"priority": "u=1, i",
|
|
60
|
+
"referer": "https://www.aiuncensored.info/",
|
|
61
|
+
"sec-ch-ua": '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128"',
|
|
62
|
+
"sec-ch-ua-mobile": "?0",
|
|
63
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
64
|
+
"sec-fetch-dest": "empty",
|
|
65
|
+
"sec-fetch-mode": "cors",
|
|
66
|
+
"sec-fetch-site": "cross-site",
|
|
67
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0",
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
self.__available_optimizers = [
|
|
71
|
+
method for method in dir(Optimizers)
|
|
72
|
+
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
73
|
+
]
|
|
74
|
+
self.session.headers.update(self.headers)
|
|
75
|
+
Conversation.intro = (
|
|
76
|
+
AwesomePrompts().get_act(
|
|
77
|
+
act, raise_not_found=True, default=None, case_insensitive=True
|
|
78
|
+
)
|
|
79
|
+
if act
|
|
80
|
+
else intro or Conversation.intro
|
|
81
|
+
)
|
|
82
|
+
self.conversation = Conversation(
|
|
83
|
+
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
84
|
+
)
|
|
85
|
+
self.conversation.history_offset = history_offset
|
|
86
|
+
self.session.proxies = proxies
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def ask(
|
|
90
|
+
self,
|
|
91
|
+
prompt: str,
|
|
92
|
+
stream: bool = False,
|
|
93
|
+
raw: bool = False,
|
|
94
|
+
optimizer: str = None,
|
|
95
|
+
conversationally: bool = False,
|
|
96
|
+
):
|
|
97
|
+
"""
|
|
98
|
+
Chat with AI
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
prompt (str): Prompt to be sent.
|
|
102
|
+
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
103
|
+
raw (bool, optional): Stream back raw response as received. Defaults to False.
|
|
104
|
+
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
105
|
+
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
dict or generator:
|
|
109
|
+
If stream is False, returns a dict:
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"text" : "How may I assist you today?"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
If stream is True, yields dicts with incremental text.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if optimizer:
|
|
122
|
+
|
|
123
|
+
if optimizer in self.__available_optimizers:
|
|
124
|
+
try:
|
|
125
|
+
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
126
|
+
conversation_prompt if conversationally else prompt
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
except Exception as e:
|
|
130
|
+
|
|
131
|
+
raise
|
|
132
|
+
else:
|
|
133
|
+
|
|
134
|
+
raise Exception(
|
|
135
|
+
f"Optimizer is not one of {self.__available_optimizers}"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
payload = {
|
|
139
|
+
"messages": [
|
|
140
|
+
{
|
|
141
|
+
"role": "system",
|
|
142
|
+
"content": self.system_prompt
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"role": "user",
|
|
146
|
+
"content": conversation_prompt
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"cipher": "24040024"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def for_stream():
|
|
155
|
+
full_content = ''
|
|
156
|
+
with requests.post(self.api_endpoint[self.endpoint_index], headers=self.headers, json=payload, stream=True, timeout=self.timeout) as response:
|
|
157
|
+
if response.status_code == 200:
|
|
158
|
+
for line in response.iter_lines():
|
|
159
|
+
decoded_line = line.decode('utf-8').strip()
|
|
160
|
+
if decoded_line:
|
|
161
|
+
|
|
162
|
+
if decoded_line == "data: [DONE]":
|
|
163
|
+
|
|
164
|
+
break
|
|
165
|
+
if decoded_line.startswith("data: "):
|
|
166
|
+
data_str = decoded_line[len("data: "):]
|
|
167
|
+
try:
|
|
168
|
+
data_json = json.loads(data_str)
|
|
169
|
+
content = data_json.get("data", "")
|
|
170
|
+
if content:
|
|
171
|
+
full_content += content
|
|
172
|
+
yield content if raw else dict(text=content)
|
|
173
|
+
except json.JSONDecodeError:
|
|
174
|
+
raise Exception
|
|
175
|
+
self.last_response.update(dict(text=full_content))
|
|
176
|
+
self.conversation.update_chat_history(
|
|
177
|
+
prompt, self.get_message(self.last_response)
|
|
178
|
+
)
|
|
179
|
+
self.endpoint_index = (self.endpoint_index + 1) % len(self.api_endpoint)
|
|
180
|
+
def for_non_stream():
|
|
181
|
+
full_content = ''
|
|
182
|
+
for _ in for_stream():
|
|
183
|
+
pass
|
|
184
|
+
return self.last_response
|
|
185
|
+
|
|
186
|
+
return for_stream() if stream else for_non_stream()
|
|
187
|
+
|
|
188
|
+
def chat(
|
|
189
|
+
self,
|
|
190
|
+
prompt: str,
|
|
191
|
+
stream: bool = False,
|
|
192
|
+
optimizer: str = None,
|
|
193
|
+
conversationally: bool = False,
|
|
194
|
+
):
|
|
195
|
+
"""
|
|
196
|
+
Generate response `str`
|
|
197
|
+
Args:
|
|
198
|
+
prompt (str): Prompt to be sent.
|
|
199
|
+
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
200
|
+
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
201
|
+
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
202
|
+
Returns:
|
|
203
|
+
str or generator:
|
|
204
|
+
If stream is False, returns a string.
|
|
205
|
+
If stream is True, yields incremental strings.
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
def for_stream():
|
|
209
|
+
|
|
210
|
+
for response in self.ask(
|
|
211
|
+
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
212
|
+
):
|
|
213
|
+
|
|
214
|
+
yield self.get_message(response)
|
|
215
|
+
|
|
216
|
+
def for_non_stream():
|
|
217
|
+
|
|
218
|
+
response = self.ask(
|
|
219
|
+
prompt,
|
|
220
|
+
False,
|
|
221
|
+
optimizer=optimizer,
|
|
222
|
+
conversationally=conversationally,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
return self.get_message(response)
|
|
226
|
+
|
|
227
|
+
return for_stream() if stream else for_non_stream()
|
|
228
|
+
|
|
229
|
+
@staticmethod
|
|
230
|
+
def generate_cipher() -> str:
|
|
231
|
+
"""Generate a cipher in format like '3221229284179118'"""
|
|
232
|
+
return ''.join([str(random.randint(0, 9)) for _ in range(16)])
|
|
233
|
+
|
|
234
|
+
def get_message(self, response: dict) -> str:
|
|
235
|
+
"""Retrieves message only from response
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
response (dict): Response generated by `self.ask`
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
str: Message extracted
|
|
242
|
+
"""
|
|
243
|
+
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
244
|
+
return response["text"]
|
|
245
|
+
|
|
246
|
+
if __name__ == "__main__":
|
|
247
|
+
from rich import print
|
|
248
|
+
ai = AIUncensored(timeout=5000)
|
|
249
|
+
response = ai.chat("write a poem about AI", stream=True)
|
|
250
|
+
for chunk in response:
|
|
251
|
+
print(chunk, end="", flush=True)
|