Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚗️ updating llm plugin for continous mode #671

Merged
merged 46 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8bdb2ff
🚨
mraniki Aug 18, 2023
894b35a
🔧
mraniki Aug 18, 2023
b4bf8f2
⚗️ updating llm plugin for continous mode
mraniki Aug 18, 2023
d0ba48b
Update Requirements
mraniki Aug 18, 2023
34833b2
:white_check_mark: unit test
mraniki Aug 18, 2023
634505b
Update Requirements
mraniki Aug 18, 2023
7f0f4ba
⬆️
mraniki Aug 18, 2023
fb16032
Update conf.py
mraniki Aug 19, 2023
5914b28
Update Requirements
mraniki Aug 19, 2023
cb484ae
Update navbar.html
mraniki Aug 19, 2023
19498c7
:arrow_up::white_check_mark: fix test
mraniki Aug 19, 2023
4e66e57
Update Requirements
mraniki Aug 19, 2023
15248fc
:fire:
mraniki Aug 20, 2023
70c7b80
Merge branch 'dev' of [email protected]:mraniki/tt
mraniki Aug 20, 2023
c9cfd58
Update test_llm_plugin.py
mraniki Aug 20, 2023
d04f04f
Update test_llm_plugin.py
mraniki Aug 20, 2023
c7c701d
Update test_llm_plugin.py
mraniki Aug 20, 2023
6a2f05e
Update talky_settings.toml
mraniki Aug 20, 2023
a070632
Update llm_plugin.py
mraniki Aug 20, 2023
30ec34d
Update pyproject.toml
mraniki Aug 20, 2023
cddfef7
Update llm_plugin.py
mraniki Aug 20, 2023
63db822
Update Requirements
mraniki Aug 20, 2023
738f227
Update pyproject.toml
mraniki Aug 20, 2023
70d7bc0
:memo: added back navbar
mraniki Aug 20, 2023
e8fc20d
Update .readthedocs.yaml
mraniki Aug 20, 2023
e147cd3
Update .readthedocs.yaml
mraniki Aug 20, 2023
e6166a6
Update Requirements
mraniki Aug 20, 2023
a50796b
Update pyproject.toml
mraniki Aug 20, 2023
c7d8d4d
Update 👷Flow.yml
mraniki Aug 20, 2023
7d6c5ae
Update pyproject.toml
mraniki Aug 20, 2023
fa6b997
Update config.py
mraniki Aug 20, 2023
7aa40dc
Update pyproject.toml
mraniki Aug 20, 2023
d37287c
Update pyproject.toml
mraniki Aug 20, 2023
0708f25
Update Requirements
mraniki Aug 20, 2023
cd18ff5
Update renovate.json
mraniki Aug 20, 2023
dd39ccb
Update renovate.json
mraniki Aug 20, 2023
2a4e4d3
Update renovate.json
mraniki Aug 20, 2023
048f733
Update Requirements
mraniki Aug 20, 2023
5e791c2
Update pyproject.toml
mraniki Aug 20, 2023
ea890ac
Update Requirements
mraniki Aug 20, 2023
6231e9f
Update talky_settings.toml
mraniki Aug 20, 2023
718a7cf
Update talky_settings.toml
mraniki Aug 20, 2023
52b1399
Update config.py
mraniki Aug 20, 2023
3341637
Update talky_settings.toml
mraniki Aug 20, 2023
e1865df
:gear:️ Remove dynaconf_include from talky_settings.toml
mraniki Aug 20, 2023
09e10cd
Update Requirements
mraniki Aug 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true,
"minimumReleaseAge": "8 hours"
"automerge": false,
"matchBaseBranches": ["dev"],
"minimumReleaseAge": "15 days"
},
{
"matchUpdateTypes": ["major"],
"automerge": false,
"matchBaseBranches": ["dev"],
"minimumReleaseAge": "30 days"
"minimumReleaseAge": "60 days"
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/👷Flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
secrets: inherit
release:
needs: [lint]
uses: mraniki/coding_toolset/.github/workflows/📦Release_old.yml@main
uses: mraniki/coding_toolset/.github/workflows/📦Release.yml@main
secrets: inherit
docker:
needs: [release]
Expand Down
21 changes: 11 additions & 10 deletions .requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ beautifulsoup4==4.12.2 ; python_version >= "3.10" and python_version < "4.0"
bitarray==2.8.1 ; python_version >= "3.10" and python_version < "4"
blurhash==1.1.4 ; python_version >= "3.10" and python_version < "4.0"
browser-cookie3==0.19.1 ; python_version >= "3.10" and python_version < "4.0"
ccxt==4.0.67 ; python_version >= "3.10" and python_version < "4.0"
cefi==1.1.16 ; python_version >= "3.10" and python_version < "4.0"
ccxt==4.0.69 ; python_version >= "3.10" and python_version < "4.0"
cefi==1.1.19 ; python_version >= "3.10" and python_version < "4.0"
certifi==2023.7.22 ; python_version >= "3.10" and python_version < "4.0"
cffi==1.15.1 ; python_version >= "3.10" and python_version < "4.0"
charset-normalizer==3.2.0 ; python_version >= "3.10" and python_version < "4.0"
Expand All @@ -26,7 +26,7 @@ cryptography==41.0.3 ; python_version >= "3.10" and python_version < "4.0"
curl-cffi==0.5.7 ; python_version >= "3.10" and python_version < "4.0"
cytoolz==0.12.2 ; python_version >= "3.10" and python_version < "4" and implementation_name == "cpython"
decorator==5.1.1 ; python_version >= "3.10" and python_version < "4.0"
dxsp==4.2.26 ; python_version >= "3.10" and python_version < "4.0"
dxsp==4.2.28 ; python_version >= "3.10" and python_version < "4.0"
dynaconf==3.2.1 ; python_version >= "3.10" and python_version < "4.0"
emoji==2.8.0 ; python_version >= "3.10" and python_version < "4.0"
eth-abi==4.1.0 ; python_version >= "3.10" and python_version < "4"
Expand All @@ -40,11 +40,12 @@ eth-typing==3.4.0 ; python_version >= "3.10" and python_version < "4"
eth-utils==2.2.0 ; python_version >= "3.10" and python_version < "4"
exceptiongroup==1.1.3 ; python_version >= "3.10" and python_version < "3.11"
fastapi==0.99.1 ; python_version >= "3.10" and python_version < "4.0"
findmyorder==1.7.17 ; python_version >= "3.10" and python_version < "4.0"
findmyorder==1.7.20 ; python_version >= "3.10" and python_version < "4.0"
frozendict==2.3.8 ; python_version >= "3.10" and python_version < "4.0"
frozenlist==1.4.0 ; python_version >= "3.10" and python_version < "4.0"
future==0.18.3 ; python_version >= "3.10" and python_version < "4.0"
g4f==0.0.1.7 ; python_version >= "3.10" and python_version < "4.0"
google-search-results==2.4.2 ; python_version >= "3.10" and python_version < "4.0"
grpcio==1.57.0 ; python_version >= "3.10" and python_version < "4.0"
guilded-py==1.10.0 ; python_version >= "3.10" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.10" and python_version < "4.0"
Expand All @@ -55,7 +56,7 @@ html5lib==1.1 ; python_version >= "3.10" and python_version < "4.0"
httpcore==0.17.3 ; python_version >= "3.10" and python_version < "4.0"
httpx==0.24.1 ; python_version >= "3.10" and python_version < "4.0"
hyperframe==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
iamlistening==3.3.6 ; python_version >= "3.10" and python_version < "4.0"
iamlistening==3.3.8 ; python_version >= "3.10" and python_version < "4.0"
idna==3.4 ; python_version >= "3.10" and python_version < "4.0"
iso8601==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.10" and (sys_platform == "bsd" or sys_platform == "linux") and python_version < "4.0"
Expand All @@ -72,7 +73,7 @@ mastodon-py==1.8.1 ; python_version >= "3.10" and python_version < "4.0"
matrix-nio==0.20.2 ; python_version >= "3.10" and python_version < "4.0"
multidict==6.0.4 ; python_version >= "3.10" and python_version < "4.0"
multitasking==0.0.11 ; python_version >= "3.10" and python_version < "4.0"
myllm==1.2.15 ; python_version >= "3.10" and python_version < "4.0"
myllm==1.2.25 ; python_version >= "3.10" and python_version < "4.0"
numpy==1.25.2 ; python_version >= "3.10" and python_version < "4.0"
oauthlib==3.2.2 ; python_version >= "3.10" and python_version < "4.0"
packaging==23.1 ; python_version >= "3.10" and python_version < "4.0"
Expand All @@ -81,7 +82,7 @@ parsimonious==0.9.0 ; python_version >= "3.10" and python_version < "4"
pillow==9.5.0 ; python_version >= "3.10" and python_version < "4.0"
ping3==4.0.4 ; python_version >= "3.10" and python_version < "4.0"
prettytable==3.8.0 ; python_version >= "3.10" and python_version < "4.0"
protobuf==4.24.0 ; python_version >= "3.10" and python_version < "4.0"
protobuf==4.24.1 ; python_version >= "3.10" and python_version < "4.0"
py-cord==2.4.1 ; python_version >= "3.10" and python_version < "4.0"
pyaes==1.6.1 ; python_version >= "3.10" and python_version < "4.0"
pyasn1==0.5.0 ; python_version >= "3.10" and python_version < "4"
Expand Down Expand Up @@ -115,14 +116,14 @@ rlp==3.0.0 ; python_version >= "3.10" and python_version < "4"
rocketchat-api==1.30.0 ; python_version >= "3.10" and python_version < "4.0"
rpds-py==0.9.2 ; python_version >= "3.10" and python_version < "4.0"
rsa==4.9 ; python_version >= "3.10" and python_version < "4"
setuptools==68.1.0 ; python_version >= "3.10" and python_version < "4.0"
setuptools==68.1.2 ; python_version >= "3.10" and python_version < "4.0"
simplematrixbotlib==2.10.0 ; python_version >= "3.10" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
sniffio==1.3.0 ; python_version >= "3.10" and python_version < "4.0"
soupsieve==2.4.1 ; python_version >= "3.10" and python_version < "4.0"
starlette==0.27.0 ; python_version >= "3.10" and python_version < "4.0"
talkytrend==1.13.4 ; python_version >= "3.10" and python_version < "4.0"
telethon==1.29.2 ; python_version >= "3.10" and python_version < "4.0"
talkytrend==1.14.2 ; python_version >= "3.10" and python_version < "4.0"
telethon==1.29.3 ; python_version >= "3.10" and python_version < "4.0"
tinode-grpc==0.22.3 ; python_version >= "3.10" and python_version < "4.0"
toml==0.10.2 ; python_version >= "3.10" and python_version < "4.0"
toolz==0.12.0 ; python_version >= "3.10" and python_version < "4" and (implementation_name == "pypy" or implementation_name == "cpython")
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"myllm": ("https://myllm.readthedocs.io/en/latest", None),
"community": ("https://tt-plugins.readthedocs.io/en/latest", None),
"cefi": ("https://cex.readthedocs.io/en/latest", None),
"headlinehunt": ("https://headlinehunt.readthedocs.io/en/latest", None),
}

intersphinx_disabled_reftypes = ["*"]
Expand All @@ -76,7 +77,8 @@
'iamlistening',
'talkytrend',
'myllm',
'community'
'community',
'headlinehunt'

]

Expand Down
120 changes: 60 additions & 60 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.10"
dynaconf = "^3.1.12"
loguru = "^0.6.0"
loguru = "0.6.0"
asyncz = "^0.3.1"
apprise= "^1.4.0"
httpx = "^0.24.1"
Expand All @@ -52,7 +52,7 @@ dxsp = "^4.2.25"
findmyorder = "^1.7.16"
iamlistening = "^3.3.5"
talkytrend = "^1.13.2"
myllm = "^1.2.15"
myllm = "^1.2.25"


[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -99,7 +99,7 @@ pytest-playwright = "^0.4.0"
optional = true

[tool.poetry.group.docs.dependencies]
sphinx = "^7.0.0"
sphinx = "7.1.0"
pydata-sphinx-theme = "^0.13.3"
sphinx-hoverxref = "^1.3.0"
sphinx-notfound-page = "^0.8.3"
Expand Down Expand Up @@ -129,62 +129,62 @@ omit = [
]


# [tool.semantic_release]
# version_variable = ["pyproject.toml:version","tt/utils.py:__version__"]
# branch = "main"
# upload_to_pypi = false
# upload_to_release = false
# build_command = false
# remove_dist = false
# commit_parser = "semantic_release.history.emoji_parser"
# use_textual_changelog_sections = true
# changelog_sections = "breaking, feature, fix, documentation"
# major_emoji = "BREAKING,💥,:boom:"
# minor_emoji = "feat,🥚,:egg:,🚀,:rocket:,💄,:lipstick:,✨,:sparkles:"
# patch_emoji = "fix,bump,Update,🎨,:art:,🐛,:bug:,🚑,:ambulance:,⚡,:zap:,🔥,:fire:,🚨,:rotating_light:,♻️,:recycle:,🔧,:wrench:,⬆️,:arrow_up:,🩹,:adhesive_bandage:,👷,:construction_worker:,📝,:memo:,🔒,:lock:,👽,:alien:,💬,:speech_balloon:,🥅,:goal_net:,✅,:white_check_mark:,🐳,:whale:,🙈,:see_no_evil:,⚗️,:alembic:,🧐,:monocle_face:,🔇,:mute:,🔊:volume:"

[tool.semantic_release]
version_variable = ["pyproject.toml:version","tt/utils.py:__version__"]
branch = "main"
upload_to_pypi = false
upload_to_release = false
build_command = false
remove_dist = false
commit_parser = "semantic_release.history.emoji_parser"
use_textual_changelog_sections = true
changelog_sections = "breaking, feature, fix, documentation"
major_emoji = "BREAKING,💥,:boom:"
minor_emoji = "feat,🥚,:egg:,🚀,:rocket:,💄,:lipstick:,✨,:sparkles:"
patch_emoji = "fix,bump,Update,🎨,:art:,🐛,:bug:,🚑,:ambulance:,⚡,:zap:,🔥,:fire:,🚨,:rotating_light:,♻️,:recycle:,🔧,:wrench:,⬆️,:arrow_up:,🩹,:adhesive_bandage:,👷,:construction_worker:,📝,:memo:,🔒,:lock:,👽,:alien:,💬,:speech_balloon:,🥅,:goal_net:,✅,:white_check_mark:,🐳,:whale:,🙈,:see_no_evil:,⚗️,:alembic:,🧐,:monocle_face:,🔇,:mute:,🔊:volume:"
upload_to_vcs_release = false
version_variables = ["pyproject.toml:version","tt/utils.py:__version__"]
build_command = "pip install poetry && poetry build"
commit_parser = "emoji"


[tool.semantic_release.commit_parser_options]
major_tags = [
"BREAKING",
"💥",
":boom:",
]
minor_tags = ["feat",
"🥚",":egg:",
"💄",":lipstick:",
"🚀",":rocket:",
"✨",":sparkles:",
]

# [tool.semantic_release]
# upload_to_vcs_release = false
# version_variables = ["pyproject.toml:version","tt/utils.py:__version__"]
# build_command = "pip install poetry && poetry build"
# commit_parser = "emoji"


# [tool.semantic_release.commit_parser_options]
# major_tags = [
# "BREAKING",
# "💥",
# ":boom:",
# ]
# minor_tags = ["feat",
# "🥚",":egg:",
# "💄",":lipstick:",
# "🚀",":rocket:",
# "✨",":sparkles:",
# ]

# patch_tags = ["fix","bump","Update",
# "🎨",":art:",
# "🐛",":bug:",
# "🚑",":ambulance:",
# "⚡",":zap:",
# "🔥",":fire:",
# "🚨",":rotating_light:",
# "♻️",":recycle:",
# "🔧",":wrench:",
# "⬆️",":arrow_up:",
# "🩹",":adhesive_bandage:",
# "👷",":construction_worker:",
# "📝",":memo:",
# "🔒",":lock:",
# "👽",":alien:",
# "💬",":speech_balloon:",
# "🥅",":goal_net:",
# "✅",":white_check_mark:",
# "🐳",":whale:",
# "🙈",":see_no_evil:",
# "⚗️",":alembic:",
# "🧐",":monocle_face:",
# "🔇",":mute:",
# "🔊",":volume:",
# ]
patch_tags = ["fix","bump","Update",
"🎨",":art:",
"🐛",":bug:",
"🚑",":ambulance:",
"⚡",":zap:",
"🔥",":fire:",
"🚨",":rotating_light:",
"♻️",":recycle:",
"🔧",":wrench:",
"⬆️",":arrow_up:",
"🩹",":adhesive_bandage:",
"👷",":construction_worker:",
"📝",":memo:",
"🔒",":lock:",
"👽",":alien:",
"💬",":speech_balloon:",
"🥅",":goal_net:",
"✅",":white_check_mark:",
"🐳",":whale:",
"🙈",":see_no_evil:",
"⚗️",":alembic:",
"🧐",":monocle_face:",
"🔇",":mute:",
"🔊",":volume:",
]
40 changes: 20 additions & 20 deletions tests/test_llm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ async def test_bot_ignore(plugin):
assert result is None


@pytest.mark.asyncio
async def test_parsing_help(plugin):
"""Test help """
plugin.get_llm_help = AsyncMock()
await plugin.handle_message(
f"{settings.bot_prefix}{settings.bot_command_help}")
plugin.get_llm_help.assert_awaited_once()


@pytest.mark.asyncio
async def test_parsing_info(plugin):
"""Test info """
plugin.get_llm_info = AsyncMock()
await plugin.handle_message(
f"{settings.bot_prefix}{settings.bot_command_info}")
plugin.get_llm_info.assert_awaited_once()


# @pytest.mark.asyncio
# async def test_parsing_help(plugin):
# """Test help """
# get_myllm_help = AsyncMock()
# await plugin.handle_message(
# f"{settings.bot_prefix}{settings.bot_command_help}")
# get_myllm_help.assert_awaited_once()


# @pytest.mark.asyncio
# async def test_parsing_info(plugin):
# """Test info """
# plugin.llm.get_myllm_info = AsyncMock()
# await plugin.handle_message(
# f"{settings.bot_prefix}{settings.bot_command_info}")
# plugin.llm.get_myllm_info.assert_awaited_once()

@pytest.mark.asyncio
async def test_parsing_llm(plugin):
"""Test scr """
Expand All @@ -68,14 +68,14 @@ async def test_parsing_llm(plugin):
@pytest.mark.asyncio
async def test_help(plugin):
"""Test help """
result = await plugin.get_llm_help()
result = await plugin.llm.get_myllm_help()
assert result is not None


@pytest.mark.asyncio
async def test_info(plugin):
"""Test info """
result = await plugin.get_llm_info()
result = await plugin.llm.get_myllm_info()
assert result is not None


Expand Down
1 change: 1 addition & 0 deletions tt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
os.path.join(ROOT, "talky_settings.toml"),
# load default from library in case not in talky default
"default_settings.toml",
"myllm/myllm.toml",
# load user default
"settings.toml",
# load user secret
Expand Down
14 changes: 5 additions & 9 deletions tt/plugins/default_plugins/llm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ def __init__(self):
super().__init__()
self.enabled = settings.llm_enabled
if self.enabled:
self.version = "MyLLM"
self.help_message = settings.llm_commands
self.llm= MyLLM()



async def start(self):
"""Starts the plugin"""

Expand All @@ -39,13 +36,17 @@ async def handle_message(self, msg):
"""Handles incoming messages"""
if not self.should_handle(msg):
return
if self.llm.continous_mode:
await self.llm.continous_mode(msg)
if msg.startswith(settings.bot_prefix):
command, *args = msg.split(" ")
command = command[1:]

command_mapping = {
settings.bot_command_help: self.get_llm_help,
settings.bot_command_info: self.get_llm_info,
settings.bot_command_info: self.llm.get_myllm_info,
settings.bot_command_aimode: self.llm.switch_continous_mode,
settings.bot_command_info: self.llm.clear_chat_history,
settings.bot_command_question: lambda: self.llm.talk(args),
settings.bot_command_topic: lambda: self.llm.chat(args),
}
Expand All @@ -57,8 +58,3 @@ async def get_llm_help(self):
"""Help Message"""
return f"{self.help_message}"

async def get_llm_info(self):
"""info Message"""
return self.version


Loading