webscout 7.4__py3-none-any.whl → 7.6__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 +5 -53
- webscout/AIutel.py +8 -318
- webscout/DWEBS.py +460 -489
- webscout/Extra/YTToolkit/YTdownloader.py +14 -53
- webscout/Extra/YTToolkit/transcriber.py +12 -13
- webscout/Extra/YTToolkit/ytapi/video.py +0 -1
- webscout/Extra/__init__.py +0 -1
- webscout/Extra/autocoder/autocoder_utiles.py +0 -4
- webscout/Extra/autocoder/rawdog.py +13 -41
- webscout/Extra/gguf.py +652 -428
- webscout/Extra/weather.py +178 -156
- webscout/Extra/weather_ascii.py +70 -17
- webscout/Litlogger/core/logger.py +1 -2
- webscout/Litlogger/handlers/file.py +1 -1
- webscout/Litlogger/styles/formats.py +0 -2
- webscout/Litlogger/utils/detectors.py +0 -1
- webscout/Provider/AISEARCH/DeepFind.py +0 -1
- webscout/Provider/AISEARCH/ISou.py +1 -1
- webscout/Provider/AISEARCH/felo_search.py +0 -1
- webscout/Provider/AllenAI.py +24 -9
- webscout/Provider/C4ai.py +432 -0
- webscout/Provider/ChatGPTGratis.py +24 -56
- webscout/Provider/Cloudflare.py +18 -21
- webscout/Provider/DeepSeek.py +27 -48
- webscout/Provider/Deepinfra.py +129 -53
- webscout/Provider/Gemini.py +1 -1
- webscout/Provider/GithubChat.py +362 -0
- webscout/Provider/Glider.py +25 -8
- webscout/Provider/HF_space/qwen_qwen2.py +2 -2
- webscout/Provider/HeckAI.py +38 -5
- webscout/Provider/HuggingFaceChat.py +462 -0
- webscout/Provider/Jadve.py +20 -5
- webscout/Provider/Marcus.py +7 -50
- webscout/Provider/Netwrck.py +43 -67
- webscout/Provider/PI.py +4 -2
- webscout/Provider/Perplexitylabs.py +26 -6
- webscout/Provider/Phind.py +29 -3
- webscout/Provider/PizzaGPT.py +10 -51
- webscout/Provider/TTI/AiForce/async_aiforce.py +4 -37
- webscout/Provider/TTI/AiForce/sync_aiforce.py +41 -38
- webscout/Provider/TTI/FreeAIPlayground/__init__.py +9 -9
- webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +206 -206
- webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +192 -192
- webscout/Provider/TTI/MagicStudio/__init__.py +2 -0
- webscout/Provider/TTI/MagicStudio/async_magicstudio.py +111 -0
- webscout/Provider/TTI/MagicStudio/sync_magicstudio.py +109 -0
- webscout/Provider/TTI/PollinationsAI/async_pollinations.py +5 -24
- webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +2 -22
- webscout/Provider/TTI/__init__.py +2 -3
- webscout/Provider/TTI/aiarta/__init__.py +2 -0
- webscout/Provider/TTI/aiarta/async_aiarta.py +482 -0
- webscout/Provider/TTI/aiarta/sync_aiarta.py +440 -0
- webscout/Provider/TTI/fastflux/__init__.py +22 -0
- webscout/Provider/TTI/fastflux/async_fastflux.py +257 -0
- webscout/Provider/TTI/fastflux/sync_fastflux.py +247 -0
- webscout/Provider/TTS/__init__.py +2 -2
- webscout/Provider/TTS/deepgram.py +12 -39
- webscout/Provider/TTS/elevenlabs.py +14 -40
- webscout/Provider/TTS/gesserit.py +11 -35
- webscout/Provider/TTS/murfai.py +13 -39
- webscout/Provider/TTS/parler.py +17 -40
- webscout/Provider/TTS/speechma.py +180 -0
- webscout/Provider/TTS/streamElements.py +17 -44
- webscout/Provider/TextPollinationsAI.py +39 -59
- webscout/Provider/Venice.py +217 -200
- webscout/Provider/WiseCat.py +27 -5
- webscout/Provider/Youchat.py +63 -36
- webscout/Provider/__init__.py +13 -8
- webscout/Provider/akashgpt.py +28 -10
- webscout/Provider/copilot.py +416 -0
- webscout/Provider/flowith.py +196 -0
- webscout/Provider/freeaichat.py +32 -45
- webscout/Provider/granite.py +17 -53
- webscout/Provider/koala.py +20 -5
- webscout/Provider/llamatutor.py +7 -47
- webscout/Provider/llmchat.py +36 -53
- webscout/Provider/multichat.py +92 -98
- webscout/Provider/talkai.py +1 -0
- webscout/Provider/turboseek.py +3 -0
- webscout/Provider/tutorai.py +2 -0
- webscout/Provider/typegpt.py +154 -64
- webscout/Provider/x0gpt.py +3 -1
- webscout/Provider/yep.py +102 -20
- webscout/__init__.py +3 -0
- webscout/cli.py +4 -40
- webscout/conversation.py +1 -10
- webscout/exceptions.py +19 -9
- webscout/litagent/__init__.py +2 -2
- webscout/litagent/agent.py +351 -20
- webscout/litagent/constants.py +34 -5
- webscout/litprinter/__init__.py +0 -3
- webscout/models.py +181 -0
- webscout/optimizers.py +1 -1
- webscout/prompt_manager.py +2 -8
- webscout/scout/core/scout.py +1 -4
- webscout/scout/core/search_result.py +1 -1
- webscout/scout/core/text_utils.py +1 -1
- webscout/scout/core.py +2 -5
- webscout/scout/element.py +1 -1
- webscout/scout/parsers/html_parser.py +1 -1
- webscout/scout/utils.py +0 -1
- webscout/swiftcli/__init__.py +1 -3
- webscout/tempid.py +1 -1
- webscout/update_checker.py +55 -95
- webscout/version.py +1 -1
- webscout/webscout_search_async.py +1 -2
- webscout/yep_search.py +297 -297
- webscout-7.6.dist-info/LICENSE.md +146 -0
- {webscout-7.4.dist-info → webscout-7.6.dist-info}/METADATA +104 -514
- {webscout-7.4.dist-info → webscout-7.6.dist-info}/RECORD +113 -120
- webscout/Extra/autollama.py +0 -231
- webscout/Local/__init__.py +0 -10
- webscout/Local/_version.py +0 -3
- webscout/Local/formats.py +0 -747
- webscout/Local/model.py +0 -1368
- webscout/Local/samplers.py +0 -125
- webscout/Local/thread.py +0 -539
- webscout/Local/ui.py +0 -401
- webscout/Local/utils.py +0 -388
- webscout/Provider/Amigo.py +0 -274
- webscout/Provider/Bing.py +0 -243
- webscout/Provider/DiscordRocks.py +0 -253
- webscout/Provider/TTI/blackbox/__init__.py +0 -4
- webscout/Provider/TTI/blackbox/async_blackbox.py +0 -212
- webscout/Provider/TTI/blackbox/sync_blackbox.py +0 -199
- webscout/Provider/TTI/deepinfra/__init__.py +0 -4
- webscout/Provider/TTI/deepinfra/async_deepinfra.py +0 -227
- webscout/Provider/TTI/deepinfra/sync_deepinfra.py +0 -199
- webscout/Provider/TTI/imgninza/__init__.py +0 -4
- webscout/Provider/TTI/imgninza/async_ninza.py +0 -214
- webscout/Provider/TTI/imgninza/sync_ninza.py +0 -209
- webscout/Provider/TTS/voicepod.py +0 -117
- webscout/Provider/dgaf.py +0 -214
- webscout-7.4.dist-info/LICENSE.md +0 -211
- {webscout-7.4.dist-info → webscout-7.6.dist-info}/WHEEL +0 -0
- {webscout-7.4.dist-info → webscout-7.6.dist-info}/entry_points.txt +0 -0
- {webscout-7.4.dist-info → webscout-7.6.dist-info}/top_level.txt +0 -0
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import json
|
|
3
|
-
import time
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import Generator
|
|
6
|
-
from playsound import playsound
|
|
7
|
-
from webscout import exceptions
|
|
8
|
-
from webscout.AIbase import TTSProvider
|
|
9
|
-
|
|
10
|
-
class Voicepods(TTSProvider):
|
|
11
|
-
"""
|
|
12
|
-
A class to interact with the Voicepods text-to-speech API.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def __init__(self, timeout: int = 20, proxies: dict = None):
|
|
16
|
-
"""
|
|
17
|
-
Initializes the Voicepods API client.
|
|
18
|
-
"""
|
|
19
|
-
self.api_endpoint = "https://voicepods-stream.vercel.app/api/resemble"
|
|
20
|
-
self.headers = {
|
|
21
|
-
'Accept': '*/*',
|
|
22
|
-
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
23
|
-
'Accept-Language': 'en-US,en;q=0.9,en-IN;q=0.8',
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'DNT': '1',
|
|
26
|
-
'Origin': 'https://voicepods-stream.vercel.app',
|
|
27
|
-
'Referer': 'https://voicepods-stream.vercel.app/',
|
|
28
|
-
'Sec-CH-UA': '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128"',
|
|
29
|
-
'Sec-CH-UA-Mobile': '?0',
|
|
30
|
-
'Sec-CH-UA-Platform': '"Windows"',
|
|
31
|
-
'Sec-Fetch-Dest': 'empty',
|
|
32
|
-
'Sec-Fetch-Mode': 'cors',
|
|
33
|
-
'Sec-Fetch-Site': 'same-origin',
|
|
34
|
-
'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',
|
|
35
|
-
}
|
|
36
|
-
self.session = requests.Session()
|
|
37
|
-
self.session.headers.update(self.headers)
|
|
38
|
-
if proxies:
|
|
39
|
-
self.session.proxies.update(proxies)
|
|
40
|
-
self.timeout = timeout
|
|
41
|
-
self.audio_cache_dir = Path("./audio_cache")
|
|
42
|
-
|
|
43
|
-
def tts(self, text: str) -> str:
|
|
44
|
-
"""
|
|
45
|
-
Converts text to speech using the Voicepods API.
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
text (str): The text to be converted to speech.
|
|
49
|
-
|
|
50
|
-
Returns:
|
|
51
|
-
str: The filename of the saved audio file.
|
|
52
|
-
|
|
53
|
-
Raises:
|
|
54
|
-
exceptions.FailedToGenerateResponseError: If there is an error generating or saving the audio.
|
|
55
|
-
"""
|
|
56
|
-
payload = json.dumps({"query": text})
|
|
57
|
-
filename = self.audio_cache_dir / f"{int(time.time())}.wav" # Using timestamp for filename
|
|
58
|
-
|
|
59
|
-
try:
|
|
60
|
-
response = self.session.post(self.api_endpoint, data=payload, timeout=self.timeout)
|
|
61
|
-
response.raise_for_status()
|
|
62
|
-
|
|
63
|
-
content_type = response.headers.get('Content-Type', '')
|
|
64
|
-
if 'audio' not in content_type.lower():
|
|
65
|
-
raise ValueError(f"Unexpected content type: {content_type}")
|
|
66
|
-
|
|
67
|
-
audio_data = response.content
|
|
68
|
-
self._save_audio(audio_data, filename)
|
|
69
|
-
return filename.as_posix() # Return the filename as a string
|
|
70
|
-
|
|
71
|
-
except requests.exceptions.RequestException as e:
|
|
72
|
-
raise exceptions.FailedToGenerateResponseError(f"Error generating audio: {e}")
|
|
73
|
-
|
|
74
|
-
def _save_audio(self, audio_data: bytes, filename: Path):
|
|
75
|
-
"""Saves the audio data to a WAV file in the audio cache directory."""
|
|
76
|
-
try:
|
|
77
|
-
# Create the audio_cache directory if it doesn't exist
|
|
78
|
-
self.audio_cache_dir.mkdir(parents=True, exist_ok=True)
|
|
79
|
-
|
|
80
|
-
riff_start = audio_data.find(b'RIFF')
|
|
81
|
-
if riff_start == -1:
|
|
82
|
-
raise ValueError("RIFF header not found in audio data")
|
|
83
|
-
|
|
84
|
-
trimmed_audio_data = audio_data[riff_start:]
|
|
85
|
-
|
|
86
|
-
with open(filename, "wb") as f:
|
|
87
|
-
f.write(trimmed_audio_data)
|
|
88
|
-
|
|
89
|
-
except Exception as e:
|
|
90
|
-
raise exceptions.FailedToGenerateResponseError(f"Error saving audio: {e}")
|
|
91
|
-
|
|
92
|
-
def play_audio(self, filename: str):
|
|
93
|
-
"""
|
|
94
|
-
Plays an audio file using playsound.
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
filename (str): The path to the audio file.
|
|
98
|
-
|
|
99
|
-
Raises:
|
|
100
|
-
RuntimeError: If there is an error playing the audio.
|
|
101
|
-
"""
|
|
102
|
-
try:
|
|
103
|
-
playsound(filename)
|
|
104
|
-
except Exception as e:
|
|
105
|
-
raise RuntimeError(f"Error playing audio: {e}")
|
|
106
|
-
|
|
107
|
-
# Example usage
|
|
108
|
-
if __name__ == "__main__":
|
|
109
|
-
|
|
110
|
-
voicepods = Voicepods()
|
|
111
|
-
text = "Hello, this is a test of the Voicepods text-to-speech system."
|
|
112
|
-
|
|
113
|
-
print("Generating audio...")
|
|
114
|
-
audio_file = voicepods.tts(text)
|
|
115
|
-
|
|
116
|
-
print("Playing audio...")
|
|
117
|
-
voicepods.play_audio(audio_file)
|
webscout/Provider/dgaf.py
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import re
|
|
3
|
-
import json
|
|
4
|
-
from typing import Any, Dict, Generator, Optional
|
|
5
|
-
|
|
6
|
-
from webscout.AIutel import Optimizers
|
|
7
|
-
from webscout.AIutel import Conversation
|
|
8
|
-
from webscout.AIutel import AwesomePrompts
|
|
9
|
-
from webscout.AIbase import Provider
|
|
10
|
-
from webscout import exceptions
|
|
11
|
-
from webscout import LitAgent
|
|
12
|
-
from webscout.Litlogger import Logger, LogFormat
|
|
13
|
-
|
|
14
|
-
class DGAFAI(Provider):
|
|
15
|
-
"""
|
|
16
|
-
A class to interact with the DGAF.ai API with logging capabilities.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
def __init__(
|
|
20
|
-
self,
|
|
21
|
-
is_conversation: bool = True,
|
|
22
|
-
max_tokens: int = 600,
|
|
23
|
-
timeout: int = 30,
|
|
24
|
-
intro: str = None,
|
|
25
|
-
filepath: str = None,
|
|
26
|
-
update_file: bool = True,
|
|
27
|
-
proxies: dict = {},
|
|
28
|
-
history_offset: int = 10250,
|
|
29
|
-
act: str = None,
|
|
30
|
-
system_prompt: str = "You are a helpful AI assistant.",
|
|
31
|
-
logging: bool = False
|
|
32
|
-
):
|
|
33
|
-
"""Initializes the DGAFAI API client with logging support."""
|
|
34
|
-
self.session = requests.Session()
|
|
35
|
-
self.is_conversation = is_conversation
|
|
36
|
-
self.max_tokens_to_sample = max_tokens
|
|
37
|
-
self.api_endpoint = "https://www.dgaf.ai/api/chat"
|
|
38
|
-
self.stream_chunk_size = 64
|
|
39
|
-
self.timeout = timeout
|
|
40
|
-
self.last_response = {}
|
|
41
|
-
self.system_prompt = system_prompt
|
|
42
|
-
|
|
43
|
-
self.headers = {
|
|
44
|
-
"accept": "*/*",
|
|
45
|
-
"accept-encoding": "gzip, deflate, br, zstd",
|
|
46
|
-
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
|
|
47
|
-
"content-type": "application/json",
|
|
48
|
-
"cookie": "_ga=GA1.1.1717609725.1738729535; _ga_52CD0XKYNM=GS1.1.1738729535.1.0.1738729546.0.0.0",
|
|
49
|
-
"dnt": "1",
|
|
50
|
-
"origin": "https://www.dgaf.ai",
|
|
51
|
-
"referer": "https://www.dgaf.ai/?via=topaitools",
|
|
52
|
-
"sec-ch-ua": '"Not A(Brand";v="8", "Chromium";v="132", "Microsoft Edge";v="132"',
|
|
53
|
-
"sec-ch-ua-mobile": "?0",
|
|
54
|
-
"sec-ch-ua-platform": '"Windows"',
|
|
55
|
-
"sec-fetch-dest": "empty",
|
|
56
|
-
"sec-fetch-mode": "cors",
|
|
57
|
-
"sec-fetch-site": "same-origin",
|
|
58
|
-
"user-agent": LitAgent().random(),
|
|
59
|
-
}
|
|
60
|
-
self.session.headers.update(self.headers)
|
|
61
|
-
self.session.proxies = proxies
|
|
62
|
-
|
|
63
|
-
self.__available_optimizers = (
|
|
64
|
-
method for method in dir(Optimizers)
|
|
65
|
-
if callable(getattr(Optimizers, method)) and not method.startswith("__")
|
|
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
|
-
self.conversation = Conversation(
|
|
75
|
-
is_conversation, self.max_tokens_to_sample, filepath, update_file
|
|
76
|
-
)
|
|
77
|
-
self.conversation.history_offset = history_offset
|
|
78
|
-
|
|
79
|
-
# Initialize logger if enabled
|
|
80
|
-
self.logger = Logger(
|
|
81
|
-
name="DGAFAI",
|
|
82
|
-
format=LogFormat.MODERN_EMOJI,
|
|
83
|
-
) if logging else None
|
|
84
|
-
|
|
85
|
-
if self.logger:
|
|
86
|
-
self.logger.info("DGAFAI initialized successfully")
|
|
87
|
-
|
|
88
|
-
def ask(
|
|
89
|
-
self,
|
|
90
|
-
prompt: str,
|
|
91
|
-
stream: bool = False,
|
|
92
|
-
raw: bool = False,
|
|
93
|
-
optimizer: str = None,
|
|
94
|
-
conversationally: bool = False,
|
|
95
|
-
) -> Dict[str, Any] | Generator[str, None, None]:
|
|
96
|
-
"""Chat with AI.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
prompt (str): Prompt to be sent.
|
|
100
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
101
|
-
raw (bool, optional): Return raw streaming response as received. Defaults to False.
|
|
102
|
-
optimizer (str, optional): Prompt optimizer name. Defaults to None.
|
|
103
|
-
conversationally (bool, optional): Chat conversationally when using optimizer. Defaults to False.
|
|
104
|
-
Returns:
|
|
105
|
-
Union[Dict, Generator[Dict, None, None]]: Generated response.
|
|
106
|
-
"""
|
|
107
|
-
if self.logger:
|
|
108
|
-
self.logger.debug(f"Processing ask call with prompt: {prompt[:50]}...")
|
|
109
|
-
conversation_prompt = self.conversation.gen_complete_prompt(prompt)
|
|
110
|
-
if optimizer:
|
|
111
|
-
if optimizer in self.__available_optimizers:
|
|
112
|
-
conversation_prompt = getattr(Optimizers, optimizer)(
|
|
113
|
-
conversation_prompt if conversationally else prompt
|
|
114
|
-
)
|
|
115
|
-
if self.logger:
|
|
116
|
-
self.logger.debug(f"Applied optimizer: {optimizer}")
|
|
117
|
-
else:
|
|
118
|
-
if self.logger:
|
|
119
|
-
self.logger.error(f"Invalid optimizer requested: {optimizer}")
|
|
120
|
-
raise Exception(
|
|
121
|
-
f"Optimizer is not one of {list(self.__available_optimizers)}"
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
payload = {
|
|
125
|
-
"messages": [
|
|
126
|
-
{"role": "system", "content": self.system_prompt},
|
|
127
|
-
{"role": "user", "content": conversation_prompt}
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
def for_stream():
|
|
132
|
-
if self.logger:
|
|
133
|
-
self.logger.debug("Sending streaming request to DGAF.ai API...")
|
|
134
|
-
try:
|
|
135
|
-
with self.session.post(self.api_endpoint, headers=self.headers, json=payload, stream=True, timeout=self.timeout) as response:
|
|
136
|
-
response.raise_for_status() # Check for HTTP errors
|
|
137
|
-
if self.logger:
|
|
138
|
-
self.logger.debug(response.text)
|
|
139
|
-
streaming_text = ""
|
|
140
|
-
for line in response.iter_lines(decode_unicode=True):
|
|
141
|
-
if line:
|
|
142
|
-
match = re.search(r'0:"(.*?)"', line)
|
|
143
|
-
if match:
|
|
144
|
-
content = match.group(1)
|
|
145
|
-
if content:
|
|
146
|
-
streaming_text += content
|
|
147
|
-
# if self.logger:
|
|
148
|
-
# self.logger.debug(f"Received content: {content[:30]}...")
|
|
149
|
-
yield content if raw else dict(text=content)
|
|
150
|
-
self.last_response.update(dict(text=streaming_text))
|
|
151
|
-
self.conversation.update_chat_history(
|
|
152
|
-
prompt, self.get_message(self.last_response)
|
|
153
|
-
)
|
|
154
|
-
if self.logger:
|
|
155
|
-
self.logger.info("Streaming response completed successfully")
|
|
156
|
-
except requests.exceptions.RequestException as e:
|
|
157
|
-
if self.logger:
|
|
158
|
-
self.logger.error(f"Request error: {e}")
|
|
159
|
-
raise exceptions.ProviderConnectionError(f"Request failed: {e}")
|
|
160
|
-
|
|
161
|
-
def for_non_stream():
|
|
162
|
-
full_response = ""
|
|
163
|
-
for chunk in for_stream():
|
|
164
|
-
full_response += chunk if raw else chunk['text']
|
|
165
|
-
return {"text": full_response}
|
|
166
|
-
|
|
167
|
-
return for_stream() if stream else for_non_stream()
|
|
168
|
-
|
|
169
|
-
def chat(
|
|
170
|
-
self,
|
|
171
|
-
prompt: str,
|
|
172
|
-
stream: bool = False,
|
|
173
|
-
optimizer: str = None,
|
|
174
|
-
conversationally: bool = False,
|
|
175
|
-
) -> str | Generator[str, None, None]:
|
|
176
|
-
"""Generate chat response as a string.
|
|
177
|
-
|
|
178
|
-
Args:
|
|
179
|
-
prompt (str): Prompt to be sent.
|
|
180
|
-
stream (bool, optional): Flag for streaming response. Defaults to False.
|
|
181
|
-
optimizer (str, optional): Prompt optimizer name. Defaults to None.
|
|
182
|
-
conversationally (bool, optional): Use conversational mode when using optimizer. Defaults to False.
|
|
183
|
-
Returns:
|
|
184
|
-
str or Generator[str, None, None]: Generated response.
|
|
185
|
-
"""
|
|
186
|
-
if self.logger:
|
|
187
|
-
self.logger.debug(f"Chat method invoked with prompt: {prompt[:50]}...")
|
|
188
|
-
def for_stream():
|
|
189
|
-
for response in self.ask(prompt, True, optimizer=optimizer, conversationally=conversationally):
|
|
190
|
-
yield self.get_message(response)
|
|
191
|
-
def for_non_stream():
|
|
192
|
-
return self.get_message(
|
|
193
|
-
self.ask(prompt, False, optimizer=optimizer, conversationally=conversationally)
|
|
194
|
-
)
|
|
195
|
-
return for_stream() if stream else for_non_stream()
|
|
196
|
-
|
|
197
|
-
def get_message(self, response: dict) -> str:
|
|
198
|
-
"""Retrieves message only from response.
|
|
199
|
-
|
|
200
|
-
Args:
|
|
201
|
-
response (dict): Response from the ask method.
|
|
202
|
-
Returns:
|
|
203
|
-
str: Extracted message.
|
|
204
|
-
"""
|
|
205
|
-
assert isinstance(response, dict), "Response should be of dict data-type only"
|
|
206
|
-
return response["text"].replace('\\n', '\n').replace('\\n\\n', '\n\n')
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if __name__ == "__main__":
|
|
210
|
-
from rich import print
|
|
211
|
-
ai = DGAFAI(logging=False)
|
|
212
|
-
response = ai.chat("write a poem about AI", stream=True)
|
|
213
|
-
for chunk in response:
|
|
214
|
-
print(chunk, end="", flush=True)
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
# HelpingAI License
|
|
2
|
-
Version 3.0
|
|
3
|
-
Copyright (c) 2024 HelpingAI
|
|
4
|
-
All Rights Reserved.
|
|
5
|
-
|
|
6
|
-
## PREAMBLE
|
|
7
|
-
The HelpingAI License (the "License") is designed to govern the use, modification, and distribution of HelpingAI's proprietary assets, including but not limited to artificial intelligence models, software, algorithms, weights, documentation, datasets, and associated materials (collectively, the "Content"). This License aims to balance open innovation with the protection of HelpingAI's intellectual property rights while ensuring responsible and ethical use of AI technology.
|
|
8
|
-
|
|
9
|
-
## 1. DEFINITIONS
|
|
10
|
-
1.1. "Model" means any machine learning model, artificial intelligence system, neural network architecture, or AI-powered solution developed by HelpingAI.
|
|
11
|
-
|
|
12
|
-
1.2. "Weights" refers to the trained parameters, embeddings, model checkpoints, and other numerical values that define the behavior and capabilities of the Model.
|
|
13
|
-
|
|
14
|
-
1.3. "Source Code" means the human-readable form of software, documentation, configuration files, and associated resources.
|
|
15
|
-
|
|
16
|
-
1.4. "Derivative Work" means any work that is based upon or derived from the Content, including but not limited to:
|
|
17
|
-
a) Fine-tuned or adapted versions of the Model
|
|
18
|
-
b) Modified or enhanced versions of the Source Code
|
|
19
|
-
c) Products, services, or applications that incorporate the Content
|
|
20
|
-
d) Adaptations, transformations, or improvements of the Content
|
|
21
|
-
e) Any output generated using the Model or Content
|
|
22
|
-
|
|
23
|
-
1.5. "Commercial Use" means any use of the Content intended for or directed toward:
|
|
24
|
-
a) Commercial advantage or monetary compensation
|
|
25
|
-
b) Revenue generation, either directly or indirectly
|
|
26
|
-
c) Business operations or commercial services
|
|
27
|
-
d) Integration into commercial products or offerings
|
|
28
|
-
|
|
29
|
-
1.6. "End User" means any individual or entity that uses the Content or Derivative Works.
|
|
30
|
-
|
|
31
|
-
## 2. GRANT OF RIGHTS
|
|
32
|
-
Subject to the terms and conditions of this License, HelpingAI hereby grants you a limited, non-exclusive, non-transferable, revocable license to:
|
|
33
|
-
|
|
34
|
-
2.1. Access and use the Content for:
|
|
35
|
-
a) Research and evaluation purposes
|
|
36
|
-
b) Educational and academic use
|
|
37
|
-
c) Personal, non-commercial projects
|
|
38
|
-
d) Open-source contributions (subject to Section 3)
|
|
39
|
-
|
|
40
|
-
2.2. Create and use Derivative Works for non-commercial purposes, provided that:
|
|
41
|
-
a) You comply with all restrictions in Section 3
|
|
42
|
-
b) You maintain appropriate attribution
|
|
43
|
-
c) You ensure responsible and ethical use
|
|
44
|
-
|
|
45
|
-
2.3. Distribute the Content or Derivative Works to third parties, provided that:
|
|
46
|
-
a) You maintain all copyright notices and attributions
|
|
47
|
-
b) You include a complete, unmodified copy of this License
|
|
48
|
-
c) You clearly document any modifications made
|
|
49
|
-
d) You comply with all restrictions in Section 3
|
|
50
|
-
e) You ensure recipients agree to this License
|
|
51
|
-
|
|
52
|
-
## 3. RESTRICTIONS AND LIMITATIONS
|
|
53
|
-
3.1. **Commercial Use Restrictions**
|
|
54
|
-
You may not use the Content or any Derivative Works for Commercial Use without:
|
|
55
|
-
a) Obtaining a separate commercial license from HelpingAI
|
|
56
|
-
b) Paying applicable fees and royalties
|
|
57
|
-
c) Receiving written authorization
|
|
58
|
-
|
|
59
|
-
3.2. **Model Usage Restrictions**
|
|
60
|
-
You may not:
|
|
61
|
-
a) Use the Model to train or develop competing AI models or services
|
|
62
|
-
b) Extract, reverse engineer, or decompile the Model's architecture or weights
|
|
63
|
-
c) Remove, disable, or circumvent any access controls or security measures
|
|
64
|
-
d) Use the Model for military purposes, weapons development, or harmful applications
|
|
65
|
-
e) Use the Model to generate harmful, discriminatory, or illegal content
|
|
66
|
-
f) Use the Model in safety-critical applications without explicit written permission
|
|
67
|
-
g) Use the Model in ways that violate privacy or data protection laws
|
|
68
|
-
h) Create autonomous systems that could cause harm to individuals or society
|
|
69
|
-
|
|
70
|
-
3.3. **Distribution Restrictions**
|
|
71
|
-
You may not:
|
|
72
|
-
a) Redistribute the Model's weights or checkpoints without explicit permission
|
|
73
|
-
b) Create hosted APIs or services that provide direct access to the Model
|
|
74
|
-
c) Bundle or integrate the Content with commercial products or services
|
|
75
|
-
d) Sublicense or transfer rights to the Content to third parties
|
|
76
|
-
e) Distribute the Content in ways that could harm HelpingAI's interests
|
|
77
|
-
|
|
78
|
-
3.4. **Branding and Attribution**
|
|
79
|
-
You must:
|
|
80
|
-
a) Maintain all HelpingAI branding, logos, notices, and watermarks
|
|
81
|
-
b) Include the following attribution in all Derivative Works:
|
|
82
|
-
"Powered by HelpingAI technology, licensed under the HelpingAI License v3.0"
|
|
83
|
-
c) Not use HelpingAI's name, logos, or trademarks to endorse or promote products
|
|
84
|
-
d) Not suggest any official association with HelpingAI without permission
|
|
85
|
-
|
|
86
|
-
## 4. INTELLECTUAL PROPERTY
|
|
87
|
-
4.1. HelpingAI retains all rights, title, and interest in and to the Content, including:
|
|
88
|
-
a) All intellectual property rights
|
|
89
|
-
b) Patents, trademarks, and trade secrets
|
|
90
|
-
c) Proprietary methods and algorithms
|
|
91
|
-
d) Future improvements and modifications
|
|
92
|
-
|
|
93
|
-
4.2. This License does not grant you any rights to HelpingAI's:
|
|
94
|
-
a) Patents or patent applications
|
|
95
|
-
b) Trademarks or service marks
|
|
96
|
-
c) Trade secrets or proprietary information
|
|
97
|
-
d) Other intellectual property except as expressly stated
|
|
98
|
-
|
|
99
|
-
4.3. Derivative Works:
|
|
100
|
-
a) You retain ownership of original portions of Derivative Works you create
|
|
101
|
-
b) HelpingAI retains all rights to the underlying Content
|
|
102
|
-
c) You grant HelpingAI a perpetual license to any improvements or feedback
|
|
103
|
-
|
|
104
|
-
## 5. DATA COLLECTION AND PRIVACY
|
|
105
|
-
5.1. Data Collection:
|
|
106
|
-
a) HelpingAI may collect usage data and performance metrics
|
|
107
|
-
b) Analytics may be used to improve the Content
|
|
108
|
-
c) Collection will comply with applicable privacy laws
|
|
109
|
-
|
|
110
|
-
5.2. Privacy Requirements:
|
|
111
|
-
a) You must comply with all applicable privacy laws and regulations
|
|
112
|
-
b) You must provide appropriate privacy notices to End Users
|
|
113
|
-
c) You must obtain necessary consents for data collection
|
|
114
|
-
d) You must implement appropriate data security measures
|
|
115
|
-
|
|
116
|
-
## 6. WARRANTY DISCLAIMER
|
|
117
|
-
THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO:
|
|
118
|
-
a) WARRANTIES OF MERCHANTABILITY
|
|
119
|
-
b) FITNESS FOR A PARTICULAR PURPOSE
|
|
120
|
-
c) NON-INFRINGEMENT
|
|
121
|
-
d) ACCURACY OR COMPLETENESS
|
|
122
|
-
e) ABSENCE OF ERRORS OR DEFECTS
|
|
123
|
-
f) COMPATIBILITY WITH OTHER SOFTWARE
|
|
124
|
-
g) SECURITY OR PERFORMANCE
|
|
125
|
-
|
|
126
|
-
## 7. LIMITATION OF LIABILITY
|
|
127
|
-
7.1. IN NO EVENT SHALL HELPINGAI BE LIABLE FOR ANY:
|
|
128
|
-
a) DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
|
129
|
-
b) LOSS OF PROFITS OR BUSINESS OPPORTUNITIES
|
|
130
|
-
c) BUSINESS INTERRUPTION OR LOST DATA
|
|
131
|
-
d) PERSONAL INJURY OR PROPERTY DAMAGE
|
|
132
|
-
e) ANY OTHER DAMAGES OR LOSSES
|
|
133
|
-
|
|
134
|
-
7.2. THIS LIMITATION APPLIES TO:
|
|
135
|
-
a) CONTRACT OR TORT CLAIMS
|
|
136
|
-
b) BREACH OF WARRANTY
|
|
137
|
-
c) ANY OTHER LEGAL THEORY
|
|
138
|
-
d) ALL USES OF THE CONTENT
|
|
139
|
-
|
|
140
|
-
## 8. TERMINATION
|
|
141
|
-
8.1. Automatic Termination:
|
|
142
|
-
a) This License terminates automatically upon any breach
|
|
143
|
-
b) No notice is required for termination
|
|
144
|
-
c) All rights granted immediately cease
|
|
145
|
-
|
|
146
|
-
8.2. Upon Termination:
|
|
147
|
-
a) Cease all use of the Content
|
|
148
|
-
b) Destroy all copies and installations
|
|
149
|
-
c) Stop distribution of Derivative Works
|
|
150
|
-
d) Certify compliance with termination terms
|
|
151
|
-
|
|
152
|
-
8.3. Survival:
|
|
153
|
-
a) Sections 4, 6, 7, 9, and 10 survive termination
|
|
154
|
-
b) Obligations to protect intellectual property continue
|
|
155
|
-
c) Liability limitations remain in effect
|
|
156
|
-
|
|
157
|
-
## 9. GOVERNING LAW AND JURISDICTION
|
|
158
|
-
9.1. This License shall be governed by and construed in accordance with:
|
|
159
|
-
a) The laws of the United States of America
|
|
160
|
-
b) The State of California
|
|
161
|
-
c) Without regard to conflicts of law principles
|
|
162
|
-
|
|
163
|
-
9.2. Dispute Resolution:
|
|
164
|
-
a) Exclusive jurisdiction in Santa Clara County, California
|
|
165
|
-
b) Agreement to personal jurisdiction
|
|
166
|
-
c) Waiver of jury trial
|
|
167
|
-
d) Prevailing party entitled to attorney fees
|
|
168
|
-
|
|
169
|
-
## 10. EXPORT COMPLIANCE
|
|
170
|
-
10.1. You must comply with all applicable:
|
|
171
|
-
a) Export control laws and regulations
|
|
172
|
-
b) Trade sanctions and embargoes
|
|
173
|
-
c) International trade restrictions
|
|
174
|
-
d) Anti-boycott regulations
|
|
175
|
-
|
|
176
|
-
10.2. You may not export the Content to:
|
|
177
|
-
a) Prohibited countries or regions
|
|
178
|
-
b) Restricted end users
|
|
179
|
-
c) Prohibited end uses
|
|
180
|
-
|
|
181
|
-
## 11. MODIFICATIONS TO LICENSE
|
|
182
|
-
11.1. License Updates:
|
|
183
|
-
a) HelpingAI may modify this License at any time
|
|
184
|
-
b) Changes effective upon posting
|
|
185
|
-
c) Continued use constitutes acceptance
|
|
186
|
-
|
|
187
|
-
11.2. Notification:
|
|
188
|
-
a) Material changes will be announced
|
|
189
|
-
b) Users should regularly review terms
|
|
190
|
-
c) Opt-out requires discontinuing use
|
|
191
|
-
|
|
192
|
-
## 12. SUPPORT AND UPDATES
|
|
193
|
-
12.1. No Obligation:
|
|
194
|
-
a) HelpingAI has no obligation to provide support
|
|
195
|
-
b) Updates and maintenance are discretionary
|
|
196
|
-
c) Services may be modified or discontinued
|
|
197
|
-
|
|
198
|
-
12.2. Available Support:
|
|
199
|
-
a) Documentation and resources provided "as is"
|
|
200
|
-
b) Community forums may be available
|
|
201
|
-
c) Commercial support requires separate agreement
|
|
202
|
-
|
|
203
|
-
<!-- ## 13. CONTACT INFORMATION
|
|
204
|
-
For licensing inquiries, permissions, or compliance:
|
|
205
|
-
- Website: https://helpingai.co
|
|
206
|
-
- Email: license@helpingai.co
|
|
207
|
-
- Address: [Company Address] -->
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
Last Updated: NOVEMBER 2024
|
|
211
|
-
END OF LICENSE
|
|
File without changes
|
|
File without changes
|
|
File without changes
|