yaicli 0.5.7__py3-none-any.whl → 0.5.9__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.
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "yaicli"
3
- version = "0.5.7"
3
+ version = "0.5.9"
4
4
  description = "A simple CLI tool to interact with LLM"
5
5
  authors = [{ name = "belingud", email = "im.victor@qq.com" }]
6
6
  readme = "README.md"
@@ -30,7 +30,7 @@ keywords = [
30
30
  "interact with llms",
31
31
  ]
32
32
  dependencies = [
33
- "click<8.2.0",
33
+ "click>=8.1.8",
34
34
  "distro>=1.9.0",
35
35
  "httpx>=0.28.1",
36
36
  "instructor>=1.7.9",
@@ -40,7 +40,7 @@ dependencies = [
40
40
  "prompt-toolkit>=3.0.50",
41
41
  "rich>=13.9.4",
42
42
  "socksio>=1.0.0",
43
- "typer>=0.15.2",
43
+ "typer>=0.16.0",
44
44
  ]
45
45
  [project.urls]
46
46
  Homepage = "https://github.com/belingud/yaicli"
yaicli/chat.py CHANGED
@@ -10,8 +10,8 @@ from rich.table import Table
10
10
 
11
11
  from .config import cfg
12
12
  from .console import YaiConsole, get_console
13
- from .schemas import ChatMessage
14
13
  from .exceptions import ChatDeleteError, ChatLoadError, ChatSaveError
14
+ from .schemas import ChatMessage
15
15
  from .utils import option_callback
16
16
 
17
17
  console: YaiConsole = get_console()
@@ -68,7 +68,9 @@ class Chat:
68
68
  data = json.load(f)
69
69
  self.title = data.get("title", self.title)
70
70
  self.date = data.get("date", self.date)
71
- self.history = [ChatMessage(role=msg["role"], content=msg["content"]) for msg in data.get("history", [])]
71
+ self.history = [
72
+ ChatMessage(role=msg["role"], content=msg["content"]) for msg in data.get("history", [])
73
+ ]
72
74
  return True
73
75
  except (json.JSONDecodeError, OSError) as e:
74
76
  raise ChatLoadError(f"Error loading chat: {e}") from e
yaicli/cli.py CHANGED
@@ -17,7 +17,7 @@ from rich.panel import Panel
17
17
  from rich.prompt import Prompt
18
18
 
19
19
  from .chat import Chat, FileChatManager, chat_mgr
20
- from .client import LitellmClient, ChatMessage
20
+ from .client import ChatMessage, LitellmClient
21
21
  from .config import cfg
22
22
  from .console import get_console
23
23
  from .const import (
yaicli/client.py CHANGED
@@ -11,7 +11,7 @@ from rich.panel import Panel
11
11
 
12
12
  from .config import cfg
13
13
  from .console import get_console
14
- from .schemas import LLMResponse, ChatMessage, ToolCall
14
+ from .schemas import ChatMessage, LLMResponse, ToolCall
15
15
  from .tools import (
16
16
  Function,
17
17
  FunctionName,
yaicli/config.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import configparser
2
+ import json
2
3
  from dataclasses import dataclass
3
4
  from functools import lru_cache
4
5
  from os import getenv
5
- import json
6
6
  from typing import Optional
7
7
 
8
8
  from rich import get_console
yaicli/const.py CHANGED
@@ -1,4 +1,11 @@
1
- from enum import StrEnum
1
+ try:
2
+ from enum import StrEnum
3
+ except ImportError:
4
+ from enum import Enum
5
+
6
+ class StrEnum(str, Enum):
7
+ """Compatible with python below 3.11"""
8
+
2
9
  from pathlib import Path
3
10
  from tempfile import gettempdir
4
11
  from typing import Any, Literal, Optional
@@ -63,21 +70,6 @@ DEFAULT_SHOW_FUNCTION_OUTPUT: BOOL_STR = "true"
63
70
  DEFAULT_REASONING_EFFORT: Optional[Literal["low", "high", "medium"]] = None
64
71
 
65
72
 
66
- class EventTypeEnum(StrEnum):
67
- """Enumeration of possible event types from the SSE stream."""
68
-
69
- ERROR = "error"
70
- REASONING = "reasoning"
71
- REASONING_END = "reasoning_end"
72
- CONTENT = "content"
73
- FINISH = "finish"
74
- TOOL_CALL_START = "tool_call_start"
75
- TOOL_CALL_DELTA = "tool_call_delta"
76
- TOOL_CALL_END = "tool_call_end"
77
- TOOL_RESULT = "tool_result"
78
- TOOL_CALLS_FINISH = "tool_calls_finish"
79
-
80
-
81
73
  SHELL_PROMPT = """You are YAICLI, a shell command generator.
82
74
  The context conversation may contain other types of messages,
83
75
  but you should only respond with a single valid {_shell} shell command for {_os}.
yaicli/printer.py CHANGED
@@ -8,8 +8,8 @@ from rich.live import Live
8
8
  from .client import RefreshLive
9
9
  from .config import Config, get_config
10
10
  from .console import YaiConsole, get_console
11
- from .schemas import ChatMessage
12
11
  from .render import Markdown, plain_formatter
12
+ from .schemas import ChatMessage
13
13
 
14
14
  if TYPE_CHECKING:
15
15
  from .schemas import LLMResponse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yaicli
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Summary: A simple CLI tool to interact with LLM
5
5
  Project-URL: Homepage, https://github.com/belingud/yaicli
6
6
  Project-URL: Repository, https://github.com/belingud/yaicli
@@ -213,7 +213,7 @@ Classifier: License :: OSI Approved :: MIT License
213
213
  Classifier: Operating System :: OS Independent
214
214
  Classifier: Programming Language :: Python :: 3
215
215
  Requires-Python: >=3.9
216
- Requires-Dist: click<8.2.0
216
+ Requires-Dist: click>=8.1.8
217
217
  Requires-Dist: distro>=1.9.0
218
218
  Requires-Dist: httpx>=0.28.1
219
219
  Requires-Dist: instructor>=1.7.9
@@ -223,7 +223,7 @@ Requires-Dist: openai>=1.76.0
223
223
  Requires-Dist: prompt-toolkit>=3.0.50
224
224
  Requires-Dist: rich>=13.9.4
225
225
  Requires-Dist: socksio>=1.0.0
226
- Requires-Dist: typer>=0.15.2
226
+ Requires-Dist: typer>=0.16.0
227
227
  Description-Content-Type: text/markdown
228
228
 
229
229
  # YAICLI: Your AI assistant in command line.
@@ -1,15 +1,15 @@
1
- pyproject.toml,sha256=PCKvDYSn9V2qnxplRgsrbYZfcPjEzj1PvguJVwEtDo0,1963
1
+ pyproject.toml,sha256=BKd4A76v4AS4RKC2RTfi4OMImeKmyTzNEn8Xx2tWlbM,1964
2
2
  yaicli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- yaicli/chat.py,sha256=DeTmOeBPU-oiOAIaDj2h-auJor0GyVVhrViLYF6zGIM,13638
4
- yaicli/cli.py,sha256=1Flt0FgrKzbabjJpZJCcvnUjXaaLwyD2paRyMixEQV0,22985
5
- yaicli/client.py,sha256=PzfoW0lZ2QHxt2IBLGl-l6CGpq98MsxPiag0QxwRKsw,16565
6
- yaicli/config.py,sha256=65k7gERkOIJ5q4GN-CU7VYZgupShFgsMHT0eWPtCh_U,6535
3
+ yaicli/chat.py,sha256=_emvZEdgMBth2nQGaNWPf0P45oW2k3bpuIwqsxFcM5A,13676
4
+ yaicli/cli.py,sha256=u4rq04CdLiL-IBzQ0IimPyFAh9XZg9YUTuvM4CxE3pE,22985
5
+ yaicli/client.py,sha256=kdEI4HP1zZQHUf-7kNbE9ItpyRN8zcAGyKeBSb1R4Ro,16565
6
+ yaicli/config.py,sha256=HrWYcelLXE61XX719eVcuuo3292xxf1BNQznWdvjQFQ,6535
7
7
  yaicli/console.py,sha256=vARPJd-3lafutsQWrGntQVjLrYqaJD3qisN82pmuhjU,1973
8
- yaicli/const.py,sha256=47I8I5hkJmLtPAhmesMvg7sydDSG_MB94BoRPtdBrUg,8442
8
+ yaicli/const.py,sha256=mt_6m2jo5-tHEmk3DxKCEc5ek9DcyQGHFAn_HEeMP3k,8155
9
9
  yaicli/entry.py,sha256=gKzN8Yar3tpBd2Z2a80gD3k0W4Sf3lL7jdyws-2y-H0,8687
10
10
  yaicli/exceptions.py,sha256=WBYg8OTJJzaj7lt6HE7ZyBoe5T6A3yZRNCRfWd4iN0c,372
11
11
  yaicli/history.py,sha256=s-57X9FMsaQHF7XySq1gGH_jpd_cHHTYafYu2ECuG6M,2472
12
- yaicli/printer.py,sha256=a409R_4-ppNnen31Pt7KvaaNAFVCzBARYC0T0_EtMbU,8369
12
+ yaicli/printer.py,sha256=J-QPrb0q4Zrx18vwBGIBDQk7RzT4wXJPwdJ9oXLoEVg,8369
13
13
  yaicli/render.py,sha256=k8o2P8fI44PJlyQbs7gmMiu2x2prwajdWn5JIt15BIA,505
14
14
  yaicli/role.py,sha256=PfwiVJIlzg7EzlvMM-kIy6vBK0d5d_J4M1I_fIZGnWk,7399
15
15
  yaicli/schemas.py,sha256=PiuSY7ORZaA4OL_tYm0inwqirHp5M-F3zcCipLwsH9E,571
@@ -17,8 +17,8 @@ yaicli/tools.py,sha256=d-5LXbEB-1Uq5VKSgwlAiNDVOGrHkku2DpmZoorq1zw,3098
17
17
  yaicli/utils.py,sha256=bpo3Xhozpxsaci3FtEIKZ32l4ZdyWMsrHjYGX0tB4J4,4541
18
18
  yaicli/functions/__init__.py,sha256=_FJooQ9GkijG8xLwuU0cr5GBrGnC9Nc6bnCeUjrsT0k,1271
19
19
  yaicli/functions/buildin/execute_shell_command.py,sha256=unl1-F8p6QZajeHdA0u5UpURMJM0WhdWMUWCCCHVRcI,1320
20
- yaicli-0.5.7.dist-info/METADATA,sha256=VCCVoup7CdV0bKytlc9UtO2tLtAePXbm9faHoYZHRJo,50349
21
- yaicli-0.5.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- yaicli-0.5.7.dist-info/entry_points.txt,sha256=iYVyQP0PJIm9tQnlQheqT435kK_xdGoi5j9aswGV9hA,66
23
- yaicli-0.5.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- yaicli-0.5.7.dist-info/RECORD,,
20
+ yaicli-0.5.9.dist-info/METADATA,sha256=6pjDNRzZPXd6HJILGfxlIBCs7QG7dK7tmNx5sT1JaTQ,50350
21
+ yaicli-0.5.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ yaicli-0.5.9.dist-info/entry_points.txt,sha256=iYVyQP0PJIm9tQnlQheqT435kK_xdGoi5j9aswGV9hA,66
23
+ yaicli-0.5.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ yaicli-0.5.9.dist-info/RECORD,,
File without changes