ommlds 0.0.0.dev477__py3-none-any.whl → 0.0.0.dev478__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.
- ommlds/.omlish-manifests.json +15 -3
- ommlds/cli/sessions/chat/chat/ai/rendering.py +3 -3
- ommlds/cli/sessions/chat/chat/ai/services.py +2 -2
- ommlds/cli/sessions/chat/chat/ai/types.py +1 -1
- ommlds/minichain/__init__.py +39 -22
- ommlds/minichain/backends/impls/anthropic/stream.py +11 -11
- ommlds/minichain/backends/impls/dummy/chat.py +7 -7
- ommlds/minichain/backends/impls/google/stream.py +9 -9
- ommlds/minichain/backends/impls/groq/protocol.py +7 -7
- ommlds/minichain/backends/impls/groq/stream.py +4 -4
- ommlds/minichain/backends/impls/llamacpp/stream.py +7 -7
- ommlds/minichain/backends/impls/mlx/chat.py +7 -7
- ommlds/minichain/backends/impls/ollama/chat.py +7 -7
- ommlds/minichain/backends/impls/openai/format.py +10 -10
- ommlds/minichain/backends/impls/openai/names.py +2 -2
- ommlds/minichain/backends/impls/openai/stream.py +8 -8
- ommlds/minichain/backends/impls/tinygrad/chat.py +7 -7
- ommlds/minichain/backends/impls/transformers/transformers.py +7 -7
- ommlds/minichain/chat/choices/stream/__init__.py +0 -0
- ommlds/minichain/chat/{stream → choices/stream}/adapters.py +7 -7
- ommlds/minichain/chat/choices/stream/joining.py +31 -0
- ommlds/minichain/chat/choices/stream/services.py +45 -0
- ommlds/minichain/chat/choices/stream/types.py +43 -0
- ommlds/minichain/chat/stream/_marshal.py +4 -4
- ommlds/minichain/chat/stream/joining.py +31 -43
- ommlds/minichain/chat/stream/services.py +15 -15
- ommlds/minichain/chat/stream/types.py +13 -23
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/METADATA +3 -3
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/RECORD +33 -29
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev477.dist-info → ommlds-0.0.0.dev478.dist-info}/top_level.txt +0 -0
ommlds/.omlish-manifests.json
CHANGED
|
@@ -533,8 +533,8 @@
|
|
|
533
533
|
"gpt5-chat-latest": "gpt-5-chat-latest",
|
|
534
534
|
"gpt5-mini": "gpt-5-mini",
|
|
535
535
|
"gpt5-nano": "gpt-5-nano",
|
|
536
|
-
"gpt": "gpt-
|
|
537
|
-
"gpt-mini": "gpt-
|
|
536
|
+
"gpt": "gpt-5",
|
|
537
|
+
"gpt-mini": "gpt-5-mini",
|
|
538
538
|
"o3": null,
|
|
539
539
|
"o3-mini": null,
|
|
540
540
|
"o4-mini": null,
|
|
@@ -729,6 +729,18 @@
|
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
},
|
|
732
|
+
{
|
|
733
|
+
"module": ".minichain.chat.choices.stream.services",
|
|
734
|
+
"attr": null,
|
|
735
|
+
"file": "ommlds/minichain/chat/choices/stream/services.py",
|
|
736
|
+
"line": 28,
|
|
737
|
+
"value": {
|
|
738
|
+
"!.minichain.registries.manifests.RegistryTypeManifest": {
|
|
739
|
+
"module": "ommlds.minichain.chat.choices.stream.services",
|
|
740
|
+
"attr": "ChatChoicesStreamService"
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
},
|
|
732
744
|
{
|
|
733
745
|
"module": ".minichain.chat.services",
|
|
734
746
|
"attr": null,
|
|
@@ -749,7 +761,7 @@
|
|
|
749
761
|
"value": {
|
|
750
762
|
"!.minichain.registries.manifests.RegistryTypeManifest": {
|
|
751
763
|
"module": "ommlds.minichain.chat.stream.services",
|
|
752
|
-
"attr": "
|
|
764
|
+
"attr": "ChatStreamService"
|
|
753
765
|
}
|
|
754
766
|
}
|
|
755
767
|
},
|
|
@@ -57,11 +57,11 @@ class RenderingStreamAiChatGenerator(StreamAiChatGenerator):
|
|
|
57
57
|
async def get_next_ai_messages_streamed(
|
|
58
58
|
self,
|
|
59
59
|
chat: 'mc.Chat',
|
|
60
|
-
delta_callback: ta.Callable[['mc.
|
|
60
|
+
delta_callback: ta.Callable[['mc.AiDelta'], ta.Awaitable[None]] | None = None,
|
|
61
61
|
) -> mc.Chat:
|
|
62
62
|
async with self._renderer.create_context() as renderer:
|
|
63
|
-
async def inner(delta: mc.
|
|
64
|
-
if isinstance(delta, mc.
|
|
63
|
+
async def inner(delta: mc.AiDelta) -> None:
|
|
64
|
+
if isinstance(delta, mc.ContentAiDelta):
|
|
65
65
|
await renderer.render_content(delta.c)
|
|
66
66
|
|
|
67
67
|
if delta_callback is not None:
|
|
@@ -59,12 +59,12 @@ class ChatChoicesStreamServiceStreamAiChatGenerator(StreamAiChatGenerator):
|
|
|
59
59
|
async def get_next_ai_messages_streamed(
|
|
60
60
|
self,
|
|
61
61
|
chat: 'mc.Chat',
|
|
62
|
-
delta_callback: ta.Callable[['mc.
|
|
62
|
+
delta_callback: ta.Callable[['mc.AiDelta'], ta.Awaitable[None]] | None = None,
|
|
63
63
|
) -> mc.AiChat:
|
|
64
64
|
opts = self._options() if self._options is not None else []
|
|
65
65
|
|
|
66
66
|
async with self._service_provider.provide_backend() as service:
|
|
67
|
-
joiner = mc.
|
|
67
|
+
joiner = mc.AiChoicesDeltaJoiner()
|
|
68
68
|
|
|
69
69
|
async with (await service.invoke(mc.ChatChoicesStreamRequest(chat, opts))).v as st_resp:
|
|
70
70
|
async for o in st_resp:
|
|
@@ -23,6 +23,6 @@ class StreamAiChatGenerator(AiChatGenerator, lang.Abstract):
|
|
|
23
23
|
def get_next_ai_messages_streamed(
|
|
24
24
|
self,
|
|
25
25
|
chat: 'mc.Chat',
|
|
26
|
-
delta_callback: ta.Callable[['mc.
|
|
26
|
+
delta_callback: ta.Callable[['mc.AiDelta'], ta.Awaitable[None]] | None = None,
|
|
27
27
|
) -> ta.Awaitable['mc.Chat']:
|
|
28
28
|
raise NotImplementedError
|
ommlds/minichain/__init__.py
CHANGED
|
@@ -65,6 +65,33 @@ with _lang.auto_proxy_init(
|
|
|
65
65
|
|
|
66
66
|
##
|
|
67
67
|
|
|
68
|
+
from .chat.choices.stream.adapters import ( # noqa
|
|
69
|
+
ChatChoicesStreamServiceChatChoicesService,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
from .chat.choices.stream.joining import ( # noqa
|
|
73
|
+
AiChoicesDeltaJoiner,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
from .chat.choices.stream.services import ( # noqa
|
|
77
|
+
ChatChoicesStreamRequest,
|
|
78
|
+
ChatChoicesStreamResponse,
|
|
79
|
+
ChatChoicesStreamService,
|
|
80
|
+
AbstractChatChoicesStreamService,
|
|
81
|
+
static_check_is_chat_choices_stream_service,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
from .chat.choices.stream.types import ( # noqa
|
|
85
|
+
ChatChoicesStreamOption,
|
|
86
|
+
ChatChoicesStreamOptions,
|
|
87
|
+
|
|
88
|
+
ChatChoicesStreamOutput,
|
|
89
|
+
ChatChoicesStreamOutputs,
|
|
90
|
+
|
|
91
|
+
AiChoiceDeltas,
|
|
92
|
+
AiChoicesDeltas,
|
|
93
|
+
)
|
|
94
|
+
|
|
68
95
|
from .chat.choices.adapters import ( # noqa
|
|
69
96
|
ChatChoicesServiceChatService,
|
|
70
97
|
)
|
|
@@ -88,37 +115,27 @@ with _lang.auto_proxy_init(
|
|
|
88
115
|
AiChoices,
|
|
89
116
|
)
|
|
90
117
|
|
|
91
|
-
from .chat.stream.adapters import ( # noqa
|
|
92
|
-
ChatChoicesStreamServiceChatChoicesService,
|
|
93
|
-
)
|
|
94
|
-
|
|
95
118
|
from .chat.stream.joining import ( # noqa
|
|
96
|
-
|
|
119
|
+
AiDeltaJoiner,
|
|
97
120
|
)
|
|
98
121
|
|
|
99
122
|
from .chat.stream.services import ( # noqa
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
ChatStreamRequest,
|
|
124
|
+
ChatStreamResponse,
|
|
125
|
+
ChatStreamService,
|
|
126
|
+
AbstractChatStreamService,
|
|
127
|
+
static_check_is_chat_stream_service,
|
|
105
128
|
)
|
|
106
129
|
|
|
107
130
|
from .chat.stream.types import ( # noqa
|
|
108
|
-
|
|
109
|
-
|
|
131
|
+
AiDelta,
|
|
132
|
+
AiDeltas,
|
|
110
133
|
|
|
111
|
-
|
|
112
|
-
ChatChoicesStreamOutputs,
|
|
113
|
-
|
|
114
|
-
AiChoiceDelta,
|
|
115
|
-
ContentAiChoiceDelta,
|
|
116
|
-
AnyToolUseAiChoiceDelta,
|
|
117
|
-
ToolUseAiChoiceDelta,
|
|
118
|
-
PartialToolUseAiChoiceDelta,
|
|
134
|
+
ContentAiDelta,
|
|
119
135
|
|
|
120
|
-
|
|
121
|
-
|
|
136
|
+
AnyToolUseAiDelta,
|
|
137
|
+
ToolUseAiDelta,
|
|
138
|
+
PartialToolUseAiDelta,
|
|
122
139
|
)
|
|
123
140
|
|
|
124
141
|
from .chat.tools.execution import ( # noqa
|
|
@@ -11,13 +11,13 @@ from omlish.io.buffers import DelimitingBuffer
|
|
|
11
11
|
from .....backends.anthropic.protocol import types as pt
|
|
12
12
|
from .....backends.anthropic.protocol.sse.events import AnthropicSseDecoderEvents
|
|
13
13
|
from ....chat.choices.services import ChatChoicesOutputs
|
|
14
|
-
from ....chat.stream.services import ChatChoicesStreamRequest
|
|
15
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
16
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
17
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
18
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
19
|
-
from ....chat.stream.types import
|
|
20
|
-
from ....chat.stream.types import
|
|
14
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
15
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
16
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
17
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
18
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
19
|
+
from ....chat.stream.types import ContentAiDelta
|
|
20
|
+
from ....chat.stream.types import PartialToolUseAiDelta
|
|
21
21
|
from ....chat.tools.types import Tool
|
|
22
22
|
from ....configs import Config
|
|
23
23
|
from ....resources import UseResources
|
|
@@ -131,12 +131,12 @@ class AnthropicChatChoicesStreamService:
|
|
|
131
131
|
cbk_start = ae
|
|
132
132
|
|
|
133
133
|
if isinstance(ae.content_block, AnthropicSseDecoderEvents.ContentBlockStart.Text): # noqa
|
|
134
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
134
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([ContentAiDelta(
|
|
135
135
|
ae.content_block.text,
|
|
136
136
|
)])]))
|
|
137
137
|
|
|
138
138
|
elif isinstance(ae.content_block, AnthropicSseDecoderEvents.ContentBlockStart.ToolUse): # noqa
|
|
139
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
139
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([PartialToolUseAiDelta( # noqa
|
|
140
140
|
id=ae.content_block.id,
|
|
141
141
|
name=ae.content_block.name,
|
|
142
142
|
raw_args=ae.content_block.input,
|
|
@@ -149,12 +149,12 @@ class AnthropicChatChoicesStreamService:
|
|
|
149
149
|
check.not_none(cbk_start)
|
|
150
150
|
|
|
151
151
|
if isinstance(ae.delta, AnthropicSseDecoderEvents.ContentBlockDelta.TextDelta):
|
|
152
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
152
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([ContentAiDelta(
|
|
153
153
|
ae.delta.text,
|
|
154
154
|
)])]))
|
|
155
155
|
|
|
156
156
|
elif isinstance(ae.delta, AnthropicSseDecoderEvents.ContentBlockDelta.InputJsonDelta): # noqa
|
|
157
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
157
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([PartialToolUseAiDelta( # noqa
|
|
158
158
|
raw_args=ae.delta.partial_json,
|
|
159
159
|
)])]))
|
|
160
160
|
|
|
@@ -6,15 +6,15 @@ from omlish.text.lorem import LOREM
|
|
|
6
6
|
from ....chat.choices.services import ChatChoicesRequest
|
|
7
7
|
from ....chat.choices.services import ChatChoicesResponse
|
|
8
8
|
from ....chat.choices.services import static_check_is_chat_choices_service
|
|
9
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
10
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
11
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
12
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
13
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
9
14
|
from ....chat.choices.types import AiChoice
|
|
10
15
|
from ....chat.choices.types import ChatChoicesOutputs
|
|
11
16
|
from ....chat.messages import AiMessage
|
|
12
|
-
from ....chat.stream.
|
|
13
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
14
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
15
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
16
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
17
|
-
from ....chat.stream.types import ContentAiChoiceDelta
|
|
17
|
+
from ....chat.stream.types import ContentAiDelta
|
|
18
18
|
from ....resources import UseResources
|
|
19
19
|
from ....stream.services import StreamResponseSink
|
|
20
20
|
from ....stream.services import new_stream_response
|
|
@@ -48,7 +48,7 @@ class DummyChatChoicesStreamService:
|
|
|
48
48
|
for s in LOREM:
|
|
49
49
|
await sink.emit(AiChoicesDeltas([
|
|
50
50
|
AiChoiceDeltas([
|
|
51
|
-
|
|
51
|
+
ContentAiDelta(s),
|
|
52
52
|
]),
|
|
53
53
|
]))
|
|
54
54
|
|
|
@@ -11,6 +11,11 @@ from omlish.http import all as http
|
|
|
11
11
|
from omlish.io.buffers import DelimitingBuffer
|
|
12
12
|
|
|
13
13
|
from .....backends.google.protocol import types as pt
|
|
14
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
15
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
16
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
17
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
18
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
14
19
|
from ....chat.choices.types import ChatChoicesOutputs
|
|
15
20
|
from ....chat.messages import AiMessage
|
|
16
21
|
from ....chat.messages import Message
|
|
@@ -18,13 +23,8 @@ from ....chat.messages import SystemMessage
|
|
|
18
23
|
from ....chat.messages import ToolUseMessage
|
|
19
24
|
from ....chat.messages import ToolUseResultMessage
|
|
20
25
|
from ....chat.messages import UserMessage
|
|
21
|
-
from ....chat.stream.
|
|
22
|
-
from ....chat.stream.
|
|
23
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
24
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
25
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
26
|
-
from ....chat.stream.types import ContentAiChoiceDelta
|
|
27
|
-
from ....chat.stream.types import ToolUseAiChoiceDelta
|
|
26
|
+
from ....chat.stream.types import ContentAiDelta
|
|
27
|
+
from ....chat.stream.types import ToolUseAiDelta
|
|
28
28
|
from ....chat.tools.types import Tool
|
|
29
29
|
from ....models.configs import ModelName
|
|
30
30
|
from ....resources import UseResources
|
|
@@ -194,7 +194,7 @@ class GoogleChatChoicesStreamService:
|
|
|
194
194
|
check.none(p.function_call)
|
|
195
195
|
await sink.emit(AiChoicesDeltas([
|
|
196
196
|
AiChoiceDeltas([
|
|
197
|
-
|
|
197
|
+
ContentAiDelta(check.not_none(txt)),
|
|
198
198
|
]),
|
|
199
199
|
]))
|
|
200
200
|
|
|
@@ -202,7 +202,7 @@ class GoogleChatChoicesStreamService:
|
|
|
202
202
|
check.none(p.text)
|
|
203
203
|
await sink.emit(AiChoicesDeltas([
|
|
204
204
|
AiChoiceDeltas([
|
|
205
|
-
|
|
205
|
+
ToolUseAiDelta(
|
|
206
206
|
id=fc.id,
|
|
207
207
|
name=fc.name,
|
|
208
208
|
args=fc.args,
|
|
@@ -5,6 +5,7 @@ from omlish.formats import json
|
|
|
5
5
|
|
|
6
6
|
from .....backends.groq import protocol as pt
|
|
7
7
|
from ....chat.choices.services import ChatChoicesResponse
|
|
8
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
8
9
|
from ....chat.choices.types import AiChoice
|
|
9
10
|
from ....chat.messages import AiMessage
|
|
10
11
|
from ....chat.messages import AnyAiMessage
|
|
@@ -13,10 +14,9 @@ from ....chat.messages import SystemMessage
|
|
|
13
14
|
from ....chat.messages import ToolUseMessage
|
|
14
15
|
from ....chat.messages import ToolUseResultMessage
|
|
15
16
|
from ....chat.messages import UserMessage
|
|
16
|
-
from ....chat.stream.types import
|
|
17
|
-
from ....chat.stream.types import
|
|
18
|
-
from ....chat.stream.types import
|
|
19
|
-
from ....chat.stream.types import ToolUseAiChoiceDelta
|
|
17
|
+
from ....chat.stream.types import AiDelta
|
|
18
|
+
from ....chat.stream.types import ContentAiDelta
|
|
19
|
+
from ....chat.stream.types import ToolUseAiDelta
|
|
20
20
|
from ....chat.tools.types import Tool
|
|
21
21
|
from ....content.prepare import prepare_content_str
|
|
22
22
|
from ....tools.jsonschema import build_tool_spec_params_json_schema
|
|
@@ -121,14 +121,14 @@ def build_mc_choices_response(gq_resp: pt.ChatCompletionResponse) -> ChatChoices
|
|
|
121
121
|
|
|
122
122
|
def build_mc_ai_choice_deltas(delta: pt.ChatCompletionChunk.Choice.Delta) -> AiChoiceDeltas:
|
|
123
123
|
if delta.role in (None, 'assistant'):
|
|
124
|
-
lst: list[
|
|
124
|
+
lst: list[AiDelta] = []
|
|
125
125
|
|
|
126
126
|
if delta.content is not None:
|
|
127
|
-
lst.append(
|
|
127
|
+
lst.append(ContentAiDelta(delta.content))
|
|
128
128
|
|
|
129
129
|
for tc in delta.tool_calls or []:
|
|
130
130
|
tc_fn = check.not_none(tc.function)
|
|
131
|
-
lst.append(
|
|
131
|
+
lst.append(ToolUseAiDelta(
|
|
132
132
|
id=tc.id,
|
|
133
133
|
name=check.not_none(tc_fn.name),
|
|
134
134
|
args=json.loads(tc_fn.arguments or '{}'),
|
|
@@ -10,10 +10,10 @@ from omlish.io.buffers import DelimitingBuffer
|
|
|
10
10
|
|
|
11
11
|
from .....backends.groq import protocol as pt
|
|
12
12
|
from ....chat.choices.services import ChatChoicesOutputs
|
|
13
|
-
from ....chat.stream.services import ChatChoicesStreamRequest
|
|
14
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
15
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
16
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
13
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
14
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
15
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
16
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
17
17
|
from ....chat.tools.types import Tool
|
|
18
18
|
from ....configs import Config
|
|
19
19
|
from ....resources import UseResources
|
|
@@ -10,12 +10,12 @@ from omlish import typedvalues as tv
|
|
|
10
10
|
|
|
11
11
|
from .....backends import llamacpp as lcu
|
|
12
12
|
from ....chat.choices.services import ChatChoicesOutputs
|
|
13
|
-
from ....chat.stream.services import ChatChoicesStreamRequest
|
|
14
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
15
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
16
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
17
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
18
|
-
from ....chat.stream.types import
|
|
13
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
14
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
15
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
16
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
17
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
18
|
+
from ....chat.stream.types import ContentAiDelta
|
|
19
19
|
from ....configs import Config
|
|
20
20
|
from ....models.configs import ModelPath
|
|
21
21
|
from ....resources import UseResources
|
|
@@ -102,7 +102,7 @@ class LlamacppChatChoicesStreamService(lang.ExitStacked):
|
|
|
102
102
|
# FIXME: stop reason
|
|
103
103
|
|
|
104
104
|
if (content := delta.get('content', '')):
|
|
105
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
105
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([ContentAiDelta(content)])]))
|
|
106
106
|
|
|
107
107
|
return None
|
|
108
108
|
|
|
@@ -10,18 +10,18 @@ from ....chat.choices.services import ChatChoicesOutputs
|
|
|
10
10
|
from ....chat.choices.services import ChatChoicesRequest
|
|
11
11
|
from ....chat.choices.services import ChatChoicesResponse
|
|
12
12
|
from ....chat.choices.services import static_check_is_chat_choices_service
|
|
13
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
14
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
15
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
16
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
17
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
13
18
|
from ....chat.choices.types import AiChoice
|
|
14
19
|
from ....chat.choices.types import ChatChoicesOptions
|
|
15
20
|
from ....chat.messages import AiMessage
|
|
16
21
|
from ....chat.messages import Message
|
|
17
22
|
from ....chat.messages import SystemMessage
|
|
18
23
|
from ....chat.messages import UserMessage
|
|
19
|
-
from ....chat.stream.
|
|
20
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
21
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
22
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
23
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
24
|
-
from ....chat.stream.types import ContentAiChoiceDelta
|
|
24
|
+
from ....chat.stream.types import ContentAiDelta
|
|
25
25
|
from ....configs import Config
|
|
26
26
|
from ....llms.types import MaxTokens
|
|
27
27
|
from ....models.configs import ModelPath
|
|
@@ -207,7 +207,7 @@ class MlxChatChoicesStreamService(BaseMlxChatChoicesService):
|
|
|
207
207
|
for go in gen:
|
|
208
208
|
if go.text:
|
|
209
209
|
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
210
|
-
|
|
210
|
+
ContentAiDelta(go.text),
|
|
211
211
|
])]))
|
|
212
212
|
|
|
213
213
|
return []
|
|
@@ -13,18 +13,18 @@ from ....chat.choices.services import ChatChoicesOutputs
|
|
|
13
13
|
from ....chat.choices.services import ChatChoicesRequest
|
|
14
14
|
from ....chat.choices.services import ChatChoicesResponse
|
|
15
15
|
from ....chat.choices.services import static_check_is_chat_choices_service
|
|
16
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
17
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
18
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
19
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
20
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
16
21
|
from ....chat.choices.types import AiChoice
|
|
17
22
|
from ....chat.messages import AiMessage
|
|
18
23
|
from ....chat.messages import AnyAiMessage
|
|
19
24
|
from ....chat.messages import Message
|
|
20
25
|
from ....chat.messages import SystemMessage
|
|
21
26
|
from ....chat.messages import UserMessage
|
|
22
|
-
from ....chat.stream.
|
|
23
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
24
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
25
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
26
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
27
|
-
from ....chat.stream.types import ContentAiChoiceDelta
|
|
27
|
+
from ....chat.stream.types import ContentAiDelta
|
|
28
28
|
from ....models.configs import ModelName
|
|
29
29
|
from ....resources import UseResources
|
|
30
30
|
from ....standard import ApiUrl
|
|
@@ -189,7 +189,7 @@ class OllamaChatChoicesStreamService(BaseOllamaChatChoicesService):
|
|
|
189
189
|
check.state(not lp.message.tool_calls)
|
|
190
190
|
|
|
191
191
|
if (c := lp.message.content):
|
|
192
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
192
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([ContentAiDelta(
|
|
193
193
|
c,
|
|
194
194
|
)])]))
|
|
195
195
|
|
|
@@ -17,9 +17,9 @@ from ....chat.messages import SystemMessage
|
|
|
17
17
|
from ....chat.messages import ToolUseMessage
|
|
18
18
|
from ....chat.messages import ToolUseResultMessage
|
|
19
19
|
from ....chat.messages import UserMessage
|
|
20
|
-
from ....chat.stream.types import
|
|
21
|
-
from ....chat.stream.types import
|
|
22
|
-
from ....chat.stream.types import
|
|
20
|
+
from ....chat.stream.types import AiDelta
|
|
21
|
+
from ....chat.stream.types import ContentAiDelta
|
|
22
|
+
from ....chat.stream.types import PartialToolUseAiDelta
|
|
23
23
|
from ....chat.tools.types import Tool
|
|
24
24
|
from ....content.json import JsonContent
|
|
25
25
|
from ....content.prepare import prepare_content_str
|
|
@@ -128,16 +128,16 @@ def build_mc_choices_response(oai_resp: pt.ChatCompletionResponse) -> ChatChoice
|
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
def
|
|
131
|
+
def build_mc_ai_delta(delta: pt.ChatCompletionChunkChoiceDelta) -> AiDelta:
|
|
132
132
|
if delta.content is not None:
|
|
133
133
|
check.state(not delta.tool_calls)
|
|
134
|
-
return
|
|
134
|
+
return ContentAiDelta(delta.content)
|
|
135
135
|
|
|
136
136
|
elif delta.tool_calls is not None:
|
|
137
137
|
check.state(delta.content is None)
|
|
138
138
|
tc = check.single(delta.tool_calls)
|
|
139
139
|
tc_fn = check.not_none(tc.function)
|
|
140
|
-
return
|
|
140
|
+
return PartialToolUseAiDelta(
|
|
141
141
|
id=tc.id,
|
|
142
142
|
name=tc_fn.name,
|
|
143
143
|
raw_args=tc_fn.arguments,
|
|
@@ -166,8 +166,8 @@ class OpenaiChatRequestHandler:
|
|
|
166
166
|
self._mandatory_kwargs = mandatory_kwargs
|
|
167
167
|
|
|
168
168
|
DEFAULT_OPTIONS: ta.ClassVar[tv.TypedValues[Option]] = tv.TypedValues[Option](
|
|
169
|
-
Temperature(0.),
|
|
170
|
-
MaxTokens(1024),
|
|
169
|
+
# Temperature(0.),
|
|
170
|
+
# MaxTokens(1024),
|
|
171
171
|
)
|
|
172
172
|
|
|
173
173
|
_OPTION_KWARG_NAMES_MAP: ta.ClassVar[ta.Mapping[str, type[ChatChoicesOptions]]] = dict(
|
|
@@ -182,8 +182,8 @@ class OpenaiChatRequestHandler:
|
|
|
182
182
|
@cached.function
|
|
183
183
|
def _process_options(self) -> _ProcessedOptions:
|
|
184
184
|
kwargs: dict = dict(
|
|
185
|
-
temperature=0,
|
|
186
|
-
max_tokens=1024,
|
|
185
|
+
# temperature=0,
|
|
186
|
+
# max_tokens=1024,
|
|
187
187
|
)
|
|
188
188
|
|
|
189
189
|
tools_by_name: dict[str, ToolSpec] = {}
|
|
@@ -13,12 +13,12 @@ from omlish.io.buffers import DelimitingBuffer
|
|
|
13
13
|
|
|
14
14
|
from .....backends.openai import protocol as pt
|
|
15
15
|
from ....chat.choices.services import ChatChoicesOutputs
|
|
16
|
-
from ....chat.stream.services import ChatChoicesStreamRequest
|
|
17
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
18
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
19
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
20
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
21
|
-
from ....chat.stream.types import ChatChoicesStreamOption
|
|
16
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
17
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
18
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
19
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
20
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
21
|
+
from ....chat.choices.stream.types import ChatChoicesStreamOption
|
|
22
22
|
from ....configs import Config
|
|
23
23
|
from ....resources import ResourcesOption
|
|
24
24
|
from ....resources import UseResources
|
|
@@ -28,7 +28,7 @@ from ....stream.services import StreamResponseSink
|
|
|
28
28
|
from ....stream.services import new_stream_response
|
|
29
29
|
from .chat import OpenaiChatChoicesService
|
|
30
30
|
from .format import OpenaiChatRequestHandler
|
|
31
|
-
from .format import
|
|
31
|
+
from .format import build_mc_ai_delta
|
|
32
32
|
from .names import CHAT_MODEL_NAMES
|
|
33
33
|
|
|
34
34
|
|
|
@@ -122,7 +122,7 @@ class OpenaiChatChoicesStreamService:
|
|
|
122
122
|
break
|
|
123
123
|
|
|
124
124
|
await sink.emit(AiChoicesDeltas([
|
|
125
|
-
AiChoiceDeltas([
|
|
125
|
+
AiChoiceDeltas([build_mc_ai_delta(choice.delta)])
|
|
126
126
|
for choice in ccc.choices
|
|
127
127
|
]))
|
|
128
128
|
|
|
@@ -9,18 +9,18 @@ from ....chat.choices.services import ChatChoicesOptions
|
|
|
9
9
|
from ....chat.choices.services import ChatChoicesRequest
|
|
10
10
|
from ....chat.choices.services import ChatChoicesResponse
|
|
11
11
|
from ....chat.choices.services import static_check_is_chat_choices_service
|
|
12
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
13
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
14
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
15
|
+
from ....chat.choices.stream.types import AiChoiceDeltas
|
|
16
|
+
from ....chat.choices.stream.types import AiChoicesDeltas
|
|
12
17
|
from ....chat.choices.types import AiChoice
|
|
13
18
|
from ....chat.choices.types import ChatChoicesOutputs
|
|
14
19
|
from ....chat.messages import AiMessage
|
|
15
20
|
from ....chat.messages import Chat
|
|
16
21
|
from ....chat.messages import SystemMessage
|
|
17
22
|
from ....chat.messages import UserMessage
|
|
18
|
-
from ....chat.stream.
|
|
19
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
20
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
21
|
-
from ....chat.stream.types import AiChoiceDeltas
|
|
22
|
-
from ....chat.stream.types import AiChoicesDeltas
|
|
23
|
-
from ....chat.stream.types import ContentAiChoiceDelta
|
|
23
|
+
from ....chat.stream.types import ContentAiDelta
|
|
24
24
|
from ....chat.types import ChatOption
|
|
25
25
|
from ....llms.types import LlmOption
|
|
26
26
|
from ....resources import UseResources
|
|
@@ -151,7 +151,7 @@ class TinygradLlama3ChatChoicesStreamService(BaseTinygradLlama3ChatService):
|
|
|
151
151
|
for s in tgl3.run_llm(llm, toks):
|
|
152
152
|
await sink.emit(AiChoicesDeltas([
|
|
153
153
|
AiChoiceDeltas([
|
|
154
|
-
|
|
154
|
+
ContentAiDelta(s),
|
|
155
155
|
]),
|
|
156
156
|
]))
|
|
157
157
|
|
|
@@ -19,6 +19,11 @@ from .....backends.transformers.streamers import CancellableTextStreamer
|
|
|
19
19
|
from ....chat.choices.services import ChatChoicesRequest
|
|
20
20
|
from ....chat.choices.services import ChatChoicesResponse
|
|
21
21
|
from ....chat.choices.services import static_check_is_chat_choices_service
|
|
22
|
+
from ....chat.choices.stream.services import ChatChoicesStreamRequest
|
|
23
|
+
from ....chat.choices.stream.services import ChatChoicesStreamResponse
|
|
24
|
+
from ....chat.choices.stream.services import static_check_is_chat_choices_stream_service
|
|
25
|
+
from ....chat.choices.stream.types import AiChoiceDeltas # noqa
|
|
26
|
+
from ....chat.choices.stream.types import AiChoicesDeltas # noqa
|
|
22
27
|
from ....chat.choices.types import AiChoice
|
|
23
28
|
from ....chat.choices.types import ChatChoicesOutputs
|
|
24
29
|
from ....chat.messages import AiMessage
|
|
@@ -27,12 +32,7 @@ from ....chat.messages import SystemMessage
|
|
|
27
32
|
from ....chat.messages import ToolUseMessage
|
|
28
33
|
from ....chat.messages import ToolUseResultMessage
|
|
29
34
|
from ....chat.messages import UserMessage
|
|
30
|
-
from ....chat.stream.
|
|
31
|
-
from ....chat.stream.services import ChatChoicesStreamResponse
|
|
32
|
-
from ....chat.stream.services import static_check_is_chat_choices_stream_service
|
|
33
|
-
from ....chat.stream.types import AiChoiceDeltas # noqa
|
|
34
|
-
from ....chat.stream.types import AiChoicesDeltas # noqa
|
|
35
|
-
from ....chat.stream.types import ContentAiChoiceDelta # noqa
|
|
35
|
+
from ....chat.stream.types import ContentAiDelta # noqa
|
|
36
36
|
from ....completion import CompletionRequest
|
|
37
37
|
from ....completion import CompletionResponse
|
|
38
38
|
from ....completion import static_check_is_completion_service
|
|
@@ -288,7 +288,7 @@ class TransformersChatChoicesStreamService(BaseTransformersChatChoicesService):
|
|
|
288
288
|
end = False
|
|
289
289
|
|
|
290
290
|
if out:
|
|
291
|
-
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([
|
|
291
|
+
await sink.emit(AiChoicesDeltas([AiChoiceDeltas([ContentAiDelta(out)])]))
|
|
292
292
|
|
|
293
293
|
if end:
|
|
294
294
|
break
|
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from omlish import dataclasses as dc
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from ..
|
|
5
|
-
from ..
|
|
6
|
-
from ..
|
|
7
|
-
from ..
|
|
8
|
-
from .joining import
|
|
3
|
+
from ....services import Response
|
|
4
|
+
from ..services import ChatChoicesRequest
|
|
5
|
+
from ..services import static_check_is_chat_choices_service
|
|
6
|
+
from ..types import AiChoice
|
|
7
|
+
from ..types import AiChoices
|
|
8
|
+
from .joining import AiChoicesDeltaJoiner
|
|
9
9
|
from .services import ChatChoicesOutputs
|
|
10
10
|
from .services import ChatChoicesStreamOutputs
|
|
11
11
|
from .services import ChatChoicesStreamService
|
|
@@ -23,7 +23,7 @@ class ChatChoicesStreamServiceChatChoicesService:
|
|
|
23
23
|
AiChoices,
|
|
24
24
|
ChatChoicesOutputs | ChatChoicesStreamOutputs,
|
|
25
25
|
]:
|
|
26
|
-
joiner =
|
|
26
|
+
joiner = AiChoicesDeltaJoiner()
|
|
27
27
|
|
|
28
28
|
async with (resp := await self.service.invoke(request)).v as it: # noqa
|
|
29
29
|
async for cs in it:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import typing as ta
|
|
2
|
+
|
|
3
|
+
from omlish import check
|
|
4
|
+
|
|
5
|
+
from ...messages import AiChat
|
|
6
|
+
from ...stream.joining import AiDeltaJoiner
|
|
7
|
+
from .types import AiChoiceDeltas
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AiChoicesDeltaJoiner:
|
|
14
|
+
def __init__(self) -> None:
|
|
15
|
+
super().__init__()
|
|
16
|
+
|
|
17
|
+
self._seq = 0
|
|
18
|
+
self._channels: list[AiDeltaJoiner] = []
|
|
19
|
+
|
|
20
|
+
def add(self, choices: ta.Sequence[AiChoiceDeltas]) -> None:
|
|
21
|
+
if not self._seq:
|
|
22
|
+
check.empty(self._channels)
|
|
23
|
+
self._channels.extend(AiDeltaJoiner() for _ in range(len(choices)))
|
|
24
|
+
|
|
25
|
+
for chan, c in zip(self._channels, choices, strict=True):
|
|
26
|
+
chan.add(c.deltas)
|
|
27
|
+
|
|
28
|
+
self._seq += 1
|
|
29
|
+
|
|
30
|
+
def build(self) -> list[AiChat]:
|
|
31
|
+
return [list(chan.build()) for chan in self._channels]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import typing as ta
|
|
3
|
+
|
|
4
|
+
from omlish import lang
|
|
5
|
+
|
|
6
|
+
from ....registries.globals import register_type
|
|
7
|
+
from ....services import Request
|
|
8
|
+
from ....services import Service
|
|
9
|
+
from ....stream.services import StreamResponse
|
|
10
|
+
from ...messages import Chat
|
|
11
|
+
from ..types import ChatChoicesOutputs
|
|
12
|
+
from .types import AiChoicesDeltas
|
|
13
|
+
from .types import ChatChoicesStreamOptions
|
|
14
|
+
from .types import ChatChoicesStreamOutputs
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
ChatChoicesStreamRequest: ta.TypeAlias = Request[Chat, ChatChoicesStreamOptions]
|
|
21
|
+
|
|
22
|
+
ChatChoicesStreamResponse: ta.TypeAlias = StreamResponse[
|
|
23
|
+
AiChoicesDeltas,
|
|
24
|
+
ChatChoicesOutputs,
|
|
25
|
+
ChatChoicesStreamOutputs,
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
# @omlish-manifest $.minichain.registries.manifests.RegistryTypeManifest
|
|
29
|
+
ChatChoicesStreamService: ta.TypeAlias = Service[ChatChoicesStreamRequest, ChatChoicesStreamResponse]
|
|
30
|
+
|
|
31
|
+
register_type(ChatChoicesStreamService, module=__name__)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def static_check_is_chat_choices_stream_service[T: ChatChoicesStreamService](t: type[T]) -> type[T]:
|
|
35
|
+
return t
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@static_check_is_chat_choices_stream_service
|
|
42
|
+
class AbstractChatChoicesStreamService(lang.Abstract):
|
|
43
|
+
@abc.abstractmethod
|
|
44
|
+
def invoke(self, request: ChatChoicesStreamRequest) -> ta.Awaitable[ChatChoicesStreamResponse]:
|
|
45
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import typing as ta
|
|
2
|
+
|
|
3
|
+
from omlish import dataclasses as dc
|
|
4
|
+
from omlish import lang
|
|
5
|
+
|
|
6
|
+
from ....stream.services import StreamOptions
|
|
7
|
+
from ....types import Option
|
|
8
|
+
from ....types import Output
|
|
9
|
+
from ...stream.types import AiDeltas
|
|
10
|
+
from ..types import ChatChoicesOptions
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ChatChoicesStreamOption(Option, lang.Abstract, lang.PackageSealed):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
ChatChoicesStreamOptions: ta.TypeAlias = ChatChoicesStreamOption | StreamOptions | ChatChoicesOptions
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ChatChoicesStreamOutput(Output, lang.Abstract, lang.PackageSealed):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ChatChoicesStreamOutputs: ta.TypeAlias = ChatChoicesStreamOutput
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dc.dataclass(frozen=True)
|
|
37
|
+
class AiChoiceDeltas(lang.Final):
|
|
38
|
+
deltas: AiDeltas
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dc.dataclass(frozen=True)
|
|
42
|
+
class AiChoicesDeltas(lang.Final):
|
|
43
|
+
choices: ta.Sequence[AiChoiceDeltas]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from omlish import lang
|
|
2
2
|
from omlish import marshal as msh
|
|
3
3
|
|
|
4
|
-
from .types import
|
|
4
|
+
from .types import AiDelta
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
##
|
|
@@ -9,8 +9,8 @@ from .types import AiChoiceDelta
|
|
|
9
9
|
|
|
10
10
|
@lang.static_init
|
|
11
11
|
def _install_standard_marshaling() -> None:
|
|
12
|
-
|
|
12
|
+
ad_poly = msh.polymorphism_from_subclasses(AiDelta, naming=msh.Naming.SNAKE)
|
|
13
13
|
msh.install_standard_factories(
|
|
14
|
-
msh.PolymorphismMarshalerFactory(
|
|
15
|
-
msh.PolymorphismUnmarshalerFactory(
|
|
14
|
+
msh.PolymorphismMarshalerFactory(ad_poly),
|
|
15
|
+
msh.PolymorphismUnmarshalerFactory(ad_poly),
|
|
16
16
|
)
|
|
@@ -8,40 +8,36 @@ from ..messages import AiChat
|
|
|
8
8
|
from ..messages import AiMessage
|
|
9
9
|
from ..messages import AnyAiMessage
|
|
10
10
|
from ..messages import ToolUseMessage
|
|
11
|
-
from .types import
|
|
12
|
-
from .types import
|
|
13
|
-
from .types import
|
|
14
|
-
from .types import
|
|
15
|
-
from .types import
|
|
11
|
+
from .types import AiDelta
|
|
12
|
+
from .types import AiDeltas
|
|
13
|
+
from .types import ContentAiDelta
|
|
14
|
+
from .types import PartialToolUseAiDelta
|
|
15
|
+
from .types import ToolUseAiDelta
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
##
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class AiDeltaJoiner:
|
|
22
22
|
def __init__(self) -> None:
|
|
23
23
|
super().__init__()
|
|
24
24
|
|
|
25
|
-
self.
|
|
26
|
-
self.
|
|
25
|
+
self._deltas: list[AiDelta] = []
|
|
26
|
+
self._messages: list[AnyAiMessage] = []
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
deltas: list[AiChoiceDelta]
|
|
30
|
-
messages: list[AnyAiMessage]
|
|
31
|
-
|
|
32
|
-
def _build_joined(self, deltas: ta.Sequence[AiChoiceDelta]) -> AnyAiMessage:
|
|
28
|
+
def _build_joined(self, deltas: ta.Sequence[AiDelta]) -> AnyAiMessage:
|
|
33
29
|
dty = check.single(set(map(type, check.not_empty(deltas))))
|
|
34
30
|
|
|
35
|
-
if dty is
|
|
36
|
-
cds = ta.cast(ta.Sequence[
|
|
31
|
+
if dty is ContentAiDelta:
|
|
32
|
+
cds = ta.cast(ta.Sequence[ContentAiDelta], deltas)
|
|
37
33
|
return AiMessage(''.join(check.isinstance(cd.c, str) for cd in cds))
|
|
38
34
|
|
|
39
|
-
elif dty is
|
|
35
|
+
elif dty is ToolUseAiDelta:
|
|
40
36
|
raise TypeError(dty)
|
|
41
37
|
|
|
42
|
-
elif dty is
|
|
43
|
-
tds = ta.cast(ta.Sequence[
|
|
44
|
-
for td in ta.cast(ta.Sequence[
|
|
38
|
+
elif dty is PartialToolUseAiDelta:
|
|
39
|
+
tds = ta.cast(ta.Sequence[PartialToolUseAiDelta], deltas)
|
|
40
|
+
for td in ta.cast(ta.Sequence[PartialToolUseAiDelta], deltas)[1:]:
|
|
45
41
|
check.none(td.id)
|
|
46
42
|
check.none(td.name)
|
|
47
43
|
|
|
@@ -57,19 +53,19 @@ class AiChoiceDeltaJoiner:
|
|
|
57
53
|
else:
|
|
58
54
|
raise TypeError(dty)
|
|
59
55
|
|
|
60
|
-
def
|
|
61
|
-
if not
|
|
56
|
+
def _maybe_join(self) -> None:
|
|
57
|
+
if not self._deltas:
|
|
62
58
|
return
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
self._messages.append(self._build_joined(self._deltas))
|
|
61
|
+
self._deltas.clear()
|
|
66
62
|
|
|
67
|
-
def
|
|
68
|
-
if
|
|
69
|
-
self.
|
|
63
|
+
def _add_one(self, d: AiDelta) -> None:
|
|
64
|
+
if self._deltas and type(self._deltas[0]) is not type(d):
|
|
65
|
+
self._maybe_join()
|
|
70
66
|
|
|
71
|
-
if isinstance(d,
|
|
72
|
-
|
|
67
|
+
if isinstance(d, ToolUseAiDelta):
|
|
68
|
+
self._messages.append(ToolUseMessage(ToolUse(
|
|
73
69
|
id=d.id,
|
|
74
70
|
name=check.not_none(d.name),
|
|
75
71
|
args=d.args or {},
|
|
@@ -77,21 +73,13 @@ class AiChoiceDeltaJoiner:
|
|
|
77
73
|
)))
|
|
78
74
|
|
|
79
75
|
else:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def add(self, choices: ta.Sequence[AiChoiceDeltas]) -> None:
|
|
83
|
-
if not self._seq:
|
|
84
|
-
check.empty(self._channels)
|
|
85
|
-
self._channels.extend(self._Channel([], []) for _ in range(len(choices)))
|
|
86
|
-
|
|
87
|
-
for chan, c in zip(self._channels, choices, strict=True):
|
|
88
|
-
for d in c.deltas:
|
|
89
|
-
self._add_to(chan, d)
|
|
76
|
+
self._deltas.append(d)
|
|
90
77
|
|
|
91
|
-
|
|
78
|
+
def add(self, deltas: AiDeltas) -> None:
|
|
79
|
+
for d in deltas:
|
|
80
|
+
self._add_one(d)
|
|
92
81
|
|
|
93
|
-
def build(self) ->
|
|
94
|
-
|
|
95
|
-
self._join_one(chan)
|
|
82
|
+
def build(self) -> AiChat:
|
|
83
|
+
self._maybe_join()
|
|
96
84
|
|
|
97
|
-
return
|
|
85
|
+
return list(self._messages)
|
|
@@ -7,39 +7,39 @@ from ...registries.globals import register_type
|
|
|
7
7
|
from ...services import Request
|
|
8
8
|
from ...services import Service
|
|
9
9
|
from ...stream.services import StreamResponse
|
|
10
|
-
from ..choices.types import ChatChoicesOutputs
|
|
11
10
|
from ..messages import Chat
|
|
12
|
-
from
|
|
13
|
-
from .types import
|
|
14
|
-
from .types import
|
|
11
|
+
from ..types import ChatOutputs
|
|
12
|
+
from .types import AiDeltas
|
|
13
|
+
from .types import ChatStreamOptions
|
|
14
|
+
from .types import ChatStreamOutputs
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
##
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
ChatStreamRequest: ta.TypeAlias = Request[Chat, ChatStreamOptions]
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
ChatStreamResponse: ta.TypeAlias = StreamResponse[
|
|
23
|
+
AiDeltas,
|
|
24
|
+
ChatOutputs,
|
|
25
|
+
ChatStreamOutputs,
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
# @omlish-manifest $.minichain.registries.manifests.RegistryTypeManifest
|
|
29
|
-
|
|
29
|
+
ChatStreamService: ta.TypeAlias = Service[ChatStreamRequest, ChatStreamResponse]
|
|
30
30
|
|
|
31
|
-
register_type(
|
|
31
|
+
register_type(ChatStreamService, module=__name__)
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def static_check_is_chat_stream_service[T: ChatStreamService](t: type[T]) -> type[T]:
|
|
35
35
|
return t
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
##
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
@
|
|
42
|
-
class
|
|
41
|
+
@static_check_is_chat_stream_service
|
|
42
|
+
class AbstractChatStreamService(lang.Abstract):
|
|
43
43
|
@abc.abstractmethod
|
|
44
|
-
def invoke(self, request:
|
|
44
|
+
def invoke(self, request: ChatStreamRequest) -> ta.Awaitable[ChatStreamResponse]:
|
|
45
45
|
raise NotImplementedError
|
|
@@ -8,7 +8,7 @@ from ...content.types import Content
|
|
|
8
8
|
from ...stream.services import StreamOptions
|
|
9
9
|
from ...types import Option
|
|
10
10
|
from ...types import Output
|
|
11
|
-
from ..
|
|
11
|
+
from ..types import ChatOptions
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
msh.register_global_module_import('._marshal', __package__)
|
|
@@ -17,36 +17,39 @@ msh.register_global_module_import('._marshal', __package__)
|
|
|
17
17
|
##
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class ChatStreamOption(Option, lang.Abstract, lang.PackageSealed):
|
|
21
21
|
pass
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
ChatStreamOptions: ta.TypeAlias = ChatStreamOption | StreamOptions | ChatOptions
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
##
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
class
|
|
30
|
+
class ChatStreamOutput(Output, lang.Abstract, lang.PackageSealed):
|
|
31
31
|
pass
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
ChatStreamOutputs: ta.TypeAlias = ChatStreamOutput
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
##
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
@dc.dataclass(frozen=True)
|
|
41
|
-
class
|
|
41
|
+
class AiDelta(lang.Sealed, lang.Abstract):
|
|
42
42
|
pass
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
AiDeltas: ta.TypeAlias = ta.Sequence[AiDelta]
|
|
46
|
+
|
|
47
|
+
|
|
45
48
|
#
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
@dc.dataclass(frozen=True)
|
|
49
|
-
class
|
|
52
|
+
class ContentAiDelta(AiDelta, lang.Final):
|
|
50
53
|
c: Content
|
|
51
54
|
|
|
52
55
|
|
|
@@ -54,29 +57,16 @@ class ContentAiChoiceDelta(AiChoiceDelta, lang.Final):
|
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
57
|
-
class
|
|
60
|
+
class AnyToolUseAiDelta(AiDelta, lang.Abstract):
|
|
58
61
|
id: str | None = None
|
|
59
62
|
name: str | None = None
|
|
60
63
|
|
|
61
64
|
|
|
62
65
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
63
|
-
class
|
|
66
|
+
class ToolUseAiDelta(AnyToolUseAiDelta, lang.Final):
|
|
64
67
|
args: ta.Mapping[str, ta.Any] | None = None
|
|
65
68
|
|
|
66
69
|
|
|
67
70
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
68
|
-
class
|
|
71
|
+
class PartialToolUseAiDelta(AnyToolUseAiDelta, lang.Final):
|
|
69
72
|
raw_args: ta.Any | None = None
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@dc.dataclass(frozen=True)
|
|
76
|
-
class AiChoiceDeltas(lang.Final):
|
|
77
|
-
deltas: ta.Sequence[AiChoiceDelta]
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@dc.dataclass(frozen=True)
|
|
81
|
-
class AiChoicesDeltas(lang.Final):
|
|
82
|
-
choices: ta.Sequence[AiChoiceDeltas]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev478
|
|
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.
|
|
18
|
-
Requires-Dist: omlish==0.0.0.
|
|
17
|
+
Requires-Dist: omdev==0.0.0.dev478
|
|
18
|
+
Requires-Dist: omlish==0.0.0.dev478
|
|
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=
|
|
1
|
+
ommlds/.omlish-manifests.json,sha256=uNauTZ9FpiirIw1ElVuf66UOCUR-K7BN8lfCPUNnINg,25714
|
|
2
2
|
ommlds/__about__.py,sha256=5ekfRjb6SiK6o6SAusykyPQ_oxy46_IEga7nD0EL0cI,1839
|
|
3
3
|
ommlds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
ommlds/_hacks/__init__.py,sha256=ajfw7dMKH8UuloeQ5MSxWwgAmdWf2v8gm-K3uLP9wtY,196
|
|
@@ -123,10 +123,10 @@ ommlds/cli/sessions/chat/chat/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
123
123
|
ommlds/cli/sessions/chat/chat/ai/configs.py,sha256=zIth9PKJ9u68Mblctraj2HQcEuiztKGF5sPeJZ-OABw,182
|
|
124
124
|
ommlds/cli/sessions/chat/chat/ai/inject.py,sha256=hyYIL7v_aFFtOZGRKwwPqu_A0Uox1sW_m4twrz2aahI,2482
|
|
125
125
|
ommlds/cli/sessions/chat/chat/ai/injection.py,sha256=2O_ELMusxQsYaB2oqvzjYpZQzjshocJup7Z5unzoUIY,404
|
|
126
|
-
ommlds/cli/sessions/chat/chat/ai/rendering.py,sha256=
|
|
127
|
-
ommlds/cli/sessions/chat/chat/ai/services.py,sha256=
|
|
126
|
+
ommlds/cli/sessions/chat/chat/ai/rendering.py,sha256=cMSO-ibCaz_zbeumVo-IncAbTM84UeuAsRr9jaw3IxM,2275
|
|
127
|
+
ommlds/cli/sessions/chat/chat/ai/services.py,sha256=OVYwO1tsfHyHgPHfNFkd1Dn0x9cB3j-bfA30oYWf1xA,2506
|
|
128
128
|
ommlds/cli/sessions/chat/chat/ai/tools.py,sha256=en94LLM8y73N11xhQPlkSLfbzAmYVwKU-4nz2i0CK0E,1094
|
|
129
|
-
ommlds/cli/sessions/chat/chat/ai/types.py,sha256=
|
|
129
|
+
ommlds/cli/sessions/chat/chat/ai/types.py,sha256=v92Z6WiU67O2Z9wyWGHdIxGwYLeOhvFVGd_h9coT1tM,744
|
|
130
130
|
ommlds/cli/sessions/chat/chat/state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
131
131
|
ommlds/cli/sessions/chat/chat/state/configs.py,sha256=VMrqC-2dE8lXZmT1dBgUUReS0FDQWzD0U6thSyjOOZM,192
|
|
132
132
|
ommlds/cli/sessions/chat/chat/state/inject.py,sha256=PXGn3Q6wuDHEID0D7p8xh_w2H1TGQpusR-zu4MmGUsc,1107
|
|
@@ -175,7 +175,7 @@ ommlds/cli/state/storage.py,sha256=h7wcWkJaQ17nIS2GtBOk4fiu6ZyPLtmKXwVgpVN-hAg,3
|
|
|
175
175
|
ommlds/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
176
176
|
ommlds/datasets/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
177
177
|
ommlds/datasets/lib/movies.py,sha256=LmdfoXsZU9XMM_r-sxCLv_s06BFzwWO4xUj6sc9XVcI,1961
|
|
178
|
-
ommlds/minichain/__init__.py,sha256=
|
|
178
|
+
ommlds/minichain/__init__.py,sha256=5dwCPjaHhEDFOW8HIiC67eCWcOBHcsWUeKKfY5kyxAk,11410
|
|
179
179
|
ommlds/minichain/_marshal.py,sha256=n9PGWrHhvAmGIc7KDOYt3IF9Z6G0ncXskyICTp3Ji6k,1923
|
|
180
180
|
ommlds/minichain/_typedvalues.py,sha256=Vl1Edt5khC0e5RPFBPmPCxn0IzrfVd0NHzAjAN2E6Kc,2183
|
|
181
181
|
ommlds/minichain/completion.py,sha256=lQ0LfCIYZsvDqteHhhDIv16D2_gn_xMfEL0ouywE5Yo,1033
|
|
@@ -200,22 +200,22 @@ ommlds/minichain/backends/impls/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-
|
|
|
200
200
|
ommlds/minichain/backends/impls/anthropic/chat.py,sha256=-qGr_DZgGe-dr1AKb6WLtCq_I2E9635X1rQZSJqOb04,4318
|
|
201
201
|
ommlds/minichain/backends/impls/anthropic/names.py,sha256=GPPeYt0CcDcDCR8I6BMd7bMjC_Zk_bjnLLpF9ClwXcg,1099
|
|
202
202
|
ommlds/minichain/backends/impls/anthropic/protocol.py,sha256=whPVYuKShKiMCzasHl77sCIiymhzXj8mFZXEyhZvld8,3292
|
|
203
|
-
ommlds/minichain/backends/impls/anthropic/stream.py,sha256=
|
|
203
|
+
ommlds/minichain/backends/impls/anthropic/stream.py,sha256=jxKzytoYJLK9JftihGhWTcFIoXFgouQR7Yu5Q1j_ku8,8794
|
|
204
204
|
ommlds/minichain/backends/impls/duckduckgo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
205
205
|
ommlds/minichain/backends/impls/duckduckgo/search.py,sha256=igzeU9P9b1MMiu4KAJVS9H6KLIoPm68wXi4Kx3_DHyQ,940
|
|
206
206
|
ommlds/minichain/backends/impls/dummy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
207
|
-
ommlds/minichain/backends/impls/dummy/chat.py,sha256=
|
|
207
|
+
ommlds/minichain/backends/impls/dummy/chat.py,sha256=FUTvNPWmb4Hm-axglvPiqbvLwE7sajHOM5H7j9Qj2-c,2283
|
|
208
208
|
ommlds/minichain/backends/impls/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
209
209
|
ommlds/minichain/backends/impls/google/chat.py,sha256=lGb5blGLlcBlt9xeDZJvbh5SlV7fgfezd5_As_SPBXo,6499
|
|
210
210
|
ommlds/minichain/backends/impls/google/names.py,sha256=HxHJ31HeKZg6aW1C_Anqp-gamCXpq9pOdKj8_yVgE8Y,871
|
|
211
211
|
ommlds/minichain/backends/impls/google/search.py,sha256=y5_6seSRU8CFnLA_Ja8XEMbIBWSgwBzE1iBf-qyz0tA,3427
|
|
212
|
-
ommlds/minichain/backends/impls/google/stream.py,sha256=
|
|
212
|
+
ommlds/minichain/backends/impls/google/stream.py,sha256=AT8qbP0EqJUnf-D45aTbEQ0h5lvgtIK6XKki0t8RkZE,8029
|
|
213
213
|
ommlds/minichain/backends/impls/google/tools.py,sha256=Tty0gsyx7-PbeoNqMuql_ewQ6q-ZsDaDdsD5ShinGVY,5089
|
|
214
214
|
ommlds/minichain/backends/impls/groq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
215
|
ommlds/minichain/backends/impls/groq/chat.py,sha256=XXJznM6h2fBBtrY8MggMUNJf8thyFTM3p1XzFImwkAk,2743
|
|
216
216
|
ommlds/minichain/backends/impls/groq/names.py,sha256=RnvBSytxPF1a9Bj_OPVELuD1nAKJnJrG3ZwJfYo6Szs,1075
|
|
217
|
-
ommlds/minichain/backends/impls/groq/protocol.py,sha256=
|
|
218
|
-
ommlds/minichain/backends/impls/groq/stream.py,sha256=
|
|
217
|
+
ommlds/minichain/backends/impls/groq/protocol.py,sha256=FPydA4ftMhXFLEfYjmHsmNdBoM4gcEthvqmeX5yB3pc,5214
|
|
218
|
+
ommlds/minichain/backends/impls/groq/stream.py,sha256=5PZHrs_QNyKofJClKq5R5aOsq-H26UeWH7uncbJGrmI,5124
|
|
219
219
|
ommlds/minichain/backends/impls/huggingface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
220
220
|
ommlds/minichain/backends/impls/huggingface/configs.py,sha256=6jsBtPNXOP57PcpxNTVLGWLc-18Iwn_lDbGouwCJTIQ,258
|
|
221
221
|
ommlds/minichain/backends/impls/huggingface/repos.py,sha256=8BDxJmra9elSQL2vzp2nr2p4Hpq56A3zTk7hTTnfJU4,861
|
|
@@ -223,28 +223,28 @@ ommlds/minichain/backends/impls/llamacpp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
|
223
223
|
ommlds/minichain/backends/impls/llamacpp/chat.py,sha256=J6Jslx9atAtWvLdrVtvRboQUBzRX7Z5aHlo0dK5X78A,5649
|
|
224
224
|
ommlds/minichain/backends/impls/llamacpp/completion.py,sha256=oJ2I6wUoIPXYLm9Vc7dwOPgqbevatTjNBZ-jXeM24tQ,2372
|
|
225
225
|
ommlds/minichain/backends/impls/llamacpp/format.py,sha256=fcLMwk7r7FbNrYCH39G3fDRInKvlPIqcoxyLj95CooA,778
|
|
226
|
-
ommlds/minichain/backends/impls/llamacpp/stream.py,sha256=
|
|
226
|
+
ommlds/minichain/backends/impls/llamacpp/stream.py,sha256=GP3RJsjLXCW2zxvn17BqRg5jbuiNMGdHz06enfsLp2k,3575
|
|
227
227
|
ommlds/minichain/backends/impls/mlx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
228
|
-
ommlds/minichain/backends/impls/mlx/chat.py,sha256=
|
|
228
|
+
ommlds/minichain/backends/impls/mlx/chat.py,sha256=jV3bVvXx1oGaBYTbODUIpPX4k0Vmjj4SX7x3qQMluyM,7486
|
|
229
229
|
ommlds/minichain/backends/impls/ollama/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
230
|
-
ommlds/minichain/backends/impls/ollama/chat.py,sha256=
|
|
230
|
+
ommlds/minichain/backends/impls/ollama/chat.py,sha256=zBKc0CXVEuO0ntLi38gRK2S5F_FqXdHS4WJKDIaos-g,6637
|
|
231
231
|
ommlds/minichain/backends/impls/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
232
232
|
ommlds/minichain/backends/impls/openai/chat.py,sha256=G1IK94PwB16rYCkRos9JEuiAu1GgCK4CnZFOIShhpig,2856
|
|
233
233
|
ommlds/minichain/backends/impls/openai/completion.py,sha256=4Mi4Zvrq5fCqUd0asL3WiCbCdmxOdo0NFkoZMfdsYXY,1939
|
|
234
234
|
ommlds/minichain/backends/impls/openai/embedding.py,sha256=BNtvKYLTsnQwQR9Tv3Fr8zCYN1kr1UNdJ15lcsjz6X0,1765
|
|
235
|
-
ommlds/minichain/backends/impls/openai/format.py,sha256=
|
|
236
|
-
ommlds/minichain/backends/impls/openai/names.py,sha256=
|
|
237
|
-
ommlds/minichain/backends/impls/openai/stream.py,sha256=
|
|
235
|
+
ommlds/minichain/backends/impls/openai/format.py,sha256=8ZiS503H3QwOvc4_21IiS71awtaQpUv38pfNaMYIFeE,7316
|
|
236
|
+
ommlds/minichain/backends/impls/openai/names.py,sha256=PB5as6YO1ijLKXGvpyxzP9Z0_jKsOIpJnAsK5hogOKI,1516
|
|
237
|
+
ommlds/minichain/backends/impls/openai/stream.py,sha256=bsZeGUepqOl9AcN44kWk03V6q-v1ewBCfZqb_MJEfxg,5454
|
|
238
238
|
ommlds/minichain/backends/impls/sentencepiece/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
239
239
|
ommlds/minichain/backends/impls/sentencepiece/tokens.py,sha256=tUEBKyBgkTowssS_AdcAuPkyFzfyDfE935x4JG8PXM0,1602
|
|
240
240
|
ommlds/minichain/backends/impls/tinygrad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
241
|
-
ommlds/minichain/backends/impls/tinygrad/chat.py,sha256=
|
|
241
|
+
ommlds/minichain/backends/impls/tinygrad/chat.py,sha256=OBPkyY4FyUWT-KwumAPSubqXsgWeaa31mp-j-RT7crU,4944
|
|
242
242
|
ommlds/minichain/backends/impls/tokenizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
243
243
|
ommlds/minichain/backends/impls/tokenizers/tokens.py,sha256=_8Q49k5YroG5wQI0cuK6kOJ3XYwjhpaAS04ejhzBsWw,1500
|
|
244
244
|
ommlds/minichain/backends/impls/transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
245
245
|
ommlds/minichain/backends/impls/transformers/sentence.py,sha256=1bFJ-ND3MOkj7mNsPuISrQCpqTs7npmmNmYcc2go-Fk,1393
|
|
246
246
|
ommlds/minichain/backends/impls/transformers/tokens.py,sha256=uS3-IWOJRUMBfPDVRrp3SCaXdE1yzEdKHQcyv0JZQIw,2089
|
|
247
|
-
ommlds/minichain/backends/impls/transformers/transformers.py,sha256=
|
|
247
|
+
ommlds/minichain/backends/impls/transformers/transformers.py,sha256=irBOBBQlZyv2M63YIW01VJvXXzZwn30ddRbONIKDd44,9081
|
|
248
248
|
ommlds/minichain/backends/strings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
249
249
|
ommlds/minichain/backends/strings/manifests.py,sha256=kmlanVUAZqIh0P95Mm8H20e8ib3gEgYHHUlkCXDQGFk,413
|
|
250
250
|
ommlds/minichain/backends/strings/parsing.py,sha256=Etmk04BnKvCMtGg4AgbvxsPGvfRcLldLxpdpxcozdNk,1779
|
|
@@ -262,12 +262,16 @@ ommlds/minichain/chat/choices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
262
262
|
ommlds/minichain/chat/choices/adapters.py,sha256=Keroaj0B5YEYPF3k0fOQK6JUZnM1XVFThGB5Uv689Sc,629
|
|
263
263
|
ommlds/minichain/chat/choices/services.py,sha256=p_FsCZEsGJun8epzAHoeNdjwJ86ZwihIhvFMsfdafeA,1041
|
|
264
264
|
ommlds/minichain/chat/choices/types.py,sha256=OPnMUp0KUKGGPJKsQZiXUtd8Z9b_JnhOy7SXKL6QDWU,725
|
|
265
|
+
ommlds/minichain/chat/choices/stream/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
266
|
+
ommlds/minichain/chat/choices/stream/adapters.py,sha256=f3QCjJ1fDzDzLB-tKmxG-tr15lFMCbiLjjF3g2ew5XA,1048
|
|
267
|
+
ommlds/minichain/chat/choices/stream/joining.py,sha256=9L40pXj6wL3KVrOdCd4Jhj3DyltvM-Z7xkLUnrzDioE,757
|
|
268
|
+
ommlds/minichain/chat/choices/stream/services.py,sha256=9Jc6Hf9Iphepzksll29Skv7IlnawJIutQTitPJPoAD0,1249
|
|
269
|
+
ommlds/minichain/chat/choices/stream/types.py,sha256=V1QTk1XDcPyfpOpYuDH-cj6swhr4-urpUH9eFGZNfjY,808
|
|
265
270
|
ommlds/minichain/chat/stream/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
266
|
-
ommlds/minichain/chat/stream/_marshal.py,sha256=
|
|
267
|
-
ommlds/minichain/chat/stream/
|
|
268
|
-
ommlds/minichain/chat/stream/
|
|
269
|
-
ommlds/minichain/chat/stream/
|
|
270
|
-
ommlds/minichain/chat/stream/types.py,sha256=kpHsWLNHk7hmaNPDSCqLH-ECSAiz83lRfr00LhSWb5U,1589
|
|
271
|
+
ommlds/minichain/chat/stream/_marshal.py,sha256=eUdDrjPKYKwgaNrntZsuquB121pcDcW9lyNRy8bqVsw,382
|
|
272
|
+
ommlds/minichain/chat/stream/joining.py,sha256=U-z1MJTIuw0LIJCUQ80RcGROpPgbqG6FHVjuTe7j57s,2416
|
|
273
|
+
ommlds/minichain/chat/stream/services.py,sha256=Ikaf8fofoPW6UM3MajAGgdc0U6VU8jhn0F6r-FX5XFc,1102
|
|
274
|
+
ommlds/minichain/chat/stream/types.py,sha256=l_fQZr2uD-RugYqCH4KbCh6XksDJHu_mfDWtFT6IRFI,1308
|
|
271
275
|
ommlds/minichain/chat/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
272
276
|
ommlds/minichain/chat/tools/execution.py,sha256=tCPsz1kCt5RcoRX7dwfaJRvObniJJv_D2hCwz1Slo_A,573
|
|
273
277
|
ommlds/minichain/chat/tools/ids.py,sha256=DFBKrpeDTCnMcU-P38VbPWX0YBDaz_HzMgx3yXWjFWQ,759
|
|
@@ -408,9 +412,9 @@ ommlds/wiki/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
408
412
|
ommlds/wiki/utils/io.py,sha256=UKgDJGtmpnWvIqVd2mJc2QNPOqlToEY1GEveNp6_pMo,7088
|
|
409
413
|
ommlds/wiki/utils/progress.py,sha256=EhvKcMFYtsarCQhIahlO6f0SboyAKP3UwUyrnVnP-Vk,3222
|
|
410
414
|
ommlds/wiki/utils/xml.py,sha256=sNJNkZ9rT8B-kJMO6bRz8J1USy4fyPx0m2PwTX7vxYY,3846
|
|
411
|
-
ommlds-0.0.0.
|
|
412
|
-
ommlds-0.0.0.
|
|
413
|
-
ommlds-0.0.0.
|
|
414
|
-
ommlds-0.0.0.
|
|
415
|
-
ommlds-0.0.0.
|
|
416
|
-
ommlds-0.0.0.
|
|
415
|
+
ommlds-0.0.0.dev478.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
416
|
+
ommlds-0.0.0.dev478.dist-info/METADATA,sha256=kcPQ2Vtr6j4U1g9E1aDz55WNNf6elCtv2ym4nLlp5FI,3344
|
|
417
|
+
ommlds-0.0.0.dev478.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
418
|
+
ommlds-0.0.0.dev478.dist-info/entry_points.txt,sha256=Z5YWtX7ClfiCKdW-dd_CSVvM0h4yQpJPi-2G3q6gNFo,35
|
|
419
|
+
ommlds-0.0.0.dev478.dist-info/top_level.txt,sha256=Rbnk5d5wi58vnAXx13WFZqdQ4VX8hBCS2hEL3WeXOhY,7
|
|
420
|
+
ommlds-0.0.0.dev478.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|