ommlds 0.0.0.dev459__py3-none-any.whl → 0.0.0.dev461__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 ommlds might be problematic. Click here for more details.

@@ -592,7 +592,7 @@
592
592
  "module": ".tools.git",
593
593
  "attr": null,
594
594
  "file": "ommlds/tools/git.py",
595
- "line": 188,
595
+ "line": 186,
596
596
  "value": {
597
597
  "!omdev.tools.git.messages.GitMessageGeneratorManifest": {
598
598
  "module": "ommlds.tools.git",
@@ -606,7 +606,7 @@
606
606
  "module": ".tools.ocr",
607
607
  "attr": "_CLI_MODULE",
608
608
  "file": "ommlds/tools/ocr.py",
609
- "line": 89,
609
+ "line": 82,
610
610
  "value": {
611
611
  "!omdev.cli.types.CliModule": {
612
612
  "name": "ocr",
@@ -583,6 +583,7 @@ class GenerateContentResponse(lang.Final):
583
583
  class Candidate(lang.Final):
584
584
  content: Content | None = None
585
585
  finish_reason: FinishReason | None = None
586
+ finish_message: str | None = None
586
587
  # safety_ratings: ta.Sequence[SafetyRating] | None = None
587
588
  # citation_metadata: CitationMetadata | None = None
588
589
  token_count: int | None = None
@@ -1,6 +1,7 @@
1
1
  import abc
2
2
  import typing as ta
3
3
 
4
+ from omdev.tui import rich
4
5
  from omlish import check
5
6
  from omlish import lang
6
7
  from omlish.formats import json
@@ -8,11 +9,6 @@ from omlish.formats import json
8
9
  from .... import minichain as mc
9
10
 
10
11
 
11
- with lang.auto_proxy_import(globals()):
12
- from rich import console as rich_console
13
- from rich import markdown as rich_markdown
14
-
15
-
16
12
  ##
17
13
 
18
14
 
@@ -22,7 +18,7 @@ class ChatSessionPrinter(lang.Abstract):
22
18
  raise NotImplementedError
23
19
 
24
20
 
25
- ##
21
+ #
26
22
 
27
23
 
28
24
  class StringChatSessionPrinter(ChatSessionPrinter, lang.Abstract):
@@ -59,7 +55,7 @@ class StringChatSessionPrinter(ChatSessionPrinter, lang.Abstract):
59
55
  raise TypeError(obj)
60
56
 
61
57
 
62
- ##
58
+ #
63
59
 
64
60
 
65
61
  class SimpleStringChatSessionPrinter(StringChatSessionPrinter):
@@ -82,7 +78,7 @@ class SimpleStringChatSessionPrinter(StringChatSessionPrinter):
82
78
  self._str_printer(s)
83
79
 
84
80
 
85
- ##
81
+ #
86
82
 
87
83
 
88
84
  class MarkdownStringChatSessionPrinter(StringChatSessionPrinter):
@@ -91,4 +87,40 @@ class MarkdownStringChatSessionPrinter(StringChatSessionPrinter):
91
87
  if not s:
92
88
  return
93
89
 
94
- rich_console.Console().print(rich_markdown.Markdown(s))
90
+ rich.Console().print(rich.Markdown(s))
91
+
92
+
93
+ ##
94
+
95
+
96
+ class StreamPrinter(lang.ExitStacked, lang.Abstract):
97
+ @abc.abstractmethod
98
+ def feed(self, s: str) -> None:
99
+ raise NotImplementedError
100
+
101
+
102
+ #
103
+
104
+
105
+ class SimpleStreamPrinter(StreamPrinter):
106
+ def feed(self, s: str) -> None:
107
+ print(s, end='', flush=True)
108
+
109
+ def _exit_contexts(self) -> None:
110
+ super()._exit_contexts()
111
+ print(flush=True)
112
+
113
+
114
+ #
115
+
116
+
117
+ class MarkdownStreamPrinter(StreamPrinter):
118
+ def __init__(self) -> None:
119
+ super().__init__()
120
+
121
+ def _enter_contexts(self) -> None:
122
+ super()._enter_contexts()
123
+ self._ir: rich.MarkdownLiveStream = self._enter_context(rich.IncrementalMarkdownLiveStream())
124
+
125
+ def feed(self, s: str) -> None:
126
+ self._ir.feed(s)
@@ -9,6 +9,9 @@ from .base import DEFAULT_CHAT_MODEL_BACKEND
9
9
  from .base import ChatOptions
10
10
  from .base import ChatSession
11
11
  from .printing import ChatSessionPrinter
12
+ from .printing import MarkdownStreamPrinter
13
+ from .printing import SimpleStreamPrinter
14
+ from .printing import StreamPrinter
12
15
  from .state import ChatStateManager
13
16
  from .tools import ToolUseExecutor
14
17
 
@@ -81,13 +84,20 @@ class PromptChatSession(ChatSession['PromptChatSession.Config']):
81
84
  (self._chat_options or []),
82
85
  ))).v as st_resp:
83
86
  lst: list[str] = []
84
- async for o in st_resp:
85
- if o:
86
- c = check.isinstance(check.single(check.single(o.choices).deltas), mc.ContentAiChoiceDelta).c
87
- if c is not None:
88
- print(check.isinstance(c, str), end='', flush=True)
89
- lst.append(check.isinstance(c, str))
90
- print()
87
+
88
+ sp_cls: type[StreamPrinter]
89
+ if self._config.markdown:
90
+ sp_cls = MarkdownStreamPrinter
91
+ else:
92
+ sp_cls = SimpleStreamPrinter
93
+ with sp_cls() as sp:
94
+ async for o in st_resp:
95
+ if o:
96
+ c = check.isinstance(check.single(check.single(o.choices).deltas), mc.ContentAiChoiceDelta).c # noqa
97
+ if c is not None:
98
+ s = check.isinstance(c, str)
99
+ sp.feed(s)
100
+ lst.append(s)
91
101
 
92
102
  resp_m = mc.AiMessage(''.join(lst))
93
103
  new_chat.append(resp_m)
ommlds/tools/git.py CHANGED
@@ -23,10 +23,8 @@ from ..minichain.backends.impls.openai.chat import OpenaiChatChoicesService
23
23
  from ..server.client import McServerClient
24
24
 
25
25
 
26
- if ta.TYPE_CHECKING:
26
+ with lang.auto_proxy_import(globals()):
27
27
  from ..minichain.backends.impls.mlx import chat as mc_mlx_chat
28
- else:
29
- mc_mlx_chat = lang.proxy_import('..minichain.backends.impls.mlx.chat', __package__)
30
28
 
31
29
 
32
30
  GitAiBackendConfigT = ta.TypeVar('GitAiBackendConfigT', bound='GitAiBackend.Config')
ommlds/tools/ocr.py CHANGED
@@ -13,20 +13,13 @@ from omlish import check
13
13
  from omlish import lang
14
14
 
15
15
 
16
- if ta.TYPE_CHECKING:
16
+ with lang.auto_proxy_import(globals()):
17
17
  import pytesseract
18
18
  import rapidocr_onnxruntime as rapidocr
19
19
  from PIL import Image
20
20
 
21
21
  from omdev.clipboard import darwin_cf as darwin_clipboard
22
22
 
23
- else:
24
- pytesseract = lang.proxy_import('pytesseract')
25
- rapidocr = lang.proxy_import('rapidocr_onnxruntime')
26
- Image = lang.proxy_import('PIL.Image')
27
-
28
- darwin_clipboard = lang.proxy_import('omdev.clipboard.darwin_cf')
29
-
30
23
 
31
24
  ##
32
25
 
ommlds/wiki/text/mfh.py CHANGED
@@ -13,14 +13,10 @@ from omlish import lang
13
13
  from omlish import marshal as msh
14
14
 
15
15
 
16
- if ta.TYPE_CHECKING:
16
+ with lang.auto_proxy_import(globals()):
17
17
  import mwparserfromhell as mfh
18
18
  import mwparserfromhell.nodes as mfn
19
19
 
20
- else:
21
- mfh = lang.proxy_import('mwparserfromhell')
22
- mfn = lang.proxy_import('mwparserfromhell.nodes')
23
-
24
20
 
25
21
  Wikicode: ta.TypeAlias = 'mfh.wikicode.Wikicode'
26
22
 
ommlds/wiki/text/wtp.py CHANGED
@@ -26,10 +26,8 @@ from omlish import cached
26
26
  from omlish import lang
27
27
 
28
28
 
29
- if ta.TYPE_CHECKING:
29
+ with lang.auto_proxy_import(globals()):
30
30
  import wikitextparser as wtp
31
- else:
32
- wtp = lang.proxy_import('wikitextparser')
33
31
 
34
32
 
35
33
  WikiText: ta.TypeAlias = 'wtp.WikiText'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ommlds
3
- Version: 0.0.0.dev459
3
+ Version: 0.0.0.dev461
4
4
  Summary: ommlds
5
5
  Author: wrmsr
6
6
  License-Expression: BSD-3-Clause
@@ -14,8 +14,8 @@ Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Python: >=3.13
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: omdev==0.0.0.dev459
18
- Requires-Dist: omlish==0.0.0.dev459
17
+ Requires-Dist: omdev==0.0.0.dev461
18
+ Requires-Dist: omlish==0.0.0.dev461
19
19
  Provides-Extra: all
20
20
  Requires-Dist: llama-cpp-python~=0.3; extra == "all"
21
21
  Requires-Dist: mlx~=0.29; extra == "all"
@@ -1,4 +1,4 @@
1
- ommlds/.omlish-manifests.json,sha256=B8lb6DKPpx-lvUmJJObifPZx-fy273KUbjQoHImyb7o,17992
1
+ ommlds/.omlish-manifests.json,sha256=rrjnJ9Ux5kxBEZc3jHSKc_BRwyiV0OW11sIVQRFUkf8,17992
2
2
  ommlds/__about__.py,sha256=ihOSwOzbSqpYjC0oisAXE8bAnknrAKuDPQ8RI2y0n7U,1759
3
3
  ommlds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  ommlds/huggingface.py,sha256=JfEyfKOxU3-SY_ojtXBJFNeD-NIuKjvMe3GL3e93wNA,1175
@@ -16,7 +16,7 @@ ommlds/backends/anthropic/protocol/sse/events.py,sha256=pLscyLFpxcrtOijNPRgivrxY
16
16
  ommlds/backends/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  ommlds/backends/google/protocol/__init__.py,sha256=OWmhuCS_sZ08ZaBtSSDRIudHKzkzgmqxY-3jgQxTidw,105
18
18
  ommlds/backends/google/protocol/_marshal.py,sha256=LWikcdMDrKQ0lMtclNXwK9qamijUBzK62nrEVo2OFtc,305
19
- ommlds/backends/google/protocol/types.py,sha256=keJGINgvsDy38tfeBsThvnOKOC-aJN1eNvJUdEzzT_4,17452
19
+ ommlds/backends/google/protocol/types.py,sha256=-szndCfo4h4TnfWY23B-_ksgDO0W_Qnu958h4NEWJFw,17494
20
20
  ommlds/backends/llamacpp/__init__.py,sha256=zXFpLXE4a2vEl0jcPDyKlPHHfZ3Z8Dz0twhEIyZ8-vg,59
21
21
  ommlds/backends/llamacpp/buildwheel.py,sha256=q9ghCLVbm8Jm6syrZlBP-x1qNDd0wSl15B2OXBtDBQ8,3813
22
22
  ommlds/backends/llamacpp/logging.py,sha256=nCEC6ASEuTpJqx47DMLhnbr5KelDlbxhM0nKQt4bc3w,773
@@ -91,8 +91,8 @@ ommlds/cli/sessions/chat/base.py,sha256=GlDBXZ-KymSokNl1a7uwX1abswmRE67Q0zOIHjhZ
91
91
  ommlds/cli/sessions/chat/code.py,sha256=6hnjibVMTxSUciIIsDPsLHLGMlJNNUZtVQJxFkpi8sM,4269
92
92
  ommlds/cli/sessions/chat/inject.py,sha256=uF-QJvONu5sntXxaEu5KTYy2MUaSY8c5oJz0HpK3c7E,2621
93
93
  ommlds/cli/sessions/chat/interactive.py,sha256=gurYiDCQSY_5llcE75zvEbpVp77AbKSfgY243Z68bLw,2039
94
- ommlds/cli/sessions/chat/printing.py,sha256=b1HyripqYnRobLyTPgRidcDLvxIpyqPzgUMiXdklBGE,2327
95
- ommlds/cli/sessions/chat/prompt.py,sha256=T2h04r9LYA9urYKQZZldoT0Jon_jpKgcbQmtS9xquj8,4915
94
+ ommlds/cli/sessions/chat/printing.py,sha256=3f6icLamt7Wd7oiTshGVnIgC5YAsx_CBvZ4QH_7_mFs,2921
95
+ ommlds/cli/sessions/chat/prompt.py,sha256=tB8Wsy1FYXU6Gq-xOUTVpk8PVAu03mh7lcXf7xO7uJ4,5288
96
96
  ommlds/cli/sessions/chat/state.py,sha256=CjYkcpZ4fEBE0kPl1g101EDzq0MKy6S6E84dfDhwzcQ,2649
97
97
  ommlds/cli/sessions/chat/tools.py,sha256=dj6ADr6RIJnoIKH5wxRLGkgKAfZ_TtnqNLQ6uO-1Gfg,2325
98
98
  ommlds/cli/sessions/completion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -311,23 +311,23 @@ ommlds/server/client.py,sha256=4CeYj43nHwUmuxwD4lkAZjcaPlrWw7MDdenldj377IU,1735
311
311
  ommlds/server/server.py,sha256=8l6jPEvUMrTd7iLUOGcUUzXWYA7l1ZzI2lkA8XqGOBA,4205
312
312
  ommlds/server/service.py,sha256=WleUNyWqcnvZ_CNk6h1WVSTy1_xT9wJg4dduiJilGDY,2282
313
313
  ommlds/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
314
- ommlds/tools/git.py,sha256=3VW5KXpuHIg0Xz7h5Z4tXIKWwhpb4rafEfZ2BzK_adU,8170
315
- ommlds/tools/ocr.py,sha256=CjN2lKhQCQNMwR2wdEpzZhaJJ9c8P9Dv1HmiQju7jeQ,2049
314
+ ommlds/tools/git.py,sha256=3MWI5cZ9ZmsjNMEoQXwj-AZNYyzA2xp1srFjzUv7U1Y,8095
315
+ ommlds/tools/ocr.py,sha256=UP2XK4-ELyhK2BnuBr7-DwUbkDIcX9xdvfXVimM19Y8,1839
316
316
  ommlds/wiki/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
317
317
  ommlds/wiki/analyze.py,sha256=38SvHF0X_z8OkjvbBc5tLj35e9pvqi53yg9tls-ay5A,9544
318
318
  ommlds/wiki/convert.py,sha256=4UqEKMWW03HwrfxYTn0wmXobYVrTSK2x9Lx-2MeJW8M,2531
319
319
  ommlds/wiki/models.py,sha256=MV7WqEqJJ_JTwIhaPNbQnRa_w7tO7mJggPu0xitJyLM,2473
320
320
  ommlds/wiki/xml.py,sha256=8Xt4roJ9cyOlZMxT4L5NHbkaeMlgXt3wmjiArmiMh28,2925
321
321
  ommlds/wiki/text/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
322
- ommlds/wiki/text/mfh.py,sha256=pQTRVYDouI9z1UevHL8jVC8s4mscQMrw3dyOvBlXWzA,6792
323
- ommlds/wiki/text/wtp.py,sha256=M4HVq0Fl7yVc9rlftqo8SfapU9MmW0hhqssqGIN6Ofk,2233
322
+ ommlds/wiki/text/mfh.py,sha256=Qk2WjmtZgoEMgZtBbYjKnWZhusx_VA5CIDSbUatfIAk,6702
323
+ ommlds/wiki/text/wtp.py,sha256=Ga4dGfUsLwbS2i9LJd4xwSbHAAnwnReWGQgOrRIcedQ,2200
324
324
  ommlds/wiki/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
325
325
  ommlds/wiki/utils/io.py,sha256=UKgDJGtmpnWvIqVd2mJc2QNPOqlToEY1GEveNp6_pMo,7088
326
326
  ommlds/wiki/utils/progress.py,sha256=EhvKcMFYtsarCQhIahlO6f0SboyAKP3UwUyrnVnP-Vk,3222
327
327
  ommlds/wiki/utils/xml.py,sha256=vVV8Ctn13aaRM9eYfs9Wd6rHn5WOCEUzQ44fIhOvJdg,3754
328
- ommlds-0.0.0.dev459.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
329
- ommlds-0.0.0.dev459.dist-info/METADATA,sha256=OeNw_AZ8fyJklAOIseIioZMCUlLi44Dg-o84sqBau1U,3224
330
- ommlds-0.0.0.dev459.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
331
- ommlds-0.0.0.dev459.dist-info/entry_points.txt,sha256=Z5YWtX7ClfiCKdW-dd_CSVvM0h4yQpJPi-2G3q6gNFo,35
332
- ommlds-0.0.0.dev459.dist-info/top_level.txt,sha256=Rbnk5d5wi58vnAXx13WFZqdQ4VX8hBCS2hEL3WeXOhY,7
333
- ommlds-0.0.0.dev459.dist-info/RECORD,,
328
+ ommlds-0.0.0.dev461.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
329
+ ommlds-0.0.0.dev461.dist-info/METADATA,sha256=ictJNO5iWFoU9TN6EDbf_r6HMeWvbLYsr-n0zf7-cSg,3224
330
+ ommlds-0.0.0.dev461.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
331
+ ommlds-0.0.0.dev461.dist-info/entry_points.txt,sha256=Z5YWtX7ClfiCKdW-dd_CSVvM0h4yQpJPi-2G3q6gNFo,35
332
+ ommlds-0.0.0.dev461.dist-info/top_level.txt,sha256=Rbnk5d5wi58vnAXx13WFZqdQ4VX8hBCS2hEL3WeXOhY,7
333
+ ommlds-0.0.0.dev461.dist-info/RECORD,,