webscout 8.2.3__py3-none-any.whl → 8.2.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.
- inferno/lol.py +589 -0
- webscout/AIutel.py +226 -14
- webscout/Bard.py +579 -206
- webscout/DWEBS.py +78 -35
- webscout/Extra/tempmail/base.py +1 -1
- webscout/Provider/AISEARCH/hika_search.py +4 -0
- webscout/Provider/AllenAI.py +163 -126
- webscout/Provider/ChatGPTClone.py +96 -84
- webscout/Provider/Deepinfra.py +95 -67
- webscout/Provider/ElectronHub.py +55 -0
- webscout/Provider/GPTWeb.py +96 -46
- webscout/Provider/Groq.py +194 -91
- webscout/Provider/HeckAI.py +89 -47
- webscout/Provider/HuggingFaceChat.py +113 -106
- webscout/Provider/Hunyuan.py +94 -83
- webscout/Provider/Jadve.py +107 -75
- webscout/Provider/LambdaChat.py +106 -64
- webscout/Provider/Llama3.py +94 -39
- webscout/Provider/MCPCore.py +318 -0
- webscout/Provider/Marcus.py +85 -36
- webscout/Provider/Netwrck.py +76 -43
- webscout/Provider/OPENAI/__init__.py +4 -1
- webscout/Provider/OPENAI/ai4chat.py +286 -0
- webscout/Provider/OPENAI/chatgptclone.py +35 -14
- webscout/Provider/OPENAI/deepinfra.py +37 -0
- webscout/Provider/OPENAI/groq.py +354 -0
- webscout/Provider/OPENAI/heckai.py +6 -2
- webscout/Provider/OPENAI/mcpcore.py +376 -0
- webscout/Provider/OPENAI/multichat.py +368 -0
- webscout/Provider/OPENAI/netwrck.py +3 -1
- webscout/Provider/OpenGPT.py +48 -38
- webscout/Provider/PI.py +168 -92
- webscout/Provider/PizzaGPT.py +66 -36
- webscout/Provider/TeachAnything.py +85 -51
- webscout/Provider/TextPollinationsAI.py +109 -51
- webscout/Provider/TwoAI.py +109 -60
- webscout/Provider/Venice.py +93 -56
- webscout/Provider/VercelAI.py +2 -2
- webscout/Provider/WiseCat.py +65 -28
- webscout/Provider/Writecream.py +37 -11
- webscout/Provider/WritingMate.py +135 -63
- webscout/Provider/__init__.py +3 -21
- webscout/Provider/ai4chat.py +6 -7
- webscout/Provider/copilot.py +0 -3
- webscout/Provider/elmo.py +101 -58
- webscout/Provider/granite.py +91 -46
- webscout/Provider/hermes.py +87 -47
- webscout/Provider/koala.py +1 -1
- webscout/Provider/learnfastai.py +104 -50
- webscout/Provider/llama3mitril.py +86 -51
- webscout/Provider/llmchat.py +88 -46
- webscout/Provider/llmchatco.py +74 -49
- webscout/Provider/meta.py +41 -37
- webscout/Provider/multichat.py +54 -25
- webscout/Provider/scnet.py +93 -43
- webscout/Provider/searchchat.py +82 -75
- webscout/Provider/sonus.py +103 -51
- webscout/Provider/toolbaz.py +132 -77
- webscout/Provider/turboseek.py +92 -41
- webscout/Provider/tutorai.py +82 -64
- webscout/Provider/typefully.py +75 -33
- webscout/Provider/typegpt.py +96 -35
- webscout/Provider/uncovr.py +112 -62
- webscout/Provider/x0gpt.py +69 -26
- webscout/Provider/yep.py +79 -66
- webscout/conversation.py +35 -21
- webscout/exceptions.py +20 -0
- webscout/prompt_manager.py +56 -42
- webscout/version.py +1 -1
- webscout/webscout_search.py +65 -47
- webscout/webscout_search_async.py +81 -126
- webscout/yep_search.py +93 -43
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info}/METADATA +22 -10
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info}/RECORD +78 -81
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info}/WHEEL +1 -1
- webscout/Provider/C4ai.py +0 -432
- webscout/Provider/ChatGPTES.py +0 -237
- webscout/Provider/DeepSeek.py +0 -196
- webscout/Provider/Llama.py +0 -200
- webscout/Provider/Phind.py +0 -535
- webscout/Provider/WebSim.py +0 -228
- webscout/Provider/labyrinth.py +0 -340
- webscout/Provider/lepton.py +0 -194
- webscout/Provider/llamatutor.py +0 -192
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info}/entry_points.txt +0 -0
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info/licenses}/LICENSE.md +0 -0
- {webscout-8.2.3.dist-info → webscout-8.2.4.dist-info}/top_level.txt +0 -0
webscout/Provider/DeepSeek.py
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
from typing import Any, Dict
|
|
4
|
-
from webscout.AIutel import Optimizers
|
|
5
|
-
from webscout.AIutel import Conversation
|
|
6
|
-
from webscout.AIutel import AwesomePrompts
|
|
7
|
-
from webscout.AIbase import Provider
|
|
8
|
-
from webscout import exceptions
|
|
9
|
-
|
|
10
|
-
class DeepSeek(Provider):
|
|
11
|
-
"""
|
|
12
|
-
A class to interact with the DeepSeek AI API.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
AVAILABLE_MODELS = [
|
|
16
|
-
"deepseek-v3",
|
|
17
|
-
"deepseek-r1",
|
|
18
|
-
"deepseek-llm-67b-chat"
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
def __init__(
|
|
22
|
-
self,
|
|
23
|
-
is_conversation: bool = True,
|
|
24
|
-
max_tokens: int = 600,
|
|
25
|
-
timeout: int = 30,
|
|
26
|
-
intro: str = None,
|
|
27
|
-
filepath: str = None,
|
|
28
|
-
update_file: bool = True,
|
|
29
|
-
proxies: dict = {},
|
|
30
|
-
history_offset: int = 10250,
|
|
31
|
-
act: str = None,
|
|
32
|
-
model: str = "deepseek-r1", # Default model
|
|
33
|
-
system_prompt: str = "You are a helpful AI assistant."
|
|
34
|
-
):
|
|
35
|
-
"""
|
|
36
|
-
Initializes the DeepSeek AI API with given parameters.
|
|
37
|
-
"""
|
|
38
|
-
if model not in self.AVAILABLE_MODELS:
|
|
39
|
-
raise ValueError(f"Invalid model: {model}. Choose from: {self.AVAILABLE_MODELS.keys()}")
|
|
40
|
-
|
|
41
|
-
self.session = requests.Session()
|
|
42
|
-
self.is_conversation = is_conversation
|
|
43
|
-
self.max_tokens_to_sample = max_tokens
|
|
44
|
-
self.api_endpoint = "https://www.deepseekapp.io/v1/chat/completions"
|
|
45
|
-
self.timeout = timeout
|
|
46
|
-
self.last_response = {}
|
|
47
|
-
self.system_prompt = system_prompt
|
|
48
|
-
self.model = model
|
|
49
|
-
self.api_key = "skgadi_mare_2_seater"
|
|
50
|
-
self.headers = {
|
|
51
|
-
"Content-Type": "application/json",
|
|
52
|
-
"Authorization": f"Bearer {self.api_key}",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
self.__available_optimizers = (
|
|
56
|
-
method
|
|
57
|
-
for method in dir(Optimizers)
|
|
58
|
-
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
59
|
-
)
|
|
60
|
-
self.session.headers.update(self.headers)
|
|
61
|
-
Conversation.intro = (
|
|
62
|
-
AwesomePrompts().get_act(
|
|
63
|
-
act, raise_not_found=True, default=None, case_insensitive=True
|
|
64
|
-
)
|
|
65
|
-
if act
|
|
66
|
-
else intro or Conversation.intro
|
|
67
|
-
)
|
|
68
|
-
self.conversation = Conversation(
|
|
69
|
-
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
70
|
-
)
|
|
71
|
-
self.conversation.history_offset = history_offset
|
|
72
|
-
self.session.proxies = proxies
|
|
73
|
-
|
|
74
|
-
def ask(
|
|
75
|
-
self,
|
|
76
|
-
prompt: str,
|
|
77
|
-
stream: bool = False,
|
|
78
|
-
raw: bool = False,
|
|
79
|
-
optimizer: str = None,
|
|
80
|
-
conversationally: bool = False,
|
|
81
|
-
) -> Dict[str, Any]:
|
|
82
|
-
"""Chat with AI"""
|
|
83
|
-
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
84
|
-
if optimizer:
|
|
85
|
-
if optimizer in self.__available_optimizers:
|
|
86
|
-
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
87
|
-
conversation_prompt if conversationally else prompt
|
|
88
|
-
)
|
|
89
|
-
else:
|
|
90
|
-
raise Exception(
|
|
91
|
-
f"Optimizer is not one of {self.__available_optimizers}"
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
messages = [
|
|
95
|
-
{"role": "system", "content": self.system_prompt},
|
|
96
|
-
{"role": "user", "content": conversation_prompt}
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
payload = {
|
|
100
|
-
"model": self.model,
|
|
101
|
-
"messages": messages
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
def for_stream():
|
|
105
|
-
try:
|
|
106
|
-
with requests.post(self.api_endpoint, headers=self.headers, json=payload, stream=True, timeout=self.timeout) as response:
|
|
107
|
-
if response.status_code != 200:
|
|
108
|
-
raise exceptions.FailedToGenerateResponseError(
|
|
109
|
-
f"Request failed with status code {response.status_code}"
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
streaming_text = ""
|
|
113
|
-
for line in response.iter_lines(decode_unicode=True):
|
|
114
|
-
if line:
|
|
115
|
-
line = line.strip()
|
|
116
|
-
if line.startswith("data: "):
|
|
117
|
-
json_str = line[6:] # Remove "data: " prefix
|
|
118
|
-
if json_str == "[DONE]":
|
|
119
|
-
break
|
|
120
|
-
try:
|
|
121
|
-
json_data = json.loads(json_str)
|
|
122
|
-
if 'choices' in json_data:
|
|
123
|
-
choice = json_data['choices'][0]
|
|
124
|
-
if 'delta' in choice and 'content' in choice['delta']:
|
|
125
|
-
content = choice['delta']['content']
|
|
126
|
-
streaming_text += content
|
|
127
|
-
resp = {"text": content}
|
|
128
|
-
yield resp if raw else resp
|
|
129
|
-
except json.JSONDecodeError:
|
|
130
|
-
continue
|
|
131
|
-
|
|
132
|
-
self.last_response = {"text": streaming_text}
|
|
133
|
-
self.conversation.update_chat_history(prompt, streaming_text)
|
|
134
|
-
|
|
135
|
-
except requests.RequestException as e:
|
|
136
|
-
raise exceptions.FailedToGenerateResponseError(f"Request failed: {e}")
|
|
137
|
-
|
|
138
|
-
def for_non_stream():
|
|
139
|
-
for _ in for_stream():
|
|
140
|
-
pass
|
|
141
|
-
return self.last_response
|
|
142
|
-
|
|
143
|
-
return for_stream() if stream else for_non_stream()
|
|
144
|
-
|
|
145
|
-
def chat(
|
|
146
|
-
self,
|
|
147
|
-
prompt: str,
|
|
148
|
-
stream: bool = False,
|
|
149
|
-
optimizer: str = None,
|
|
150
|
-
conversationally: bool = False,
|
|
151
|
-
) -> str:
|
|
152
|
-
"""Generate response string"""
|
|
153
|
-
def for_stream():
|
|
154
|
-
for response in self.ask(
|
|
155
|
-
prompt, True, optimizer=optimizer, conversationally=conversationally
|
|
156
|
-
):
|
|
157
|
-
yield self.get_message(response)
|
|
158
|
-
|
|
159
|
-
def for_non_stream():
|
|
160
|
-
return self.get_message(
|
|
161
|
-
self.ask(
|
|
162
|
-
prompt,
|
|
163
|
-
False,
|
|
164
|
-
optimizer=optimizer,
|
|
165
|
-
conversationally=conversationally,
|
|
166
|
-
)
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
return for_stream() if stream else for_non_stream()
|
|
170
|
-
|
|
171
|
-
def get_message(self, response: dict) -> str:
|
|
172
|
-
"""Retrieves message only from response"""
|
|
173
|
-
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
174
|
-
return response["text"]
|
|
175
|
-
|
|
176
|
-
if __name__ == "__main__":
|
|
177
|
-
print("-" * 80)
|
|
178
|
-
print(f"{'Model':<50} {'Status':<10} {'Response'}")
|
|
179
|
-
print("-" * 80)
|
|
180
|
-
|
|
181
|
-
for model in DeepSeek.AVAILABLE_MODELS:
|
|
182
|
-
try:
|
|
183
|
-
test_ai = DeepSeek(model=model, timeout=60)
|
|
184
|
-
response = test_ai.chat("Say 'Hello' in one word")
|
|
185
|
-
response_text = response
|
|
186
|
-
|
|
187
|
-
if response_text and len(response_text.strip()) > 0:
|
|
188
|
-
status = "✓"
|
|
189
|
-
# Truncate response if too long
|
|
190
|
-
display_text = response_text.strip()[:50] + "..." if len(response_text.strip()) > 50 else response_text.strip()
|
|
191
|
-
else:
|
|
192
|
-
status = "✗"
|
|
193
|
-
display_text = "Empty or invalid response"
|
|
194
|
-
print(f"{model:<50} {status:<10} {display_text}")
|
|
195
|
-
except Exception as e:
|
|
196
|
-
print(f"{model:<50} {'✗':<10} {str(e)}")
|
webscout/Provider/Llama.py
DELETED
|
@@ -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)
|