Ryzenth 1.9.6__py3-none-any.whl → 2.0.0__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.
- Ryzenth/__version__.py +1 -1
- Ryzenth/_asynchisded.py +44 -60
- Ryzenth/_errors.py +13 -1
- Ryzenth/_shared.py +46 -0
- Ryzenth/_synchisded.py +33 -52
- Ryzenth/helper/_decorators.py +4 -1
- Ryzenth/helper/_federation.py +55 -60
- Ryzenth/helper/_fonts.py +6 -11
- Ryzenth/helper/_images.py +6 -11
- Ryzenth/helper/_moderator.py +15 -17
- Ryzenth/helper/_openai.py +6 -11
- Ryzenth/helper/_ryzenth.py +8 -12
- Ryzenth/helper/_thinking.py +8 -12
- Ryzenth/pyoraddons/__init__.py +85 -0
- Ryzenth/tests/__init__.py +0 -0
- Ryzenth/tests/test_deepseek.py +13 -0
- Ryzenth/tests/test_moderator.py +12 -0
- Ryzenth/tests/test_send.py +20 -0
- Ryzenth/tests/test_send_downloader.py +14 -0
- {ryzenth-1.9.6.dist-info → ryzenth-2.0.0.dist-info}/METADATA +11 -7
- ryzenth-2.0.0.dist-info/RECORD +28 -0
- ryzenth-1.9.6.dist-info/RECORD +0 -21
- {ryzenth-1.9.6.dist-info → ryzenth-2.0.0.dist-info}/WHEEL +0 -0
- {ryzenth-1.9.6.dist-info → ryzenth-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {ryzenth-1.9.6.dist-info → ryzenth-2.0.0.dist-info}/top_level.txt +0 -0
Ryzenth/helper/_thinking.py
CHANGED
@@ -17,14 +17,10 @@
|
|
17
17
|
# You should have received a copy of the GNU Affero General Public License
|
18
18
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
19
|
|
20
|
-
import logging
|
21
|
-
|
22
|
-
import httpx
|
23
20
|
|
24
21
|
from .._errors import WhatFuckError
|
25
22
|
from ..types import QueryParameter
|
26
23
|
|
27
|
-
LOGS = logging.getLogger("[Ryzenth]")
|
28
24
|
|
29
25
|
class WhatAsync:
|
30
26
|
def __init__(self, parent):
|
@@ -32,18 +28,18 @@ class WhatAsync:
|
|
32
28
|
|
33
29
|
async def think(self, params: QueryParameter, dot_access=False):
|
34
30
|
url = f"{self.parent.base_url}/v1/ai/deepseek/deepseek-r1-distill-qwen-32b"
|
35
|
-
async with httpx.AsyncClient() as client:
|
31
|
+
async with self.parent.httpx.AsyncClient() as client:
|
36
32
|
try:
|
37
33
|
response = await client.get(
|
38
34
|
url,
|
39
|
-
params=params.
|
35
|
+
params=params.model_dump(),
|
40
36
|
headers=self.parent.headers,
|
41
37
|
timeout=self.parent.timeout
|
42
38
|
)
|
43
39
|
response.raise_for_status()
|
44
40
|
return self.parent.obj(response.json() or {}) if dot_access else response.json()
|
45
|
-
except httpx.HTTPError as e:
|
46
|
-
|
41
|
+
except self.parent.httpx.HTTPError as e:
|
42
|
+
self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
|
47
43
|
raise WhatFuckError("[ASYNC] Error fetching") from e
|
48
44
|
|
49
45
|
class WhatSync:
|
@@ -53,14 +49,14 @@ class WhatSync:
|
|
53
49
|
def think(self, params: QueryParameter, dot_access=False):
|
54
50
|
url = f"{self.parent.base_url}/v1/ai/deepseek/deepseek-r1-distill-qwen-32b"
|
55
51
|
try:
|
56
|
-
response = httpx.get(
|
52
|
+
response = self.parent.httpx.get(
|
57
53
|
url,
|
58
|
-
params=params.
|
54
|
+
params=params.model_dump(),
|
59
55
|
headers=self.parent.headers,
|
60
56
|
timeout=self.parent.timeout
|
61
57
|
)
|
62
58
|
response.raise_for_status()
|
63
59
|
return self.parent.obj(response.json() or {}) if dot_access else response.json()
|
64
|
-
except httpx.HTTPError as e:
|
65
|
-
|
60
|
+
except self.parent.httpx.HTTPError as e:
|
61
|
+
self.parent.logger.error(f"[SYNC] Error fetching from deepseek {e}")
|
66
62
|
raise WhatFuckError("[SYNC] Error fetching from deepseek") from e
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Copyright 2019-2025 (c) Randy W @xtdevs, @xtsea
|
4
|
+
#
|
5
|
+
# from : https://github.com/TeamKillerX
|
6
|
+
# Channel : @RendyProjects
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
from functools import wraps
|
21
|
+
|
22
|
+
from .._errors import RequiredError, UnauthorizedAccessError
|
23
|
+
|
24
|
+
|
25
|
+
def unauthorized_access(
|
26
|
+
user_list: list = None,
|
27
|
+
author_only: bool = False,
|
28
|
+
member_only: bool = False
|
29
|
+
):
|
30
|
+
"Credits by @xtdevs"
|
31
|
+
def decorator(func):
|
32
|
+
@wraps(func)
|
33
|
+
async def wrapper(client, message):
|
34
|
+
if author_only and message.from_user.id != client.me.id:
|
35
|
+
return await message.reply_text("This Unauthorized Access Only Owner.")
|
36
|
+
if member_only and message.from_user.id not in user_list:
|
37
|
+
return await message.reply_text("This Unauthorized Access Only Members.")
|
38
|
+
return await func(client, message)
|
39
|
+
|
40
|
+
if sum([author_only, member_only]) > 1:
|
41
|
+
raise UnauthorizedAccessError("Only one of author_only, or member_only can be True")
|
42
|
+
|
43
|
+
return wrapper
|
44
|
+
return decorator
|
45
|
+
|
46
|
+
def callback_unauthorized_access(
|
47
|
+
user_list: list = None,
|
48
|
+
author_only: bool = False,
|
49
|
+
member_only: bool = False
|
50
|
+
):
|
51
|
+
"Credits by @xtdevs"
|
52
|
+
def decorator(func):
|
53
|
+
@wraps(func)
|
54
|
+
async def wrapper(client, callback):
|
55
|
+
if author_only and callback.from_user.id != client.me.id:
|
56
|
+
return await callback.answer("This Unauthorized Access Only Owner.", True)
|
57
|
+
if member_only and callback.from_user.id not in user_list:
|
58
|
+
return await callback.answer("This Unauthorized Access Only Members.", True)
|
59
|
+
return await func(client, callback)
|
60
|
+
|
61
|
+
if sum([author_only, member_only]) > 1:
|
62
|
+
raise UnauthorizedAccessError("Only one of author_only, or member_only can be True")
|
63
|
+
|
64
|
+
return wrapper
|
65
|
+
return decorator
|
66
|
+
|
67
|
+
def admin_only(enums_type=None):
|
68
|
+
"Credits by @xtdevs"
|
69
|
+
def decorator(func):
|
70
|
+
@wraps(func)
|
71
|
+
async def wrapper(client, message):
|
72
|
+
if enums_type is None:
|
73
|
+
raise RequiredError("Required enums_type")
|
74
|
+
member = await client.get_chat_member(message.chat.id, message.from_user.id)
|
75
|
+
if member.status not in {enums_type.ADMINISTRATOR, enums_type.OWNER}:
|
76
|
+
return await message.reply_text("Only admin can!")
|
77
|
+
return await func(client, message)
|
78
|
+
return wrapper
|
79
|
+
return decorator
|
80
|
+
|
81
|
+
__all__ = [
|
82
|
+
"unauthorized_access",
|
83
|
+
"callback_unauthorized_access",
|
84
|
+
"admin_only"
|
85
|
+
]
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from Ryzenth import ApiKeyFrom
|
2
|
+
from Ryzenth.types import QueryParameter # disarankan gunakan absolute import
|
3
|
+
|
4
|
+
|
5
|
+
def test_send_message():
|
6
|
+
ryz = ApiKeyFrom(..., is_ok=True)
|
7
|
+
result = ryz._sync.send_message(
|
8
|
+
model="hybrid",
|
9
|
+
params=QueryParameter(query="hello world!")
|
10
|
+
)
|
11
|
+
assert result is not None
|
12
|
+
|
13
|
+
def test_send_message_melayu():
|
14
|
+
ryz = ApiKeyFrom(..., is_ok=True)
|
15
|
+
result = ryz._sync.send_message(
|
16
|
+
model="melayu",
|
17
|
+
params=QueryParameter(query="Ok Test"),
|
18
|
+
use_full_model_list=True
|
19
|
+
)
|
20
|
+
assert result is not None
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from Ryzenth._synchisded import RyzenthXSync
|
2
|
+
from Ryzenth.types import QueryParameter
|
3
|
+
|
4
|
+
|
5
|
+
def test_send_downloader():
|
6
|
+
ryz = RyzenthXSync("test", base_url="https://x-api-js.onrender.com/api")
|
7
|
+
result = ryz.send_downloader(
|
8
|
+
switch_name="tiktok-search",
|
9
|
+
params=QueryParameter(
|
10
|
+
query="cat coding"
|
11
|
+
),
|
12
|
+
on_render=True
|
13
|
+
)
|
14
|
+
assert result is not None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: Ryzenth
|
3
|
-
Version:
|
3
|
+
Version: 2.0.0
|
4
4
|
Summary: Ryzenth Python Wrapper For Perfomance
|
5
5
|
Author: TeamKillerX
|
6
6
|
License: MIT
|
@@ -53,15 +53,19 @@ Dynamic: summary
|
|
53
53
|
# Ryzenth Library
|
54
54
|
[](https://github.com/TeamKillerX/Ryzenth)
|
55
55
|
[](https://github.com/TeamKillerX/Ryzenth/graphs/commit-activity)
|
56
|
-
[](https://github.com/TeamKillerX/Ryzenth)
|
57
56
|
[](https://github.com/TeamKillerX/Ryzenth/blob/main/LICENSE)
|
58
57
|
[](https://makeapullrequest.com)
|
59
58
|
[](https://pypi.org/project/Ryzenth)
|
60
59
|
[](https://results.pre-commit.ci/latest/github/TeamKillerX/Ryzenth/main)
|
61
60
|
|
62
|
-
|
61
|
+
<div align="center">
|
62
|
+
<a href="https://pepy.tech/project/Ryzenth"><img src="https://static.pepy.tech/badge/Ryzenth" alt="Downloads"></a>
|
63
|
+
<a href="https://github.com/TeamKillerX/Ryzenth/workflows/"><img src="https://github.com/TeamKillerX/Ryzenth/actions/workflows/sync-tests.yml/badge.svg" alt="API Tests"/></a>
|
64
|
+
</div>
|
63
65
|
|
64
|
-
|
66
|
+
**Ryzenth** is a powerful and flexible Python SDK for interacting with the new **Ryzenth API V1** a successor to the Ryzenth API V1 supporting both synchronous and asynchronous workflows out of the box.
|
67
|
+
|
68
|
+
> Note: Ryzenth API V1 (**javascript**) is still alive and supported, but Ryzenth is the next generation.
|
65
69
|
|
66
70
|
## Features
|
67
71
|
|
@@ -84,7 +88,7 @@ pip install ryzenth[fast]
|
|
84
88
|
from Ryzenth import ApiKeyFrom
|
85
89
|
from Ryzenth.types import QueryParameter
|
86
90
|
|
87
|
-
ryz = ApiKeyFrom(...,
|
91
|
+
ryz = ApiKeyFrom(..., is_ok=True)
|
88
92
|
|
89
93
|
await ryz.aio.send_message(
|
90
94
|
"hybrid",
|
@@ -100,7 +104,7 @@ await ryz.aio.send_message(
|
|
100
104
|
from Ryzenth import ApiKeyFrom
|
101
105
|
from Ryzenth.types import QueryParameter
|
102
106
|
|
103
|
-
ryz = ApiKeyFrom(...,
|
107
|
+
ryz = ApiKeyFrom(..., is_ok=True)
|
104
108
|
ryz._sync.send_message(
|
105
109
|
"hybrid",
|
106
110
|
QueryParameter(
|
@@ -126,4 +130,4 @@ export RYZENTH_API_KEY=your-api-key
|
|
126
130
|
|
127
131
|
## License
|
128
132
|
|
129
|
-
|
133
|
+
You can now access the [`Ryzenth API V2 (Typescript)`](https://github.com/xtsea/akenox-ts-dev/blob/main/ryzenth-api.md#-existing-api-still-alive)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Ryzenth/__init__.py,sha256=vM1IVkgRFQT5o15KYKx8kY59114Jw5taP8ytm9YJy94,996
|
2
|
+
Ryzenth/__version__.py,sha256=ctmJK-WuzKOP4R3aVcQgNxINgByhKDXyOfiq9wCQwEM,118
|
3
|
+
Ryzenth/_asynchisded.py,sha256=Q3Ona5i11iKn23WHebPqnfyq4ZiDdXlfBszDFX9BhLc,4666
|
4
|
+
Ryzenth/_client.py,sha256=1DhB0Ey-XM8kSpP3ztNkGkrevyLssdFAwLf4mjI6DWU,1867
|
5
|
+
Ryzenth/_errors.py,sha256=PwXVGoRQQYw05YYsh7bCRxr3jpV5k31fXCNNweag8LY,1456
|
6
|
+
Ryzenth/_shared.py,sha256=FEaOjsvr0gb50Un3LkjCPNysaPEoVTit-6rkxCc3ZYg,1470
|
7
|
+
Ryzenth/_synchisded.py,sha256=4uj9Q6E4B4mmUm1A3MDd_T3zu2wtxmX20SdlExFGhLw,4661
|
8
|
+
Ryzenth/helper/__init__.py,sha256=BkP6fQ3IJnOqyXn07jD7anumVPlm8lVPNkFnK9b6XpE,1447
|
9
|
+
Ryzenth/helper/_decorators.py,sha256=rEdJRoQrJfqd4LqNOiFfPwEQwMU4uVuEsoqRuQfw99I,2125
|
10
|
+
Ryzenth/helper/_federation.py,sha256=pfqqGjg179f-olvW1Z7aX1nQf0GQJdSK4NDMaMDxmbA,14552
|
11
|
+
Ryzenth/helper/_fonts.py,sha256=Yy5qWdumGf0Y7tcvEXGLSn87mKlr-x_gmO241a465j8,3035
|
12
|
+
Ryzenth/helper/_images.py,sha256=oOqojWiiYMZja1LloY_c-qIbH-s35yENohpBbZYDHCc,2305
|
13
|
+
Ryzenth/helper/_moderator.py,sha256=fAi0Xxk6CSShXl94H0FT8oDn6FttVq3ysBiROjSesCw,5501
|
14
|
+
Ryzenth/helper/_openai.py,sha256=cbQkEZ_B4NQEnnqG4Wobf_k6HLtKfpeMRJ8vFPuEWUQ,2570
|
15
|
+
Ryzenth/helper/_ryzenth.py,sha256=VPjo09JOjtzS74AxUwcXsaWFGY923_scqZ2ujzBEa3A,2874
|
16
|
+
Ryzenth/helper/_thinking.py,sha256=OTmV9FQYVbsWupZA-jvywWJBdO6UyioVBkBMsFazBWQ,2566
|
17
|
+
Ryzenth/pyoraddons/__init__.py,sha256=Xt4w4YHoFKwMZe8QslhLKp6mHBjBowvYjzkN95ikpjU,3175
|
18
|
+
Ryzenth/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
+
Ryzenth/tests/test_deepseek.py,sha256=_KbYr-haKBt5Xc-YULBL9Ic5OM02SX17hvQWWjYpNAk,255
|
20
|
+
Ryzenth/tests/test_moderator.py,sha256=wc9A_0gx3LobMD7CDS-h2eTNPNYxeJk_rqtd2QTt428,291
|
21
|
+
Ryzenth/tests/test_send.py,sha256=yPQV3XRsPKBo4eSsz5kc2R6BEuru0zmMexYshX0Ac3s,573
|
22
|
+
Ryzenth/tests/test_send_downloader.py,sha256=dJ4nv2CANGBpamGCxNSX1YlqJNZkHtlGHjOBDuiNJ04,396
|
23
|
+
Ryzenth/types/__init__.py,sha256=5K66BoRKd0yKdIFxph8FwM6Tr8Ha4sbgFctYlAUUQfw,1206
|
24
|
+
ryzenth-2.0.0.dist-info/licenses/LICENSE,sha256=C73aiGSgoCAVNzvAHs-TROaf5vV8yCj9nqpGrmfNHHo,1068
|
25
|
+
ryzenth-2.0.0.dist-info/METADATA,sha256=SpQd_58exKR3UXWqHP5IjW1z1r4xbuOu3ddOcBkoOHU,4390
|
26
|
+
ryzenth-2.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
27
|
+
ryzenth-2.0.0.dist-info/top_level.txt,sha256=0vIhjOjoQuCxLeZO0of8VCx2jsri-bLHV28nh8wWDnc,8
|
28
|
+
ryzenth-2.0.0.dist-info/RECORD,,
|
ryzenth-1.9.6.dist-info/RECORD
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Ryzenth/__init__.py,sha256=vM1IVkgRFQT5o15KYKx8kY59114Jw5taP8ytm9YJy94,996
|
2
|
-
Ryzenth/__version__.py,sha256=h5y4YdrdepFU2B-hlvSyE5t2jfsYpCCn6n_4JHGhiHA,118
|
3
|
-
Ryzenth/_asynchisded.py,sha256=aO04ouIsM_0WTgg3Ntihin5ed7QbdpJc_dqZZAdwv0A,4952
|
4
|
-
Ryzenth/_client.py,sha256=1DhB0Ey-XM8kSpP3ztNkGkrevyLssdFAwLf4mjI6DWU,1867
|
5
|
-
Ryzenth/_errors.py,sha256=PYHmA3xZPZnH8T1Yo0Al6ln2FP8KC9Jk3eN631ve2S4,1236
|
6
|
-
Ryzenth/_synchisded.py,sha256=77DLzv2PmEWKZNVvMPG_0yQ9Lr4rQXuu6yls_eV_Hyg,4772
|
7
|
-
Ryzenth/helper/__init__.py,sha256=BkP6fQ3IJnOqyXn07jD7anumVPlm8lVPNkFnK9b6XpE,1447
|
8
|
-
Ryzenth/helper/_decorators.py,sha256=jmBqzc3wyM8U28z-gf97M-kuBvMLE8laiV7hIqtaVgE,2026
|
9
|
-
Ryzenth/helper/_federation.py,sha256=hQ4XIha9j-ohUGmIJyD8HKWMFudBFU0iRLA-12qt_G0,13940
|
10
|
-
Ryzenth/helper/_fonts.py,sha256=i-1OlJwv_bTZL7Wewodajgotij5awSE04CNJyY_SXEs,3027
|
11
|
-
Ryzenth/helper/_images.py,sha256=bsCLycdlheqEc7I5jm_MVzscrNMX1Q_zmFWm3rhchA8,2297
|
12
|
-
Ryzenth/helper/_moderator.py,sha256=p7e1pRUTP8ROmFnRyNWSD5q65CQUKiavgp7yXCstLhk,5197
|
13
|
-
Ryzenth/helper/_openai.py,sha256=-VMH15PJXuYEu0UbwvlIus6NOsB-KNWBTMQvBU16EDU,2562
|
14
|
-
Ryzenth/helper/_ryzenth.py,sha256=923beacpCH37cUVwtrzgN81Br7ZeoIttN6yKThtRcsQ,2853
|
15
|
-
Ryzenth/helper/_thinking.py,sha256=4V2hH0FwegAGhmlO0YlAeXDH3DS4Omihf6m03YJc-SE,2545
|
16
|
-
Ryzenth/types/__init__.py,sha256=5K66BoRKd0yKdIFxph8FwM6Tr8Ha4sbgFctYlAUUQfw,1206
|
17
|
-
ryzenth-1.9.6.dist-info/licenses/LICENSE,sha256=C73aiGSgoCAVNzvAHs-TROaf5vV8yCj9nqpGrmfNHHo,1068
|
18
|
-
ryzenth-1.9.6.dist-info/METADATA,sha256=RSqob24B21U2cNvX5Q0g1mhq1Y1cNP2mWln59AimOqw,4120
|
19
|
-
ryzenth-1.9.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
20
|
-
ryzenth-1.9.6.dist-info/top_level.txt,sha256=0vIhjOjoQuCxLeZO0of8VCx2jsri-bLHV28nh8wWDnc,8
|
21
|
-
ryzenth-1.9.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|