ommlds 0.0.0.dev450__py3-none-any.whl → 0.0.0.dev452__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/.omlish-manifests.json +12 -12
- ommlds/backends/anthropic/protocol/_marshal.py +2 -2
- ommlds/backends/anthropic/protocol/sse/_marshal.py +1 -1
- ommlds/backends/anthropic/protocol/sse/assemble.py +1 -1
- ommlds/backends/anthropic/protocol/types.py +30 -9
- ommlds/backends/google/protocol/_marshal.py +1 -1
- ommlds/backends/openai/protocol/_common.py +18 -0
- ommlds/backends/openai/protocol/_marshal.py +3 -2
- ommlds/backends/openai/protocol/chatcompletion/chunk.py +4 -0
- ommlds/backends/openai/protocol/chatcompletion/contentpart.py +15 -7
- ommlds/backends/openai/protocol/chatcompletion/message.py +10 -0
- ommlds/backends/openai/protocol/chatcompletion/request.py +25 -7
- ommlds/backends/openai/protocol/chatcompletion/response.py +10 -0
- ommlds/backends/openai/protocol/chatcompletion/responseformat.py +6 -0
- ommlds/backends/openai/protocol/chatcompletion/tokenlogprob.py +4 -0
- ommlds/backends/openai/protocol/completionusage.py +5 -0
- ommlds/cli/main.py +2 -2
- ommlds/cli/sessions/chat/code.py +34 -19
- ommlds/cli/sessions/chat/inject.py +4 -4
- ommlds/cli/sessions/chat/interactive.py +2 -1
- ommlds/cli/sessions/chat/printing.py +6 -2
- ommlds/cli/sessions/chat/prompt.py +28 -27
- ommlds/cli/sessions/chat/tools.py +13 -14
- ommlds/cli/tools/config.py +1 -1
- ommlds/cli/tools/inject.py +4 -1
- ommlds/minichain/__init__.py +32 -8
- ommlds/minichain/_marshal.py +39 -0
- ommlds/minichain/backends/impls/anthropic/chat.py +82 -10
- ommlds/minichain/backends/impls/anthropic/names.py +3 -3
- ommlds/minichain/backends/impls/anthropic/stream.py +7 -7
- ommlds/minichain/backends/impls/google/chat.py +48 -22
- ommlds/minichain/backends/impls/google/stream.py +8 -4
- ommlds/minichain/backends/impls/llamacpp/chat.py +23 -17
- ommlds/minichain/backends/impls/llamacpp/format.py +4 -2
- ommlds/minichain/backends/impls/llamacpp/stream.py +6 -6
- ommlds/minichain/backends/impls/mistral.py +1 -1
- ommlds/minichain/backends/impls/mlx/chat.py +1 -1
- ommlds/minichain/backends/impls/openai/chat.py +6 -3
- ommlds/minichain/backends/impls/openai/format.py +80 -61
- ommlds/minichain/backends/impls/openai/format2.py +210 -0
- ommlds/minichain/backends/impls/openai/stream.py +9 -6
- ommlds/minichain/backends/impls/tinygrad/chat.py +10 -5
- ommlds/minichain/backends/impls/transformers/transformers.py +20 -16
- ommlds/minichain/chat/_marshal.py +16 -9
- ommlds/minichain/chat/choices/adapters.py +3 -3
- ommlds/minichain/chat/choices/types.py +2 -2
- ommlds/minichain/chat/history.py +1 -1
- ommlds/minichain/chat/messages.py +55 -19
- ommlds/minichain/chat/services.py +2 -2
- ommlds/minichain/chat/stream/_marshal.py +16 -0
- ommlds/minichain/chat/stream/adapters.py +39 -28
- ommlds/minichain/chat/stream/services.py +2 -2
- ommlds/minichain/chat/stream/types.py +20 -13
- ommlds/minichain/chat/tools/execution.py +8 -7
- ommlds/minichain/chat/tools/ids.py +9 -15
- ommlds/minichain/chat/tools/parsing.py +17 -26
- ommlds/minichain/chat/transforms/base.py +29 -38
- ommlds/minichain/chat/transforms/metadata.py +30 -4
- ommlds/minichain/chat/transforms/services.py +5 -7
- ommlds/minichain/content/_marshal.py +24 -3
- ommlds/minichain/content/json.py +13 -0
- ommlds/minichain/content/materialize.py +13 -20
- ommlds/minichain/content/prepare.py +4 -0
- ommlds/minichain/json.py +20 -0
- ommlds/minichain/lib/fs/context.py +15 -1
- ommlds/minichain/lib/fs/errors.py +6 -0
- ommlds/minichain/lib/fs/tools/edit.py +104 -0
- ommlds/minichain/lib/fs/tools/ls.py +2 -2
- ommlds/minichain/lib/fs/tools/read.py +2 -2
- ommlds/minichain/lib/fs/tools/recursivels/execution.py +2 -2
- ommlds/minichain/lib/todo/context.py +29 -2
- ommlds/minichain/lib/todo/tools/read.py +11 -6
- ommlds/minichain/lib/todo/tools/write.py +73 -13
- ommlds/minichain/lib/todo/types.py +6 -1
- ommlds/minichain/llms/_marshal.py +1 -1
- ommlds/minichain/services/_marshal.py +1 -1
- ommlds/minichain/tools/_marshal.py +1 -1
- ommlds/minichain/tools/execution/catalog.py +2 -1
- ommlds/minichain/tools/execution/executors.py +8 -3
- ommlds/minichain/tools/execution/reflect.py +43 -5
- ommlds/minichain/tools/fns.py +46 -9
- ommlds/minichain/tools/jsonschema.py +5 -6
- ommlds/minichain/tools/reflect.py +2 -2
- ommlds/minichain/tools/types.py +24 -1
- ommlds/minichain/vectors/_marshal.py +1 -1
- ommlds/server/server.py +1 -1
- ommlds/tools/git.py +18 -2
- ommlds/tools/ocr.py +7 -1
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/METADATA +3 -3
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/RECORD +94 -89
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev450.dist-info → ommlds-0.0.0.dev452.dist-info}/top_level.txt +0 -0
ommlds/.omlish-manifests.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": ".minichain.backends.impls.anthropic.chat",
|
|
19
19
|
"attr": null,
|
|
20
20
|
"file": "ommlds/minichain/backends/impls/anthropic/chat.py",
|
|
21
|
-
"line":
|
|
21
|
+
"line": 39,
|
|
22
22
|
"value": {
|
|
23
23
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
24
24
|
"module": "ommlds.minichain.backends.impls.anthropic.chat",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"claude-opus-4-1-20250805": null,
|
|
48
48
|
"claude-opus-4-1": "claude-opus-4-1-20250805",
|
|
49
49
|
"claude-opus": "claude-opus-4-1",
|
|
50
|
-
"claude-sonnet-4-
|
|
51
|
-
"claude-sonnet-4": "claude-sonnet-4-
|
|
52
|
-
"claude-sonnet": "claude-sonnet-4",
|
|
50
|
+
"claude-sonnet-4-5-20250929": null,
|
|
51
|
+
"claude-sonnet-4-5": "claude-sonnet-4-5-20250929",
|
|
52
|
+
"claude-sonnet": "claude-sonnet-4-5",
|
|
53
53
|
"claude-3-5-haiku-latest": null,
|
|
54
54
|
"claude-haiku-3-5-latest": "claude-3-5-haiku-latest",
|
|
55
55
|
"claude-haiku-3-5": "claude-haiku-3-5-latest",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"module": ".minichain.backends.impls.google.chat",
|
|
97
97
|
"attr": null,
|
|
98
98
|
"file": "ommlds/minichain/backends/impls/google/chat.py",
|
|
99
|
-
"line":
|
|
99
|
+
"line": 35,
|
|
100
100
|
"value": {
|
|
101
101
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
102
102
|
"module": "ommlds.minichain.backends.impls.google.chat",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"module": ".minichain.backends.impls.llamacpp.chat",
|
|
171
171
|
"attr": null,
|
|
172
172
|
"file": "ommlds/minichain/backends/impls/llamacpp/chat.py",
|
|
173
|
-
"line":
|
|
173
|
+
"line": 33,
|
|
174
174
|
"value": {
|
|
175
175
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
176
176
|
"module": "ommlds.minichain.backends.impls.llamacpp.chat",
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"module": ".minichain.backends.impls.openai.chat",
|
|
261
261
|
"attr": null,
|
|
262
262
|
"file": "ommlds/minichain/backends/impls/openai/chat.py",
|
|
263
|
-
"line":
|
|
263
|
+
"line": 37,
|
|
264
264
|
"value": {
|
|
265
265
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
266
266
|
"module": "ommlds.minichain.backends.impls.openai.chat",
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
"module": ".minichain.backends.impls.tinygrad.chat",
|
|
403
403
|
"attr": null,
|
|
404
404
|
"file": "ommlds/minichain/backends/impls/tinygrad/chat.py",
|
|
405
|
-
"line":
|
|
405
|
+
"line": 166,
|
|
406
406
|
"value": {
|
|
407
407
|
"!.minichain.backends.strings.manifests.BackendStringsManifest": {
|
|
408
408
|
"service_cls_names": [
|
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
"module": ".minichain.backends.impls.transformers.transformers",
|
|
436
436
|
"attr": null,
|
|
437
437
|
"file": "ommlds/minichain/backends/impls/transformers/transformers.py",
|
|
438
|
-
"line":
|
|
438
|
+
"line": 43,
|
|
439
439
|
"value": {
|
|
440
440
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
441
441
|
"module": "ommlds.minichain.backends.impls.transformers.transformers",
|
|
@@ -452,7 +452,7 @@
|
|
|
452
452
|
"module": ".minichain.backends.impls.transformers.transformers",
|
|
453
453
|
"attr": null,
|
|
454
454
|
"file": "ommlds/minichain/backends/impls/transformers/transformers.py",
|
|
455
|
-
"line":
|
|
455
|
+
"line": 131,
|
|
456
456
|
"value": {
|
|
457
457
|
"!.minichain.registries.manifests.RegistryManifest": {
|
|
458
458
|
"module": "ommlds.minichain.backends.impls.transformers.transformers",
|
|
@@ -592,7 +592,7 @@
|
|
|
592
592
|
"module": ".tools.git",
|
|
593
593
|
"attr": null,
|
|
594
594
|
"file": "ommlds/tools/git.py",
|
|
595
|
-
"line":
|
|
595
|
+
"line": 188,
|
|
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":
|
|
609
|
+
"line": 89,
|
|
610
610
|
"value": {
|
|
611
611
|
"!omdev.cli.types.CliModule": {
|
|
612
612
|
"name": "ocr",
|
|
@@ -8,7 +8,7 @@ from .types import Content
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@lang.static_init
|
|
11
|
-
def
|
|
11
|
+
def _install_standard_marshaling() -> None:
|
|
12
12
|
for root_cls in [
|
|
13
13
|
Content,
|
|
14
14
|
Content.CacheControl,
|
|
@@ -17,7 +17,7 @@ def _install_standard_marshalling() -> None:
|
|
|
17
17
|
msh.polymorphism_from_subclasses(
|
|
18
18
|
root_cls,
|
|
19
19
|
naming=msh.Naming.SNAKE,
|
|
20
|
-
strip_suffix=
|
|
20
|
+
strip_suffix=msh.AutoStripSuffix,
|
|
21
21
|
),
|
|
22
22
|
msh.FieldTypeTagging('type'),
|
|
23
23
|
))
|
|
@@ -8,7 +8,7 @@ from .events import AnthropicSseDecoderEvents
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@lang.static_init
|
|
11
|
-
def
|
|
11
|
+
def _install_standard_marshaling() -> None:
|
|
12
12
|
for root_cls in [
|
|
13
13
|
AnthropicSseDecoderEvents.Event,
|
|
14
14
|
AnthropicSseDecoderEvents.ContentBlockStart.ContentBlock,
|
|
@@ -76,7 +76,7 @@ class AnthropicSseMessageAssembler(
|
|
|
76
76
|
elif isinstance(ae, AnthropicSseDecoderEvents.MessageStop):
|
|
77
77
|
yield [Message(
|
|
78
78
|
id=ms.message.id,
|
|
79
|
-
role=ms.message.role,
|
|
79
|
+
role=ms.message.role, # type: ignore[arg-type]
|
|
80
80
|
model=ms.message.model,
|
|
81
81
|
content=content,
|
|
82
82
|
stop_reason=dct['stop_reason'],
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"""
|
|
2
|
+
https://docs.claude.com/en/api/messages
|
|
3
|
+
"""
|
|
1
4
|
import typing as ta
|
|
2
5
|
|
|
3
6
|
from omlish import dataclasses as dc
|
|
@@ -8,6 +11,22 @@ from omlish import marshal as msh
|
|
|
8
11
|
##
|
|
9
12
|
|
|
10
13
|
|
|
14
|
+
def _set_class_marshal_options(cls):
|
|
15
|
+
msh.update_object_metadata(
|
|
16
|
+
cls,
|
|
17
|
+
field_defaults=msh.FieldMetadata(
|
|
18
|
+
options=msh.FieldOptions(
|
|
19
|
+
omit_if=lang.is_none,
|
|
20
|
+
),
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return cls
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
|
|
29
|
+
|
|
11
30
|
class Content(lang.Abstract, lang.Sealed):
|
|
12
31
|
class CacheControl(lang.Abstract, lang.Sealed):
|
|
13
32
|
"""https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching"""
|
|
@@ -18,7 +37,7 @@ class Content(lang.Abstract, lang.Sealed):
|
|
|
18
37
|
|
|
19
38
|
|
|
20
39
|
@dc.dataclass(frozen=True)
|
|
21
|
-
@
|
|
40
|
+
@_set_class_marshal_options
|
|
22
41
|
class Text(Content):
|
|
23
42
|
text: str
|
|
24
43
|
|
|
@@ -28,7 +47,7 @@ class Text(Content):
|
|
|
28
47
|
|
|
29
48
|
|
|
30
49
|
@dc.dataclass(frozen=True)
|
|
31
|
-
@
|
|
50
|
+
@_set_class_marshal_options
|
|
32
51
|
class ToolUse(Content):
|
|
33
52
|
id: str
|
|
34
53
|
name: str
|
|
@@ -40,6 +59,7 @@ class ToolUse(Content):
|
|
|
40
59
|
|
|
41
60
|
|
|
42
61
|
@dc.dataclass(frozen=True)
|
|
62
|
+
@_set_class_marshal_options
|
|
43
63
|
class ToolResult(Content):
|
|
44
64
|
tool_use_id: str
|
|
45
65
|
content: str
|
|
@@ -49,7 +69,7 @@ class ToolResult(Content):
|
|
|
49
69
|
|
|
50
70
|
|
|
51
71
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
52
|
-
@
|
|
72
|
+
@_set_class_marshal_options
|
|
53
73
|
class CacheCreation:
|
|
54
74
|
ephemeral_5m_input_tokens: int | None = None
|
|
55
75
|
ephemeral_1h_input_tokens: int | None = None
|
|
@@ -59,7 +79,7 @@ class CacheCreation:
|
|
|
59
79
|
|
|
60
80
|
|
|
61
81
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
62
|
-
@
|
|
82
|
+
@_set_class_marshal_options
|
|
63
83
|
class Usage:
|
|
64
84
|
input_tokens: int | None = None
|
|
65
85
|
output_tokens: int | None = None
|
|
@@ -75,15 +95,15 @@ class Usage:
|
|
|
75
95
|
|
|
76
96
|
|
|
77
97
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
78
|
-
@
|
|
98
|
+
@_set_class_marshal_options
|
|
79
99
|
class Message:
|
|
80
100
|
id: str | None = None
|
|
81
101
|
|
|
82
|
-
role:
|
|
102
|
+
role: ta.Literal['user', 'assistant']
|
|
83
103
|
|
|
84
104
|
model: str | None = None
|
|
85
105
|
|
|
86
|
-
content: ta.Sequence[Content] | None = None
|
|
106
|
+
content: str | ta.Sequence[Content] | None = None
|
|
87
107
|
|
|
88
108
|
stop_reason: str | None = None
|
|
89
109
|
stop_sequence: str | None = None
|
|
@@ -95,6 +115,7 @@ class Message:
|
|
|
95
115
|
|
|
96
116
|
|
|
97
117
|
@dc.dataclass(frozen=True)
|
|
118
|
+
@_set_class_marshal_options
|
|
98
119
|
class ToolSpec:
|
|
99
120
|
name: str
|
|
100
121
|
description: str
|
|
@@ -105,7 +126,7 @@ class ToolSpec:
|
|
|
105
126
|
|
|
106
127
|
|
|
107
128
|
@dc.dataclass(frozen=True)
|
|
108
|
-
@
|
|
129
|
+
@_set_class_marshal_options
|
|
109
130
|
class MessagesRequest:
|
|
110
131
|
model: str
|
|
111
132
|
|
|
@@ -113,7 +134,7 @@ class MessagesRequest:
|
|
|
113
134
|
|
|
114
135
|
_: dc.KW_ONLY
|
|
115
136
|
|
|
116
|
-
system: ta.Sequence[Content] | None = None
|
|
137
|
+
system: str | ta.Sequence[Content] | None = None
|
|
117
138
|
|
|
118
139
|
tools: ta.Sequence[ToolSpec] | None = None
|
|
119
140
|
|
|
@@ -8,7 +8,7 @@ from .types import Value
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@lang.static_init
|
|
11
|
-
def
|
|
11
|
+
def _install_standard_marshaling() -> None:
|
|
12
12
|
msh.install_standard_factories(
|
|
13
13
|
*msh.standard_polymorphism_factories(
|
|
14
14
|
msh.polymorphism_from_subclasses(Value),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from omlish import lang
|
|
2
|
+
from omlish import marshal as msh
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _set_class_marshal_options(cls):
|
|
9
|
+
msh.update_object_metadata(
|
|
10
|
+
cls,
|
|
11
|
+
field_defaults=msh.FieldMetadata(
|
|
12
|
+
options=msh.FieldOptions(
|
|
13
|
+
omit_if=lang.is_none,
|
|
14
|
+
),
|
|
15
|
+
),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
return cls
|
|
@@ -10,7 +10,7 @@ from .chatcompletion.responseformat import ChatCompletionResponseFormat
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@lang.static_init
|
|
13
|
-
def
|
|
13
|
+
def _install_standard_marshaling() -> None:
|
|
14
14
|
for root_cls, tag_field in [
|
|
15
15
|
(ChatCompletionContentPart, 'type'),
|
|
16
16
|
(ChatCompletionMessage, 'role'),
|
|
@@ -20,7 +20,8 @@ def _install_standard_marshalling() -> None:
|
|
|
20
20
|
msh.polymorphism_from_subclasses(
|
|
21
21
|
root_cls,
|
|
22
22
|
naming=msh.Naming.SNAKE,
|
|
23
|
-
strip_suffix=
|
|
23
|
+
strip_suffix=msh.AutoStripSuffix,
|
|
24
24
|
),
|
|
25
25
|
msh.FieldTypeTagging(tag_field),
|
|
26
|
+
unions='partial',
|
|
26
27
|
))
|
|
@@ -3,6 +3,7 @@ import typing as ta
|
|
|
3
3
|
from omlish import dataclasses as dc
|
|
4
4
|
from omlish import lang
|
|
5
5
|
|
|
6
|
+
from .._common import _set_class_marshal_options
|
|
6
7
|
from ..completionusage import CompletionUsage
|
|
7
8
|
from .tokenlogprob import ChatCompletionTokenLogprob
|
|
8
9
|
|
|
@@ -11,6 +12,7 @@ from .tokenlogprob import ChatCompletionTokenLogprob
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
15
|
+
@_set_class_marshal_options
|
|
14
16
|
class ChatCompletionChunkChoiceDelta(lang.Final):
|
|
15
17
|
content: str | None = None
|
|
16
18
|
|
|
@@ -46,6 +48,7 @@ class ChatCompletionChunkChoiceDelta(lang.Final):
|
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
51
|
+
@_set_class_marshal_options
|
|
49
52
|
class ChatCompletionChunkChoice(lang.Final):
|
|
50
53
|
delta: ChatCompletionChunkChoiceDelta
|
|
51
54
|
|
|
@@ -70,6 +73,7 @@ class ChatCompletionChunkChoice(lang.Final):
|
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
76
|
+
@_set_class_marshal_options
|
|
73
77
|
class ChatCompletionChunk(lang.Final):
|
|
74
78
|
id: str
|
|
75
79
|
|
|
@@ -3,6 +3,8 @@ import typing as ta
|
|
|
3
3
|
from omlish import dataclasses as dc
|
|
4
4
|
from omlish import lang
|
|
5
5
|
|
|
6
|
+
from .._common import _set_class_marshal_options
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
##
|
|
8
10
|
|
|
@@ -14,7 +16,8 @@ class ChatCompletionContentPart(lang.Abstract):
|
|
|
14
16
|
#
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
@dc.dataclass(frozen=True
|
|
19
|
+
@dc.dataclass(frozen=True)
|
|
20
|
+
@_set_class_marshal_options
|
|
18
21
|
class TextChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
19
22
|
text: str
|
|
20
23
|
|
|
@@ -22,9 +25,10 @@ class TextChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
|
22
25
|
#
|
|
23
26
|
|
|
24
27
|
|
|
25
|
-
@dc.dataclass(frozen=True
|
|
28
|
+
@dc.dataclass(frozen=True)
|
|
29
|
+
@_set_class_marshal_options
|
|
26
30
|
class ImageUrlChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
27
|
-
@dc.dataclass(frozen=True
|
|
31
|
+
@dc.dataclass(frozen=True)
|
|
28
32
|
class ImageUrl(lang.Final):
|
|
29
33
|
url: str
|
|
30
34
|
detail: ta.Literal[
|
|
@@ -39,7 +43,8 @@ class ImageUrlChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
|
39
43
|
#
|
|
40
44
|
|
|
41
45
|
|
|
42
|
-
@dc.dataclass(frozen=True
|
|
46
|
+
@dc.dataclass(frozen=True)
|
|
47
|
+
@_set_class_marshal_options
|
|
43
48
|
class FileChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
44
49
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
45
50
|
class File(lang.Final):
|
|
@@ -53,9 +58,11 @@ class FileChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
|
53
58
|
#
|
|
54
59
|
|
|
55
60
|
|
|
56
|
-
@dc.dataclass(frozen=True
|
|
61
|
+
@dc.dataclass(frozen=True)
|
|
62
|
+
@_set_class_marshal_options
|
|
57
63
|
class InputAudioChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
58
|
-
@dc.dataclass(frozen=True
|
|
64
|
+
@dc.dataclass(frozen=True)
|
|
65
|
+
@_set_class_marshal_options
|
|
59
66
|
class InputAudio(lang.Final):
|
|
60
67
|
data: str
|
|
61
68
|
format: ta.Literal[
|
|
@@ -69,6 +76,7 @@ class InputAudioChatCompletionContentPart(ChatCompletionContentPart, lang.Final)
|
|
|
69
76
|
#
|
|
70
77
|
|
|
71
78
|
|
|
72
|
-
@dc.dataclass(frozen=True
|
|
79
|
+
@dc.dataclass(frozen=True)
|
|
80
|
+
@_set_class_marshal_options
|
|
73
81
|
class RefusalChatCompletionContentPart(ChatCompletionContentPart, lang.Final):
|
|
74
82
|
refusal: str
|
|
@@ -3,6 +3,7 @@ import typing as ta
|
|
|
3
3
|
from omlish import dataclasses as dc
|
|
4
4
|
from omlish import lang
|
|
5
5
|
|
|
6
|
+
from .._common import _set_class_marshal_options
|
|
6
7
|
from .contentpart import ChatCompletionContentPart
|
|
7
8
|
from .contentpart import RefusalChatCompletionContentPart
|
|
8
9
|
from .contentpart import TextChatCompletionContentPart
|
|
@@ -19,6 +20,7 @@ class ChatCompletionMessage(lang.Abstract, lang.Sealed):
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
23
|
+
@_set_class_marshal_options
|
|
22
24
|
class DeveloperChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
23
25
|
content: str | ta.Iterable[TextChatCompletionContentPart]
|
|
24
26
|
name: str | None = None
|
|
@@ -28,6 +30,7 @@ class DeveloperChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
33
|
+
@_set_class_marshal_options
|
|
31
34
|
class SystemChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
32
35
|
content: str | ta.Iterable[TextChatCompletionContentPart]
|
|
33
36
|
name: str | None = None
|
|
@@ -37,6 +40,7 @@ class SystemChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
43
|
+
@_set_class_marshal_options
|
|
40
44
|
class UserChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
41
45
|
content: str | ta.Iterable[ChatCompletionContentPart]
|
|
42
46
|
name: str | None = None
|
|
@@ -46,8 +50,10 @@ class UserChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
53
|
+
@_set_class_marshal_options
|
|
49
54
|
class AssistantChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
50
55
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
56
|
+
@_set_class_marshal_options
|
|
51
57
|
class Audio(lang.Final):
|
|
52
58
|
id: str
|
|
53
59
|
|
|
@@ -60,10 +66,12 @@ class AssistantChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
60
66
|
refusal: str | None = None
|
|
61
67
|
|
|
62
68
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
69
|
+
@_set_class_marshal_options
|
|
63
70
|
class ToolCall(lang.Final):
|
|
64
71
|
id: str
|
|
65
72
|
|
|
66
73
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
74
|
+
@_set_class_marshal_options
|
|
67
75
|
class Function(lang.Final):
|
|
68
76
|
arguments: str
|
|
69
77
|
name: str
|
|
@@ -79,6 +87,7 @@ class AssistantChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
79
87
|
|
|
80
88
|
|
|
81
89
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
90
|
+
@_set_class_marshal_options
|
|
82
91
|
class ToolChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
83
92
|
content: str | ta.Iterable[TextChatCompletionContentPart]
|
|
84
93
|
tool_call_id: str
|
|
@@ -88,6 +97,7 @@ class ToolChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
|
88
97
|
|
|
89
98
|
|
|
90
99
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
100
|
+
@_set_class_marshal_options
|
|
91
101
|
class FunctionChatCompletionMessage(ChatCompletionMessage, lang.Final):
|
|
92
102
|
content: str | None
|
|
93
103
|
name: str
|
|
@@ -4,6 +4,7 @@ import typing as ta
|
|
|
4
4
|
from omlish import dataclasses as dc
|
|
5
5
|
from omlish import lang
|
|
6
6
|
|
|
7
|
+
from .._common import _set_class_marshal_options
|
|
7
8
|
from .contentpart import TextChatCompletionContentPart
|
|
8
9
|
from .message import ChatCompletionMessage
|
|
9
10
|
from .responseformat import ChatCompletionResponseFormat
|
|
@@ -13,6 +14,7 @@ from .responseformat import ChatCompletionResponseFormat
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
17
|
+
@_set_class_marshal_options
|
|
16
18
|
class ChatCompletionRequestWebSearchOptions(lang.Final):
|
|
17
19
|
search_context_size: ta.Literal[
|
|
18
20
|
'low',
|
|
@@ -21,8 +23,10 @@ class ChatCompletionRequestWebSearchOptions(lang.Final):
|
|
|
21
23
|
] | None = None
|
|
22
24
|
|
|
23
25
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
26
|
+
@_set_class_marshal_options
|
|
24
27
|
class UserLocation(lang.Final):
|
|
25
28
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
29
|
+
@_set_class_marshal_options
|
|
26
30
|
class Approximate(lang.Final):
|
|
27
31
|
city: str | None = None
|
|
28
32
|
country: str | None = None
|
|
@@ -30,7 +34,8 @@ class ChatCompletionRequestWebSearchOptions(lang.Final):
|
|
|
30
34
|
timezone: str | None = None
|
|
31
35
|
|
|
32
36
|
approximate: Approximate
|
|
33
|
-
|
|
37
|
+
|
|
38
|
+
type: ta.Literal['approximate'] = dc.xfield('approximate', repr=False, kw_only=True)
|
|
34
39
|
|
|
35
40
|
user_location: UserLocation | None = None
|
|
36
41
|
|
|
@@ -39,17 +44,21 @@ class ChatCompletionRequestWebSearchOptions(lang.Final):
|
|
|
39
44
|
|
|
40
45
|
|
|
41
46
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
47
|
+
@_set_class_marshal_options
|
|
42
48
|
class ChatCompletionRequestPrediction(lang.Final):
|
|
43
49
|
content: str | ta.Iterable[TextChatCompletionContentPart]
|
|
44
|
-
|
|
50
|
+
|
|
51
|
+
type: ta.Literal['content'] = dc.xfield('content', repr=False, kw_only=True)
|
|
45
52
|
|
|
46
53
|
|
|
47
54
|
#
|
|
48
55
|
|
|
49
56
|
|
|
50
|
-
@dc.dataclass(frozen=True
|
|
57
|
+
@dc.dataclass(frozen=True)
|
|
58
|
+
@_set_class_marshal_options
|
|
51
59
|
class ChatCompletionRequestTool(lang.Final):
|
|
52
60
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
61
|
+
@_set_class_marshal_options
|
|
53
62
|
class Function(lang.Final):
|
|
54
63
|
name: str
|
|
55
64
|
description: str | None = None
|
|
@@ -57,26 +66,31 @@ class ChatCompletionRequestTool(lang.Final):
|
|
|
57
66
|
strict: bool | None = None
|
|
58
67
|
|
|
59
68
|
function: Function
|
|
60
|
-
|
|
69
|
+
|
|
70
|
+
type: ta.Literal['function'] = dc.xfield('function', repr=False, kw_only=True)
|
|
61
71
|
|
|
62
72
|
|
|
63
73
|
#
|
|
64
74
|
|
|
65
75
|
|
|
66
|
-
@dc.dataclass(frozen=True
|
|
76
|
+
@dc.dataclass(frozen=True)
|
|
77
|
+
@_set_class_marshal_options
|
|
67
78
|
class ChatCompletionRequestNamedToolChoice(lang.Final):
|
|
68
|
-
@dc.dataclass(frozen=True
|
|
79
|
+
@dc.dataclass(frozen=True)
|
|
80
|
+
@_set_class_marshal_options
|
|
69
81
|
class Function(lang.Final):
|
|
70
82
|
name: str
|
|
71
83
|
|
|
72
84
|
function: Function
|
|
73
|
-
|
|
85
|
+
|
|
86
|
+
type: ta.Literal['function'] = dc.xfield('function', repr=False, kw_only=True)
|
|
74
87
|
|
|
75
88
|
|
|
76
89
|
#
|
|
77
90
|
|
|
78
91
|
|
|
79
92
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
93
|
+
@_set_class_marshal_options
|
|
80
94
|
class ChatCompletionRequestAudio(lang.Final):
|
|
81
95
|
format: ta.Literal[
|
|
82
96
|
'wav',
|
|
@@ -94,6 +108,7 @@ class ChatCompletionRequestAudio(lang.Final):
|
|
|
94
108
|
|
|
95
109
|
|
|
96
110
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
111
|
+
@_set_class_marshal_options
|
|
97
112
|
class ChatCompletionRequest(lang.Final):
|
|
98
113
|
messages: ta.Iterable[ChatCompletionMessage]
|
|
99
114
|
|
|
@@ -143,7 +158,10 @@ class ChatCompletionRequest(lang.Final):
|
|
|
143
158
|
|
|
144
159
|
store: bool | None = None
|
|
145
160
|
|
|
161
|
+
stream: bool | None = None
|
|
162
|
+
|
|
146
163
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
164
|
+
@_set_class_marshal_options
|
|
147
165
|
class StreamOptions(lang.Final):
|
|
148
166
|
include_usage: bool | None = None
|
|
149
167
|
|
|
@@ -3,6 +3,7 @@ import typing as ta
|
|
|
3
3
|
from omlish import dataclasses as dc
|
|
4
4
|
from omlish import lang
|
|
5
5
|
|
|
6
|
+
from .._common import _set_class_marshal_options
|
|
6
7
|
from ..completionusage import CompletionUsage
|
|
7
8
|
from .tokenlogprob import ChatCompletionTokenLogprob
|
|
8
9
|
|
|
@@ -11,16 +12,19 @@ from .tokenlogprob import ChatCompletionTokenLogprob
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
15
|
+
@_set_class_marshal_options
|
|
14
16
|
class ChatCompletionResponseMessage(lang.Final):
|
|
15
17
|
content: str | None = None
|
|
16
18
|
refusal: str | None = None
|
|
17
19
|
role: ta.Literal['assistant'] = dc.xfield('assistant', repr=False)
|
|
18
20
|
|
|
19
21
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
22
|
+
@_set_class_marshal_options
|
|
20
23
|
class Annotation(lang.Final):
|
|
21
24
|
type: ta.Literal['url_citation'] = dc.xfield('url_citation', repr=False)
|
|
22
25
|
|
|
23
26
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
27
|
+
@_set_class_marshal_options
|
|
24
28
|
class UrlCitation(lang.Final):
|
|
25
29
|
end_index: int
|
|
26
30
|
start_index: int
|
|
@@ -32,6 +36,7 @@ class ChatCompletionResponseMessage(lang.Final):
|
|
|
32
36
|
annotations: ta.Sequence[Annotation] | None = None
|
|
33
37
|
|
|
34
38
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
39
|
+
@_set_class_marshal_options
|
|
35
40
|
class Audio(lang.Final):
|
|
36
41
|
id: str
|
|
37
42
|
data: str
|
|
@@ -41,10 +46,12 @@ class ChatCompletionResponseMessage(lang.Final):
|
|
|
41
46
|
audio: Audio | None = None
|
|
42
47
|
|
|
43
48
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
49
|
+
@_set_class_marshal_options
|
|
44
50
|
class ToolCall(lang.Final):
|
|
45
51
|
id: str
|
|
46
52
|
|
|
47
53
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
54
|
+
@_set_class_marshal_options
|
|
48
55
|
class Function(lang.Final):
|
|
49
56
|
arguments: str
|
|
50
57
|
name: str
|
|
@@ -60,6 +67,7 @@ class ChatCompletionResponseMessage(lang.Final):
|
|
|
60
67
|
|
|
61
68
|
|
|
62
69
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
70
|
+
@_set_class_marshal_options
|
|
63
71
|
class ChatCompletionResponseChoice(lang.Final):
|
|
64
72
|
finish_reason: ta.Literal[
|
|
65
73
|
'stop',
|
|
@@ -71,6 +79,7 @@ class ChatCompletionResponseChoice(lang.Final):
|
|
|
71
79
|
index: int
|
|
72
80
|
|
|
73
81
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
82
|
+
@_set_class_marshal_options
|
|
74
83
|
class Logprobs(lang.Final):
|
|
75
84
|
content: ta.Sequence[ChatCompletionTokenLogprob] | None = None
|
|
76
85
|
refusal: ta.Sequence[ChatCompletionTokenLogprob] | None = None
|
|
@@ -84,6 +93,7 @@ class ChatCompletionResponseChoice(lang.Final):
|
|
|
84
93
|
|
|
85
94
|
|
|
86
95
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
96
|
+
@_set_class_marshal_options
|
|
87
97
|
class ChatCompletionResponse(lang.Final):
|
|
88
98
|
id: str
|
|
89
99
|
|
|
@@ -3,6 +3,8 @@ import typing as ta
|
|
|
3
3
|
from omlish import dataclasses as dc
|
|
4
4
|
from omlish import lang
|
|
5
5
|
|
|
6
|
+
from .._common import _set_class_marshal_options
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
##
|
|
8
10
|
|
|
@@ -15,6 +17,7 @@ class ChatCompletionResponseFormat(lang.Abstract, lang.Sealed):
|
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
20
|
+
@_set_class_marshal_options
|
|
18
21
|
class TextChatCompletionResponseFormat(ChatCompletionResponseFormat, lang.Final):
|
|
19
22
|
pass
|
|
20
23
|
|
|
@@ -23,8 +26,10 @@ class TextChatCompletionResponseFormat(ChatCompletionResponseFormat, lang.Final)
|
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
29
|
+
@_set_class_marshal_options
|
|
26
30
|
class JsonSchemaChatCompletionResponseFormat(ChatCompletionResponseFormat, lang.Final):
|
|
27
31
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
32
|
+
@_set_class_marshal_options
|
|
28
33
|
class JsonSchema(lang.Final):
|
|
29
34
|
name: str
|
|
30
35
|
description: str | None = None
|
|
@@ -38,5 +43,6 @@ class JsonSchemaChatCompletionResponseFormat(ChatCompletionResponseFormat, lang.
|
|
|
38
43
|
|
|
39
44
|
|
|
40
45
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
46
|
+
@_set_class_marshal_options
|
|
41
47
|
class JsonObjectChatCompletionResponseFormat(ChatCompletionResponseFormat, lang.Final):
|
|
42
48
|
pass
|