🛠️ myice/myice.py -> Added new AI functionality using Infomaniak LLM API
🛠️ poetry.lock -> Added rl-ai-tools package dependency 🛠️ pyproject.toml -> Updated dependencies and added rl-ai-tools source
This commit is contained in:
@@ -12,6 +12,8 @@ import sys
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
from typing import List, Tuple
|
||||||
|
from rl_ai_tools import utils # type: ignore
|
||||||
import requests
|
import requests
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
@@ -297,5 +299,33 @@ def parse_schedule(
|
|||||||
print(f"{event_type}: {title}\n")
|
print(f"{event_type}: {title}\n")
|
||||||
|
|
||||||
|
|
||||||
|
@app.command("ai")
|
||||||
|
def check_with_ai(
|
||||||
|
schedule_file: Annotated[
|
||||||
|
Path, typer.Option(help="schedule json file to parse")
|
||||||
|
] = Path("schedule.json"),
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Search through the schedule with natural language using Infomaniak LLM API
|
||||||
|
"""
|
||||||
|
if not utils.init():
|
||||||
|
sys.exit(1)
|
||||||
|
with schedule_file.open("r") as f:
|
||||||
|
schedule_data = json.load(f)
|
||||||
|
system = (
|
||||||
|
"Tu es une IA connaissant bien les données suivantes, qui décrivent les match et entraînements d'équipes de hockey sur glace:\n"
|
||||||
|
+ json.dumps(schedule_data)
|
||||||
|
)
|
||||||
|
history: List[Tuple[str, str]] = []
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
question = input("> ")
|
||||||
|
except EOFError:
|
||||||
|
break
|
||||||
|
answer = utils.llm_inference(question, history, system=system)
|
||||||
|
print(">", answer)
|
||||||
|
history.append((question, answer))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app()
|
app()
|
||||||
|
|||||||
Generated
+21
-1
@@ -890,6 +890,26 @@ pygments = ">=2.13.0,<3.0.0"
|
|||||||
[package.extras]
|
[package.extras]
|
||||||
jupyter = ["ipywidgets (>=7.5.1,<9)"]
|
jupyter = ["ipywidgets (>=7.5.1,<9)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rl-ai-tools"
|
||||||
|
version = "1.9.0"
|
||||||
|
description = "Tools using AI"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.11,<4.0"
|
||||||
|
files = [
|
||||||
|
{file = "rl_ai_tools-1.9.0-py3-none-any.whl", hash = "sha256:c986a17e39afe6bd5bc21eb8d259e465dcc52e60a73b81db3931b45599e94fc1"},
|
||||||
|
{file = "rl_ai_tools-1.9.0.tar.gz", hash = "sha256:80c43d434a330544e5d201f3a99460996cc31276fb360cb45a0962f743a342bb"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
requests = ">=2.32.3,<3.0.0"
|
||||||
|
typer = ">=0.12.5,<0.13.0"
|
||||||
|
|
||||||
|
[package.source]
|
||||||
|
type = "legacy"
|
||||||
|
url = "https://pypi.purple.infomaniak.ch"
|
||||||
|
reference = "infomaniak"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shellingham"
|
name = "shellingham"
|
||||||
version = "1.5.4"
|
version = "1.5.4"
|
||||||
@@ -1025,4 +1045,4 @@ files = [
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.12"
|
python-versions = "^3.12"
|
||||||
content-hash = "32eb77391a5bfd29bed30f4a384ccd08ca307923ac47c48eaad6bfee18798081"
|
content-hash = "c8b74100d5c4f5889db217b5fb249f55248d1955787fd76dbda5ded8b73875b3"
|
||||||
|
|||||||
@@ -10,11 +10,18 @@ readme = "README.md"
|
|||||||
python = "^3.12"
|
python = "^3.12"
|
||||||
requests = "^2.32.3"
|
requests = "^2.32.3"
|
||||||
typer = "^0.12.5"
|
typer = "^0.12.5"
|
||||||
|
rl-ai-tools = {version = "^1.9.0", source = "infomaniak"}
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
ipykernel = "^6.29.5"
|
ipykernel = "^6.29.5"
|
||||||
|
|
||||||
|
|
||||||
|
[[tool.poetry.source]]
|
||||||
|
name = "infomaniak"
|
||||||
|
url = "https://pypi.purple.infomaniak.ch"
|
||||||
|
priority = "supplemental"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|||||||
Reference in New Issue
Block a user