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/lepton.py
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import re
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
from webscout.AIutel import Optimizers
|
|
6
|
-
from webscout.AIutel import Conversation
|
|
7
|
-
from webscout.AIutel import AwesomePrompts
|
|
8
|
-
from webscout.AIbase import Provider
|
|
9
|
-
from webscout.litagent import LitAgent as Lit
|
|
10
|
-
class Lepton(Provider):
|
|
11
|
-
"""
|
|
12
|
-
A class to interact with the Lepton.run API.
|
|
13
|
-
"""
|
|
14
|
-
def __init__(
|
|
15
|
-
self,
|
|
16
|
-
is_conversation: bool = True,
|
|
17
|
-
max_tokens: int = 600,
|
|
18
|
-
timeout: int = 30,
|
|
19
|
-
intro: str = None,
|
|
20
|
-
filepath: str = None,
|
|
21
|
-
update_file: bool = True,
|
|
22
|
-
proxies: dict = {},
|
|
23
|
-
history_offset: int = 10250,
|
|
24
|
-
act: str = None,
|
|
25
|
-
) -> None:
|
|
26
|
-
"""Instantiates Lepton
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
|
|
30
|
-
max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
|
|
31
|
-
timeout (int, optional): Http request timeout. Defaults to 30.
|
|
32
|
-
intro (str, optional): Conversation introductory prompt. Defaults to None.
|
|
33
|
-
filepath (str, optional): Path to file containing conversation history. Defaults to None.
|
|
34
|
-
update_file (bool, optional): Add new prompts and responses to the file. Defaults to True.
|
|
35
|
-
proxies (dict, optional): Http request proxies. Defaults to {}.
|
|
36
|
-
history_offset (int, optional): Limit conversation history to this number of last texts. Defaults to 10250.
|
|
37
|
-
act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
|
|
38
|
-
"""
|
|
39
|
-
self.session = requests.Session()
|
|
40
|
-
self.is_conversation = is_conversation
|
|
41
|
-
self.max_tokens_to_sample = max_tokens
|
|
42
|
-
self.api_endpoint = "https://search.lepton.run/api/query"
|
|
43
|
-
self.stream_chunk_size = 64
|
|
44
|
-
self.timeout = timeout
|
|
45
|
-
self.last_response = {}
|
|
46
|
-
self.headers = {
|
|
47
|
-
"accept": "*/*",
|
|
48
|
-
"accept-encoding": "gzip, deflate, br, zstd",
|
|
49
|
-
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
50
|
-
"content-type": "text/plain;charset=UTF-8",
|
|
51
|
-
"dnt": "1",
|
|
52
|
-
"origin": "https://search.lepton.run",
|
|
53
|
-
"priority": "u=1, i",
|
|
54
|
-
"referer": "https://search.lepton.run/search?q=BYSyA&rid=aqZSHQomzwBBF3fyHnrND",
|
|
55
|
-
"sec-ch-ua": '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128"',
|
|
56
|
-
"sec-ch-ua-mobile": "?0",
|
|
57
|
-
"sec-ch-ua-platform": '"Windows"',
|
|
58
|
-
"sec-fetch-dest": "empty",
|
|
59
|
-
"sec-fetch-mode": "cors",
|
|
60
|
-
"sec-fetch-site": "same-origin",
|
|
61
|
-
"user-agent": Lit().random(),
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
self.__available_optimizers = (
|
|
65
|
-
method
|
|
66
|
-
for method in dir(Optimizers)
|
|
67
|
-
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
68
|
-
)
|
|
69
|
-
self.session.headers.update(self.headers)
|
|
70
|
-
Conversation.intro = (
|
|
71
|
-
AwesomePrompts().get_act(
|
|
72
|
-
act, raise_not_found=True, default=None, case_insensitive=True
|
|
73
|
-
)
|
|
74
|
-
if act
|
|
75
|
-
else intro or Conversation.intro
|
|
76
|
-
)
|
|
77
|
-
self.conversation = Conversation(
|
|
78
|
-
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
79
|
-
)
|
|
80
|
-
self.conversation.history_offset = history_offset
|
|
81
|
-
self.session.proxies = proxies
|
|
82
|
-
|
|
83
|
-
def ask(
|
|
84
|
-
self,
|
|
85
|
-
prompt: str,
|
|
86
|
-
stream: bool = False,
|
|
87
|
-
raw: bool = False,
|
|
88
|
-
optimizer: str = None,
|
|
89
|
-
conversationally: bool = False,
|
|
90
|
-
) -> dict:
|
|
91
|
-
"""Chat with AI
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
prompt (str): Prompt to be send.
|
|
95
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
96
|
-
raw (bool, optional): Stream back raw response as received. Defaults to False.
|
|
97
|
-
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
98
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
99
|
-
Returns:
|
|
100
|
-
dict : {}
|
|
101
|
-
```json
|
|
102
|
-
{
|
|
103
|
-
"text" : "How may I assist you today?"
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
"""
|
|
107
|
-
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
108
|
-
if optimizer:
|
|
109
|
-
if optimizer in self.__available_optimizers:
|
|
110
|
-
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
111
|
-
conversation_prompt if conversationally else prompt
|
|
112
|
-
)
|
|
113
|
-
else:
|
|
114
|
-
raise Exception(
|
|
115
|
-
f"Optimizer is not one of {self.__available_optimizers}"
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
self.session.headers.update(self.headers)
|
|
119
|
-
payload = json.dumps({"query": conversation_prompt})
|
|
120
|
-
|
|
121
|
-
def for_non_stream():
|
|
122
|
-
response = self.session.post(
|
|
123
|
-
self.api_endpoint, data=payload, headers=self.headers, timeout=self.timeout
|
|
124
|
-
)
|
|
125
|
-
if not response.ok:
|
|
126
|
-
raise Exception(
|
|
127
|
-
f"Failed to generate response - ({response.status_code}, {response.reason}) - {response.text}"
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
response_text = response.text
|
|
131
|
-
start_marker = "__LLM_RESPONSE__"
|
|
132
|
-
end_marker = "__RELATED_QUESTIONS__"
|
|
133
|
-
|
|
134
|
-
start_index = response_text.find(start_marker) + len(start_marker)
|
|
135
|
-
end_index = response_text.find(end_marker)
|
|
136
|
-
|
|
137
|
-
if start_index != -1 and end_index != -1:
|
|
138
|
-
extracted_text = response_text[start_index:end_index].strip()
|
|
139
|
-
|
|
140
|
-
# Remove citations using regular expression
|
|
141
|
-
cleaned_text = re.sub(r'\[citation:\d+\]', '', extracted_text)
|
|
142
|
-
|
|
143
|
-
self.last_response.update(dict(text=cleaned_text))
|
|
144
|
-
|
|
145
|
-
self.conversation.update_chat_history(
|
|
146
|
-
prompt, self.get_message(self.last_response)
|
|
147
|
-
)
|
|
148
|
-
return self.last_response
|
|
149
|
-
|
|
150
|
-
return for_non_stream()
|
|
151
|
-
|
|
152
|
-
def chat(
|
|
153
|
-
self,
|
|
154
|
-
prompt: str,
|
|
155
|
-
stream: bool = False,
|
|
156
|
-
optimizer: str = None,
|
|
157
|
-
conversationally: bool = False,
|
|
158
|
-
) -> str:
|
|
159
|
-
"""Generate response `str`
|
|
160
|
-
Args:
|
|
161
|
-
prompt (str): Prompt to be send.
|
|
162
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
163
|
-
optimizer (str, optional): Prompt optimizer name - `[code, shell_command]`. Defaults to None.
|
|
164
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
165
|
-
Returns:
|
|
166
|
-
str: Response generated
|
|
167
|
-
"""
|
|
168
|
-
|
|
169
|
-
return self.get_message(
|
|
170
|
-
self.ask(
|
|
171
|
-
prompt,
|
|
172
|
-
optimizer=optimizer,
|
|
173
|
-
conversationally=conversationally,
|
|
174
|
-
)
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
def get_message(self, response: dict) -> str:
|
|
178
|
-
"""Retrieves message only from response
|
|
179
|
-
|
|
180
|
-
Args:
|
|
181
|
-
response (dict): Response generated by `self.ask`
|
|
182
|
-
|
|
183
|
-
Returns:
|
|
184
|
-
str: Message extracted
|
|
185
|
-
"""
|
|
186
|
-
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
187
|
-
return response["text"]
|
|
188
|
-
|
|
189
|
-
if __name__ == '__main__':
|
|
190
|
-
from rich import print
|
|
191
|
-
ai = Lepton()
|
|
192
|
-
response = ai.chat("hi")
|
|
193
|
-
for chunk in response:
|
|
194
|
-
print(chunk, end="", flush=True)
|
webscout/Provider/llamatutor.py
DELETED
|
@@ -1,192 +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
|
|
7
|
-
from webscout.AIbase import Provider
|
|
8
|
-
from webscout import exceptions
|
|
9
|
-
from webscout.litagent import LitAgent as Lit
|
|
10
|
-
|
|
11
|
-
class LlamaTutor(Provider):
|
|
12
|
-
"""
|
|
13
|
-
A class to interact with the LlamaTutor API (Together.ai)
|
|
14
|
-
"""
|
|
15
|
-
AVAILABLE_MODELS = ["UNKNOWN"]
|
|
16
|
-
def __init__(
|
|
17
|
-
self,
|
|
18
|
-
is_conversation: bool = True,
|
|
19
|
-
max_tokens: int = 600,
|
|
20
|
-
timeout: int = 30,
|
|
21
|
-
intro: str = None,
|
|
22
|
-
filepath: str = None,
|
|
23
|
-
update_file: bool = True,
|
|
24
|
-
proxies: dict = {},
|
|
25
|
-
history_offset: int = 10250,
|
|
26
|
-
act: str = None,
|
|
27
|
-
system_prompt: str = "You are a helpful AI assistant."
|
|
28
|
-
):
|
|
29
|
-
"""
|
|
30
|
-
Initializes the LlamaTutor API with given parameters.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
self.session = requests.Session()
|
|
34
|
-
self.is_conversation = is_conversation
|
|
35
|
-
self.max_tokens_to_sample = max_tokens
|
|
36
|
-
self.api_endpoint = "https://llamatutor.together.ai/api/getChat"
|
|
37
|
-
self.stream_chunk_size = 64
|
|
38
|
-
self.timeout = timeout
|
|
39
|
-
self.last_response = {}
|
|
40
|
-
self.system_prompt = system_prompt
|
|
41
|
-
|
|
42
|
-
self.headers = {
|
|
43
|
-
"Content-Type": "application/json",
|
|
44
|
-
"Accept": "*/*",
|
|
45
|
-
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
46
|
-
"Accept-Language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
47
|
-
"DNT": "1",
|
|
48
|
-
"Origin": "https://llamatutor.together.ai",
|
|
49
|
-
"Referer": "https://llamatutor.together.ai/",
|
|
50
|
-
"Sec-Ch-Ua": '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128"',
|
|
51
|
-
"Sec-Ch-Ua-Mobile": "?0",
|
|
52
|
-
"Sec-Ch-Ua-Platform": '"Windows"',
|
|
53
|
-
"Sec-Fetch-Dest": "empty",
|
|
54
|
-
"Sec-Fetch-Mode": "cors",
|
|
55
|
-
"Sec-Fetch-Site": "same-origin",
|
|
56
|
-
"User-Agent": Lit().random(),
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
self.__available_optimizers = (
|
|
60
|
-
method
|
|
61
|
-
for method in dir(Optimizers)
|
|
62
|
-
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
self.session.headers.update(self.headers)
|
|
66
|
-
|
|
67
|
-
Conversation.intro = (
|
|
68
|
-
AwesomePrompts().get_act(
|
|
69
|
-
act, raise_not_found=True, default=None, case_insensitive=True
|
|
70
|
-
)
|
|
71
|
-
if act
|
|
72
|
-
else intro or Conversation.intro
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
self.conversation = Conversation(
|
|
76
|
-
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
77
|
-
)
|
|
78
|
-
self.conversation.history_offset = history_offset
|
|
79
|
-
self.session.proxies = proxies
|
|
80
|
-
|
|
81
|
-
def ask(
|
|
82
|
-
self,
|
|
83
|
-
prompt: str,
|
|
84
|
-
stream: bool = False,
|
|
85
|
-
raw: bool = False,
|
|
86
|
-
optimizer: str = None,
|
|
87
|
-
conversationally: bool = False,
|
|
88
|
-
) -> dict:
|
|
89
|
-
"""Chat with LlamaTutor"""
|
|
90
|
-
|
|
91
|
-
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
92
|
-
if optimizer:
|
|
93
|
-
if optimizer in self.__available_optimizers:
|
|
94
|
-
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
95
|
-
conversation_prompt if conversationally else prompt
|
|
96
|
-
)
|
|
97
|
-
else:
|
|
98
|
-
raise Exception(f"Optimizer is not one of {self.__available_optimizers}")
|
|
99
|
-
|
|
100
|
-
payload = {
|
|
101
|
-
"messages": [
|
|
102
|
-
{
|
|
103
|
-
"role": "system",
|
|
104
|
-
"content": self.system_prompt
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"role": "user",
|
|
108
|
-
"content": conversation_prompt
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
def for_stream():
|
|
114
|
-
try:
|
|
115
|
-
|
|
116
|
-
response = requests.post(
|
|
117
|
-
self.api_endpoint,
|
|
118
|
-
headers=self.headers,
|
|
119
|
-
data=json.dumps(payload),
|
|
120
|
-
stream=True,
|
|
121
|
-
timeout=self.timeout
|
|
122
|
-
)
|
|
123
|
-
response.raise_for_status()
|
|
124
|
-
|
|
125
|
-
full_response = ''
|
|
126
|
-
for line in response.iter_lines(decode_unicode=True):
|
|
127
|
-
if line:
|
|
128
|
-
try:
|
|
129
|
-
decoded_line = line.decode('utf-8')
|
|
130
|
-
if decoded_line.startswith("data: "):
|
|
131
|
-
json_data = json.loads(decoded_line[6:])
|
|
132
|
-
if "text" in json_data:
|
|
133
|
-
full_response += json_data["text"]
|
|
134
|
-
yield json_data["text"] if raw else dict(text=json_data["text"])
|
|
135
|
-
except json.JSONDecodeError as e:
|
|
136
|
-
continue
|
|
137
|
-
|
|
138
|
-
self.last_response.update(dict(text=full_response))
|
|
139
|
-
self.conversation.update_chat_history(
|
|
140
|
-
prompt, self.get_message(self.last_response)
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
except requests.exceptions.HTTPError as http_err:
|
|
144
|
-
raise exceptions.FailedToGenerateResponseError(f"HTTP error occurred: {http_err}")
|
|
145
|
-
except requests.exceptions.RequestException as err:
|
|
146
|
-
raise exceptions.FailedToGenerateResponseError(f"An error occurred: {err}")
|
|
147
|
-
|
|
148
|
-
def for_non_stream():
|
|
149
|
-
for _ in for_stream():
|
|
150
|
-
pass
|
|
151
|
-
return self.last_response
|
|
152
|
-
|
|
153
|
-
return for_stream() if stream else for_non_stream()
|
|
154
|
-
|
|
155
|
-
def chat(
|
|
156
|
-
self,
|
|
157
|
-
prompt: str,
|
|
158
|
-
stream: bool = False,
|
|
159
|
-
optimizer: str = None,
|
|
160
|
-
conversationally: bool = False,
|
|
161
|
-
) -> str:
|
|
162
|
-
"""Generate response"""
|
|
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 from response with validation"""
|
|
184
|
-
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
185
|
-
return response["text"]
|
|
186
|
-
|
|
187
|
-
if __name__ == "__main__":
|
|
188
|
-
from rich import print
|
|
189
|
-
ai = LlamaTutor()
|
|
190
|
-
response = ai.chat("Write a poem about AI", stream=True)
|
|
191
|
-
for chunk in response:
|
|
192
|
-
print(chunk, end="", flush=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|