webscout 2.3b0__py3-none-any.whl → 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.
- webscout/Local/__init__.py +10 -0
- webscout/Local/_version.py +3 -0
- webscout/Local/formats.py +482 -0
- webscout/Local/model.py +702 -0
- webscout/Local/samplers.py +161 -0
- webscout/Local/thread.py +680 -0
- webscout/Local/utils.py +185 -0
- webscout/__init__.py +4 -5
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/METADATA +6 -6
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/RECORD +14 -7
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/LICENSE.md +0 -0
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/WHEEL +0 -0
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/entry_points.txt +0 -0
- {webscout-2.3b0.dist-info → webscout-2.4.dist-info}/top_level.txt +0 -0
webscout/Local/utils.py
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
from ._version import __version__, __llama_cpp_version__
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
from typing import Any, Iterable, TextIO
|
|
7
|
+
from time import strftime
|
|
8
|
+
from enum import IntEnum
|
|
9
|
+
from struct import unpack
|
|
10
|
+
from colorama import Fore
|
|
11
|
+
from huggingface_hub import hf_hub_url, cached_download
|
|
12
|
+
|
|
13
|
+
# color codes used in Thread.interact()
|
|
14
|
+
RESET_ALL = Fore.RESET
|
|
15
|
+
USER_STYLE = RESET_ALL + Fore.GREEN
|
|
16
|
+
BOT_STYLE = RESET_ALL + Fore.CYAN
|
|
17
|
+
DIM_STYLE = RESET_ALL + Fore.LIGHTBLACK_EX
|
|
18
|
+
SPECIAL_STYLE = RESET_ALL + Fore.YELLOW
|
|
19
|
+
|
|
20
|
+
# for typing of softmax parameter `z`
|
|
21
|
+
class _ArrayLike(Iterable):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
# for typing of Model.stream_print() parameter `file`
|
|
25
|
+
class _SupportsWriteAndFlush(TextIO):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def download_model(repo_id: str, filename: str, cache_dir: str = ".cache") -> str:
|
|
29
|
+
"""
|
|
30
|
+
Downloads a GGUF model file from Hugging Face Hub.
|
|
31
|
+
|
|
32
|
+
repo_id: The Hugging Face repository ID (e.g., 'facebook/bart-large-cnn').
|
|
33
|
+
filename: The name of the GGUF file within the repository (e.g., 'model.gguf').
|
|
34
|
+
cache_dir: The directory where the downloaded file should be stored.
|
|
35
|
+
|
|
36
|
+
Returns: The path to the downloaded file.
|
|
37
|
+
"""
|
|
38
|
+
url = hf_hub_url(repo_id, filename)
|
|
39
|
+
filepath = cached_download(url, cache_dir=cache_dir, force_filename=filename)
|
|
40
|
+
return filepath
|
|
41
|
+
|
|
42
|
+
class GGUFReader:
|
|
43
|
+
"""
|
|
44
|
+
Peek at file header for GGUF metadata
|
|
45
|
+
|
|
46
|
+
Raise ValueError if file is not GGUF or is outdated
|
|
47
|
+
|
|
48
|
+
Credit to oobabooga for the parts of the code in this class
|
|
49
|
+
|
|
50
|
+
Format spec: https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
class GGUFValueType(IntEnum):
|
|
54
|
+
UINT8 = 0
|
|
55
|
+
INT8 = 1
|
|
56
|
+
UINT16 = 2
|
|
57
|
+
INT16 = 3
|
|
58
|
+
UINT32 = 4
|
|
59
|
+
INT32 = 5
|
|
60
|
+
FLOAT32 = 6
|
|
61
|
+
BOOL = 7
|
|
62
|
+
STRING = 8
|
|
63
|
+
ARRAY = 9
|
|
64
|
+
UINT64 = 10
|
|
65
|
+
INT64 = 11
|
|
66
|
+
FLOAT64 = 12
|
|
67
|
+
|
|
68
|
+
_simple_value_packing = {
|
|
69
|
+
GGUFValueType.UINT8: "<B",
|
|
70
|
+
GGUFValueType.INT8: "<b",
|
|
71
|
+
GGUFValueType.UINT16: "<H",
|
|
72
|
+
GGUFValueType.INT16: "<h",
|
|
73
|
+
GGUFValueType.UINT32: "<I",
|
|
74
|
+
GGUFValueType.INT32: "<i",
|
|
75
|
+
GGUFValueType.FLOAT32: "<f",
|
|
76
|
+
GGUFValueType.UINT64: "<Q",
|
|
77
|
+
GGUFValueType.INT64: "<q",
|
|
78
|
+
GGUFValueType.FLOAT64: "<d",
|
|
79
|
+
GGUFValueType.BOOL: "?",
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
value_type_info = {
|
|
83
|
+
GGUFValueType.UINT8: 1,
|
|
84
|
+
GGUFValueType.INT8: 1,
|
|
85
|
+
GGUFValueType.UINT16: 2,
|
|
86
|
+
GGUFValueType.INT16: 2,
|
|
87
|
+
GGUFValueType.UINT32: 4,
|
|
88
|
+
GGUFValueType.INT32: 4,
|
|
89
|
+
GGUFValueType.FLOAT32: 4,
|
|
90
|
+
GGUFValueType.UINT64: 8,
|
|
91
|
+
GGUFValueType.INT64: 8,
|
|
92
|
+
GGUFValueType.FLOAT64: 8,
|
|
93
|
+
GGUFValueType.BOOL: 1,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
def get_single(self, value_type, file) -> Any:
|
|
97
|
+
if value_type == GGUFReader.GGUFValueType.STRING:
|
|
98
|
+
value_length = unpack("<Q", file.read(8))[0]
|
|
99
|
+
value = file.read(value_length)
|
|
100
|
+
value = value.decode("utf-8")
|
|
101
|
+
else:
|
|
102
|
+
type_str = GGUFReader._simple_value_packing.get(value_type)
|
|
103
|
+
bytes_length = GGUFReader.value_type_info.get(value_type)
|
|
104
|
+
value = unpack(type_str, file.read(bytes_length))[0]
|
|
105
|
+
|
|
106
|
+
return value
|
|
107
|
+
|
|
108
|
+
def load_metadata(self, fname) -> dict:
|
|
109
|
+
metadata = {}
|
|
110
|
+
with open(fname, "rb") as file:
|
|
111
|
+
GGUF_MAGIC = file.read(4)
|
|
112
|
+
|
|
113
|
+
if GGUF_MAGIC != b"GGUF":
|
|
114
|
+
raise ValueError(
|
|
115
|
+
"your model file is not a valid GGUF file "
|
|
116
|
+
f"(magic number mismatch, got {GGUF_MAGIC}, "
|
|
117
|
+
"expected b'GGUF')"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
GGUF_VERSION = unpack("<I", file.read(4))[0]
|
|
121
|
+
|
|
122
|
+
if GGUF_VERSION == 1:
|
|
123
|
+
raise ValueError(
|
|
124
|
+
"your model file reports GGUF version 1, "
|
|
125
|
+
"but only versions 2 and above are supported. "
|
|
126
|
+
"re-convert your model or download a newer version"
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# ti_data_count = struct.unpack("<Q", file.read(8))[0]
|
|
130
|
+
file.read(8)
|
|
131
|
+
kv_data_count = unpack("<Q", file.read(8))[0]
|
|
132
|
+
|
|
133
|
+
for _ in range(kv_data_count):
|
|
134
|
+
key_length = unpack("<Q", file.read(8))[0]
|
|
135
|
+
key = file.read(key_length)
|
|
136
|
+
|
|
137
|
+
value_type = GGUFReader.GGUFValueType(
|
|
138
|
+
unpack("<I", file.read(4))[0]
|
|
139
|
+
)
|
|
140
|
+
if value_type == GGUFReader.GGUFValueType.ARRAY:
|
|
141
|
+
ltype = GGUFReader.GGUFValueType(
|
|
142
|
+
unpack("<I", file.read(4))[0]
|
|
143
|
+
)
|
|
144
|
+
length = unpack("<Q", file.read(8))[0]
|
|
145
|
+
arr = [
|
|
146
|
+
GGUFReader.get_single(
|
|
147
|
+
self,
|
|
148
|
+
ltype,
|
|
149
|
+
file
|
|
150
|
+
) for _ in range(length)
|
|
151
|
+
]
|
|
152
|
+
metadata[key.decode()] = arr
|
|
153
|
+
else:
|
|
154
|
+
value = GGUFReader.get_single(self, value_type, file)
|
|
155
|
+
metadata[key.decode()] = value
|
|
156
|
+
|
|
157
|
+
return metadata
|
|
158
|
+
|
|
159
|
+
def softmax(z: _ArrayLike) -> np.ndarray:
|
|
160
|
+
"""
|
|
161
|
+
Compute softmax over values in z, where z is array-like
|
|
162
|
+
"""
|
|
163
|
+
e_z = np.exp(z - np.max(z))
|
|
164
|
+
return e_z / e_z.sum()
|
|
165
|
+
|
|
166
|
+
def cls() -> None:
|
|
167
|
+
"""Clear the terminal"""
|
|
168
|
+
print("\033c\033[3J", end='', flush=True)
|
|
169
|
+
|
|
170
|
+
# no longer used in this module, but left for others to use
|
|
171
|
+
def get_timestamp_prefix_str() -> str:
|
|
172
|
+
# helpful: https://strftime.net
|
|
173
|
+
return strftime("[%Y, %b %e, %a %l:%M %p] ")
|
|
174
|
+
|
|
175
|
+
def truncate(text: str) -> str:
|
|
176
|
+
return text if len(text) < 63 else f"{text[:60]}..."
|
|
177
|
+
|
|
178
|
+
def print_verbose(text: str) -> None:
|
|
179
|
+
print("webscout.Local: verbose:", text, file=sys.stderr, flush=True)
|
|
180
|
+
|
|
181
|
+
def print_info(text: str) -> None:
|
|
182
|
+
print("webscout.Local: info:", text, file=sys.stderr, flush=True)
|
|
183
|
+
|
|
184
|
+
def print_warning(text: str) -> None:
|
|
185
|
+
print("webscout.Local: warning:", text, file=sys.stderr, flush=True)
|
webscout/__init__.py
CHANGED
|
@@ -6,8 +6,7 @@ from .transcriber import transcriber
|
|
|
6
6
|
from .voice import play_audio
|
|
7
7
|
from .tempid import Client as TempMailClient, TemporaryPhoneNumber
|
|
8
8
|
from .LLM import LLM
|
|
9
|
-
#
|
|
10
|
-
from .Localai import *
|
|
9
|
+
# from .Local import *
|
|
11
10
|
import g4f
|
|
12
11
|
# Import provider classes for direct access
|
|
13
12
|
from .Provider import (
|
|
@@ -82,9 +81,9 @@ __all__ = [
|
|
|
82
81
|
"TemporaryPhoneNumber",
|
|
83
82
|
"LLM",
|
|
84
83
|
# Localai models and utilities
|
|
85
|
-
"Model",
|
|
86
|
-
"Thread",
|
|
87
|
-
"formats",
|
|
84
|
+
# "Model",
|
|
85
|
+
# "Thread",
|
|
86
|
+
# "formats",
|
|
88
87
|
|
|
89
88
|
# AI Providers
|
|
90
89
|
"ThinkAnyAI",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: webscout
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary: Search for anything using Google, DuckDuckGo, phind.com
|
|
3
|
+
Version: 2.4
|
|
4
|
+
Summary: Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs
|
|
5
5
|
Author: OEvortex
|
|
6
6
|
Author-email: helpingai5@gmail.com
|
|
7
7
|
License: HelpingAI Simplified Universal License
|
|
@@ -50,7 +50,7 @@ Requires-Dist: appdirs
|
|
|
50
50
|
Requires-Dist: GoogleBard1 >=2.1.4
|
|
51
51
|
Requires-Dist: tls-client
|
|
52
52
|
Requires-Dist: clipman
|
|
53
|
-
Requires-Dist:
|
|
53
|
+
Requires-Dist: Helpingai-T2playsound
|
|
54
54
|
Provides-Extra: dev
|
|
55
55
|
Requires-Dist: ruff >=0.1.6 ; extra == 'dev'
|
|
56
56
|
Requires-Dist: pytest >=7.4.2 ; extra == 'dev'
|
|
@@ -64,7 +64,7 @@ Requires-Dist: numpy ; extra == 'local'
|
|
|
64
64
|
<a href="https://t.me/devsdocode"><img alt="Telegram" src="https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white"></a>
|
|
65
65
|
<a href="https://www.instagram.com/sree.shades_/"><img alt="Instagram" src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white"></a>
|
|
66
66
|
<a href="https://www.linkedin.com/in/developer-sreejan/"><img alt="LinkedIn" src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white"></a>
|
|
67
|
-
<a href="https://buymeacoffee.com/
|
|
67
|
+
<a href="https://buymeacoffee.com/oevortex"><img alt="Buy Me A Coffee" src="https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buymeacoffee&logoColor=black"></a>
|
|
68
68
|
</div>
|
|
69
69
|
|
|
70
70
|
<div align="center">
|
|
@@ -87,7 +87,7 @@ Requires-Dist: numpy ; extra == 'local'
|
|
|
87
87
|
<a href="#"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/webscout"/></a>
|
|
88
88
|
<a href="https://pepy.tech/project/webscout"><img alt="Downloads" src="https://static.pepy.tech/badge/webscout"></a>
|
|
89
89
|
|
|
90
|
-
Search for anything using
|
|
90
|
+
Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
## Table of Contents
|
|
@@ -1434,7 +1434,7 @@ python -m webscout.webai webai --provider "phind" --rawdog
|
|
|
1434
1434
|
<a href="https://t.me/devsdocode"><img alt="Telegram" src="https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white"></a>
|
|
1435
1435
|
<a href="https://www.instagram.com/sree.shades_/"><img alt="Instagram" src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white"></a>
|
|
1436
1436
|
<a href="https://www.linkedin.com/in/developer-sreejan/"><img alt="LinkedIn" src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white"></a>
|
|
1437
|
-
<a href="https://buymeacoffee.com/
|
|
1437
|
+
<a href="https://buymeacoffee.com/oevortex"><img alt="Buy Me A Coffee" src="https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buymeacoffee&logoColor=black"></a>
|
|
1438
1438
|
</div>
|
|
1439
1439
|
|
|
1440
1440
|
<div align="center">
|
|
@@ -15,7 +15,7 @@ webscout/AIbase.py,sha256=GoHbN8r0gq2saYRZv6LA-Fr9Jlcjv80STKFXUq2ZeGU,4710
|
|
|
15
15
|
webscout/AIutel.py,sha256=LXYgQOEk21c7MpNJlSl2RbLvR8HDJhTSwJiVVgqf0Iw,33266
|
|
16
16
|
webscout/DWEBS.py,sha256=QT-7-dUgWhQ_H7EVZD53AVyXxyskoPMKCkFIpzkN56Q,7332
|
|
17
17
|
webscout/LLM.py,sha256=CiDz0okZNEoXuxMwadZnwRGSLpqk2zg0vzvXSxQZjcE,1910
|
|
18
|
-
webscout/__init__.py,sha256=
|
|
18
|
+
webscout/__init__.py,sha256=jsZ4ivXz9sXnh8vLAnCxW4tRSxJJClll_ENNHBaGpUI,2214
|
|
19
19
|
webscout/__main__.py,sha256=ZtTRgsRjUi2JOvYFLF1ZCh55Sdoz94I-BS-TlJC7WDU,126
|
|
20
20
|
webscout/async_providers.py,sha256=holBv5SxanxVXc_92CBBaXHlB2IakB_fHnhyZaFjYF8,684
|
|
21
21
|
webscout/cli.py,sha256=F888fdrFUQgczMBN4yMOSf6Nh-IbvkqpPhDsbnA2FtQ,17059
|
|
@@ -30,6 +30,13 @@ webscout/voice.py,sha256=0QjXTHAQmCK07IDZXRc7JXem47cnPJH7u3X0sVP1-UQ,967
|
|
|
30
30
|
webscout/webai.py,sha256=cRzJNVljryCxV4kEtmii0_CEBxSs71Ft3sdPdcqGmBg,84668
|
|
31
31
|
webscout/webscout_search.py,sha256=TvbrRYVMXbFGgEh0CoFHNYVY3iQ8SmejxEmv8Csu4IA,3159
|
|
32
32
|
webscout/webscout_search_async.py,sha256=4_L_t_I9WlvpPEI3FI0K3v6Aayr0pNvD3chYOp7JR8o,42902
|
|
33
|
+
webscout/Local/__init__.py,sha256=0yXXihFek7VCugUjjCI67i3yZ_PQ8mw3MMVlWGpMmLM,217
|
|
34
|
+
webscout/Local/_version.py,sha256=sc9JboCC9IEKihG_oql9GqyPt0rTPN2OXbpyzRDoCQ4,83
|
|
35
|
+
webscout/Local/formats.py,sha256=tttN2Cqq39YZgypjyu1_ZbfDTj8cdiFndiW-MUFR4qQ,17153
|
|
36
|
+
webscout/Local/model.py,sha256=Hf_xybJm1PZBBIIy5j0p3Z3CnWezymNfxr8zQeFHJqY,27611
|
|
37
|
+
webscout/Local/samplers.py,sha256=qXwU4eLXER-2aCYzcJcTgA6BeFmi5GMpTDUX1C9pTN4,4372
|
|
38
|
+
webscout/Local/thread.py,sha256=geDTADuSMJ4i6HNWMkRpRU21oKCSMRy5r7jt1_dCWz0,26786
|
|
39
|
+
webscout/Local/utils.py,sha256=OHMHnemIdfwVAfi45SHMTYZgIUv_zgKLHaw6pEmftdU,6108
|
|
33
40
|
webscout/Provider/Berlin4h.py,sha256=-O6BRkLusUEdYXcyQ09iY86dFl9WoiA4mlmZ_DLZbos,8342
|
|
34
41
|
webscout/Provider/Blackboxai.py,sha256=8B5wT_eb86RVZ5uOqwvgVC5QATl0uEMCli0n4SDwt1M,16743
|
|
35
42
|
webscout/Provider/ChatGPTUK.py,sha256=ozpWnuOlC_7jeDcTuUukFPcPkIksx-Bgq_6Rrf0Bwak,8357
|
|
@@ -49,9 +56,9 @@ webscout/Provider/Xjai.py,sha256=gI9FqEodS-jHfFM_CsDPmTb_wL5NU2q__2fg9hqVoEc,880
|
|
|
49
56
|
webscout/Provider/Yepchat.py,sha256=E0tv3Zfoqs1Sw8Pe-6_5d--_1LESm8mjw536DWclJk8,19398
|
|
50
57
|
webscout/Provider/Youchat.py,sha256=JAZYwcj0Kl1UUgqN0rD3TKaReA1G-cmIlW_4mog1j_c,7756
|
|
51
58
|
webscout/Provider/__init__.py,sha256=BPYm-ZOkZOXXn3bx_2UHIV6aZS47d9Y01JDq-EiPXhQ,1318
|
|
52
|
-
webscout-2.
|
|
53
|
-
webscout-2.
|
|
54
|
-
webscout-2.
|
|
55
|
-
webscout-2.
|
|
56
|
-
webscout-2.
|
|
57
|
-
webscout-2.
|
|
59
|
+
webscout-2.4.dist-info/LICENSE.md,sha256=mRVwJuT4SXC5O93BFdsfWBjlXjGn2Np90Zm5SocUzM0,3150
|
|
60
|
+
webscout-2.4.dist-info/METADATA,sha256=-M7inj2YdFSKnN-5zgoAgZpj4unPrjO8UxfE3dmOn48,46631
|
|
61
|
+
webscout-2.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
62
|
+
webscout-2.4.dist-info/entry_points.txt,sha256=Hh4YIIjvkqB9SVxZ2ri4DZUkgEu_WF_5_r_nZDIvfG8,73
|
|
63
|
+
webscout-2.4.dist-info/top_level.txt,sha256=OD5YKy6Y3hldL7SmuxsiEDxAG4LgdSSWwzYk22MF9fk,18
|
|
64
|
+
webscout-2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|