ommlds 0.0.0.dev458__py3-none-any.whl → 0.0.0.dev459__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.
- ommlds/__about__.py +2 -2
- ommlds/backends/anthropic/protocol/sse/assemble.py +22 -6
- ommlds/backends/anthropic/protocol/sse/events.py +13 -0
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/METADATA +7 -7
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/RECORD +9 -9
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev458.dist-info → ommlds-0.0.0.dev459.dist-info}/top_level.txt +0 -0
ommlds/__about__.py
CHANGED
|
@@ -23,7 +23,7 @@ class Project(ProjectBase):
|
|
|
23
23
|
|
|
24
24
|
# 'sentencepiece ~= 0.2', # FIXME: https://github.com/google/sentencepiece/issues/1121
|
|
25
25
|
|
|
26
|
-
'tiktoken ~= 0.
|
|
26
|
+
'tiktoken ~= 0.12',
|
|
27
27
|
|
|
28
28
|
# 'tinygrad @ git+https://github.com/tinygrad/tinygrad',
|
|
29
29
|
'tinygrad ~= 0.11',
|
|
@@ -38,7 +38,7 @@ class Project(ProjectBase):
|
|
|
38
38
|
|
|
39
39
|
'huggingface': [
|
|
40
40
|
'huggingface-hub ~= 0.35',
|
|
41
|
-
'datasets ~= 4.
|
|
41
|
+
'datasets ~= 4.2',
|
|
42
42
|
],
|
|
43
43
|
|
|
44
44
|
'numpy': [
|
|
@@ -63,9 +63,10 @@ class AnthropicSseMessageAssembler(
|
|
|
63
63
|
while True:
|
|
64
64
|
ae: ta.Any = check.not_none((yield from self._next_event()))
|
|
65
65
|
if isinstance(ae, AnthropicSseDecoderEvents.ContentBlockStart):
|
|
66
|
-
check.equal(ae.index, len(content))
|
|
66
|
+
# check.equal(ae.index, len(content))
|
|
67
67
|
c = yield from self._do_content_block(ae)
|
|
68
|
-
|
|
68
|
+
if c is not None:
|
|
69
|
+
content.append(check.isinstance(c, Content))
|
|
69
70
|
elif isinstance(ae, AnthropicSseDecoderEvents.MessageDelta):
|
|
70
71
|
for k in ('stop_reason', 'stop_sequence'):
|
|
71
72
|
if (v := getattr(ae.delta, k)) is not None:
|
|
@@ -92,6 +93,8 @@ class AnthropicSseMessageAssembler(
|
|
|
92
93
|
return (yield from self._do_text_content_block(cbs))
|
|
93
94
|
elif isinstance(cbs.content_block, AnthropicSseDecoderEvents.ContentBlockStart.ToolUse):
|
|
94
95
|
return (yield from self._do_tool_use_content_block(cbs))
|
|
96
|
+
elif isinstance(cbs.content_block, AnthropicSseDecoderEvents.ContentBlockStart.Thinking):
|
|
97
|
+
return (yield from self._do_thinking_content_block(cbs))
|
|
95
98
|
else:
|
|
96
99
|
raise TypeError(cbs.content_block)
|
|
97
100
|
|
|
@@ -101,11 +104,11 @@ class AnthropicSseMessageAssembler(
|
|
|
101
104
|
while True:
|
|
102
105
|
ae: ta.Any = check.not_none((yield from self._next_event()))
|
|
103
106
|
if isinstance(ae, AnthropicSseDecoderEvents.ContentBlockDelta):
|
|
104
|
-
check.equal(ae.index, cbs.index)
|
|
107
|
+
# check.equal(ae.index, cbs.index)
|
|
105
108
|
cdc = check.isinstance(ae.delta, AnthropicSseDecoderEvents.ContentBlockDelta.TextDelta)
|
|
106
109
|
parts.append(cdc.text)
|
|
107
110
|
elif isinstance(ae, AnthropicSseDecoderEvents.ContentBlockStop):
|
|
108
|
-
check.equal(ae.index, cbs.index)
|
|
111
|
+
# check.equal(ae.index, cbs.index)
|
|
109
112
|
return Text(''.join(parts))
|
|
110
113
|
else:
|
|
111
114
|
raise TypeError(ae)
|
|
@@ -119,11 +122,11 @@ class AnthropicSseMessageAssembler(
|
|
|
119
122
|
while True:
|
|
120
123
|
ae: ta.Any = check.not_none((yield from self._next_event()))
|
|
121
124
|
if isinstance(ae, AnthropicSseDecoderEvents.ContentBlockDelta):
|
|
122
|
-
check.equal(ae.index, cbs.index)
|
|
125
|
+
# check.equal(ae.index, cbs.index)
|
|
123
126
|
cdc = check.isinstance(ae.delta, AnthropicSseDecoderEvents.ContentBlockDelta.InputJsonDelta)
|
|
124
127
|
json_parts.append(cdc.partial_json)
|
|
125
128
|
elif isinstance(ae, AnthropicSseDecoderEvents.ContentBlockStop):
|
|
126
|
-
check.equal(ae.index, cbs.index)
|
|
129
|
+
# check.equal(ae.index, cbs.index)
|
|
127
130
|
dj = ''.join(json_parts).strip()
|
|
128
131
|
if dj:
|
|
129
132
|
dd = check.isinstance(json.loads(dj), ta.Mapping)
|
|
@@ -138,3 +141,16 @@ class AnthropicSseMessageAssembler(
|
|
|
138
141
|
)
|
|
139
142
|
else:
|
|
140
143
|
raise TypeError(ae)
|
|
144
|
+
|
|
145
|
+
def _do_thinking_content_block(self, cbs: AnthropicSseDecoderEvents.ContentBlockStart) -> ta.Any:
|
|
146
|
+
# csc = check.isinstance(cbs.content_block, AnthropicSseDecoderEvents.ContentBlockStart.Thinking)
|
|
147
|
+
while True:
|
|
148
|
+
ae: ta.Any = check.not_none((yield from self._next_event()))
|
|
149
|
+
if isinstance(ae, AnthropicSseDecoderEvents.ContentBlockDelta):
|
|
150
|
+
pass
|
|
151
|
+
elif isinstance(ae, AnthropicSseDecoderEvents.ContentBlockStop):
|
|
152
|
+
return None
|
|
153
|
+
else:
|
|
154
|
+
raise TypeError(ae)
|
|
155
|
+
return # type: ignore # noqa
|
|
156
|
+
yield # noqa
|
|
@@ -80,6 +80,11 @@ class AnthropicSseDecoderEvents(lang.Namespace):
|
|
|
80
80
|
name: str
|
|
81
81
|
input: ta.Any
|
|
82
82
|
|
|
83
|
+
@dc.dataclass(frozen=True)
|
|
84
|
+
class Thinking(ContentBlock):
|
|
85
|
+
signature: str
|
|
86
|
+
thinking: str
|
|
87
|
+
|
|
83
88
|
content_block: ContentBlock
|
|
84
89
|
index: int
|
|
85
90
|
|
|
@@ -96,6 +101,14 @@ class AnthropicSseDecoderEvents(lang.Namespace):
|
|
|
96
101
|
class InputJsonDelta(Delta):
|
|
97
102
|
partial_json: str
|
|
98
103
|
|
|
104
|
+
@dc.dataclass(frozen=True)
|
|
105
|
+
class ThinkingDelta(Delta):
|
|
106
|
+
thinking: str
|
|
107
|
+
|
|
108
|
+
@dc.dataclass(frozen=True)
|
|
109
|
+
class SignatureDelta(Delta):
|
|
110
|
+
signature: str
|
|
111
|
+
|
|
99
112
|
delta: Delta
|
|
100
113
|
index: int
|
|
101
114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev459
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -14,20 +14,20 @@ 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.
|
|
18
|
-
Requires-Dist: omlish==0.0.0.
|
|
17
|
+
Requires-Dist: omdev==0.0.0.dev459
|
|
18
|
+
Requires-Dist: omlish==0.0.0.dev459
|
|
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"
|
|
22
22
|
Requires-Dist: mlx-lm~=0.28; sys_platform == "darwin" and extra == "all"
|
|
23
|
-
Requires-Dist: tiktoken~=0.
|
|
23
|
+
Requires-Dist: tiktoken~=0.12; extra == "all"
|
|
24
24
|
Requires-Dist: tinygrad~=0.11; extra == "all"
|
|
25
25
|
Requires-Dist: tokenizers~=0.22; extra == "all"
|
|
26
26
|
Requires-Dist: torch~=2.8; extra == "all"
|
|
27
27
|
Requires-Dist: transformers~=4.57; extra == "all"
|
|
28
28
|
Requires-Dist: sentence-transformers~=5.1; extra == "all"
|
|
29
29
|
Requires-Dist: huggingface-hub~=0.35; extra == "all"
|
|
30
|
-
Requires-Dist: datasets~=4.
|
|
30
|
+
Requires-Dist: datasets~=4.2; extra == "all"
|
|
31
31
|
Requires-Dist: numpy>=1.26; extra == "all"
|
|
32
32
|
Requires-Dist: pytesseract~=0.3; extra == "all"
|
|
33
33
|
Requires-Dist: rapidocr-onnxruntime~=1.4; extra == "all"
|
|
@@ -40,7 +40,7 @@ Provides-Extra: backends
|
|
|
40
40
|
Requires-Dist: llama-cpp-python~=0.3; extra == "backends"
|
|
41
41
|
Requires-Dist: mlx~=0.29; extra == "backends"
|
|
42
42
|
Requires-Dist: mlx-lm~=0.28; sys_platform == "darwin" and extra == "backends"
|
|
43
|
-
Requires-Dist: tiktoken~=0.
|
|
43
|
+
Requires-Dist: tiktoken~=0.12; extra == "backends"
|
|
44
44
|
Requires-Dist: tinygrad~=0.11; extra == "backends"
|
|
45
45
|
Requires-Dist: tokenizers~=0.22; extra == "backends"
|
|
46
46
|
Requires-Dist: torch~=2.8; extra == "backends"
|
|
@@ -48,7 +48,7 @@ Requires-Dist: transformers~=4.57; extra == "backends"
|
|
|
48
48
|
Requires-Dist: sentence-transformers~=5.1; extra == "backends"
|
|
49
49
|
Provides-Extra: huggingface
|
|
50
50
|
Requires-Dist: huggingface-hub~=0.35; extra == "huggingface"
|
|
51
|
-
Requires-Dist: datasets~=4.
|
|
51
|
+
Requires-Dist: datasets~=4.2; extra == "huggingface"
|
|
52
52
|
Provides-Extra: numpy
|
|
53
53
|
Requires-Dist: numpy>=1.26; extra == "numpy"
|
|
54
54
|
Provides-Extra: ocr
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
ommlds/.omlish-manifests.json,sha256=B8lb6DKPpx-lvUmJJObifPZx-fy273KUbjQoHImyb7o,17992
|
|
2
|
-
ommlds/__about__.py,sha256=
|
|
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
|
|
5
5
|
ommlds/_hacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -11,8 +11,8 @@ ommlds/backends/anthropic/protocol/_marshal.py,sha256=RHbwekaw21lTS_1KBX9z6dLpbm
|
|
|
11
11
|
ommlds/backends/anthropic/protocol/types.py,sha256=f-_VXg_-KlhGIKp0R8vL50Rg_ZxqiBvQUGexQaDf8HY,2761
|
|
12
12
|
ommlds/backends/anthropic/protocol/sse/__init__.py,sha256=LpijqXk0ceMDcgwOvZ8iLoh0I328JSfG8V0JalcZD3I,98
|
|
13
13
|
ommlds/backends/anthropic/protocol/sse/_marshal.py,sha256=2No-qWRKV9ilOhC5NqHAA92DJF0fAcr4-OPvEP0KOjQ,627
|
|
14
|
-
ommlds/backends/anthropic/protocol/sse/assemble.py,sha256
|
|
15
|
-
ommlds/backends/anthropic/protocol/sse/events.py,sha256=
|
|
14
|
+
ommlds/backends/anthropic/protocol/sse/assemble.py,sha256=MVpA0iSU2LNMXy4VpIVV8Oe7nj3dgmXpfLe-7nnA5QE,6552
|
|
15
|
+
ommlds/backends/anthropic/protocol/sse/events.py,sha256=pLscyLFpxcrtOijNPRgivrxYBFpE270oDW1dECjGtFg,2507
|
|
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
|
|
@@ -325,9 +325,9 @@ ommlds/wiki/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
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.
|
|
329
|
-
ommlds-0.0.0.
|
|
330
|
-
ommlds-0.0.0.
|
|
331
|
-
ommlds-0.0.0.
|
|
332
|
-
ommlds-0.0.0.
|
|
333
|
-
ommlds-0.0.0.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|