ommlds 0.0.0.dev501__py3-none-any.whl → 0.0.0.dev502__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 +8 -4
- ommlds/minichain/backends/impls/anthropic/names.py +3 -3
- ommlds/minichain/backends/impls/google/names.py +6 -0
- ommlds/minichain/services/README.md +154 -0
- ommlds/minichain/services/__init__.py +0 -151
- ommlds/minichain/services/requests.py +1 -1
- ommlds/minichain/services/responses.py +1 -1
- ommlds/minichain/services/services.py +1 -1
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/METADATA +4 -4
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/RECORD +14 -13
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev501.dist-info → ommlds-0.0.0.dev502.dist-info}/top_level.txt +0 -0
ommlds/.omlish-manifests.json
CHANGED
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"model_names": {
|
|
45
45
|
"default": "claude",
|
|
46
46
|
"aliases": {
|
|
47
|
-
"claude-opus-4-
|
|
48
|
-
"claude-opus-4-
|
|
49
|
-
"claude-opus": "claude-opus-4-
|
|
47
|
+
"claude-opus-4-5-20251101": null,
|
|
48
|
+
"claude-opus-4-5": "claude-opus-4-5-20251101",
|
|
49
|
+
"claude-opus": "claude-opus-4-5",
|
|
50
50
|
"claude-sonnet-4-5-20250929": null,
|
|
51
51
|
"claude-sonnet-4-5": "claude-sonnet-4-5-20250929",
|
|
52
52
|
"claude-sonnet": "claude-sonnet-4-5",
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"module": ".minichain.backends.impls.google.names",
|
|
211
211
|
"attr": "_BACKEND_STRINGS_MANIFEST",
|
|
212
212
|
"file": "ommlds/minichain/backends/impls/google/names.py",
|
|
213
|
-
"line":
|
|
213
|
+
"line": 38,
|
|
214
214
|
"value": {
|
|
215
215
|
"!.minichain.backends.strings.manifests.BackendStringsManifest": {
|
|
216
216
|
"service_cls_names": [
|
|
@@ -221,6 +221,10 @@
|
|
|
221
221
|
"model_names": {
|
|
222
222
|
"default": "gemini",
|
|
223
223
|
"aliases": {
|
|
224
|
+
"gemini-3-pro-preview": null,
|
|
225
|
+
"gemini-3-pro": "gemini-3-pro-preview",
|
|
226
|
+
"gemini-3-flash-preview": null,
|
|
227
|
+
"gemini-3-flash": "gemini-3-flash-preview",
|
|
224
228
|
"gemini-2.5-pro": null,
|
|
225
229
|
"gemini-2.5-flash": null,
|
|
226
230
|
"gemini-2.5-flash-lite": null,
|
|
@@ -14,9 +14,9 @@ from ...strings.manifests import BackendStringsManifest
|
|
|
14
14
|
MODEL_NAMES = ModelNameCollection(
|
|
15
15
|
default='claude',
|
|
16
16
|
aliases={
|
|
17
|
-
'claude-opus-4-
|
|
18
|
-
'claude-opus-4-
|
|
19
|
-
'claude-opus': 'claude-opus-4-
|
|
17
|
+
'claude-opus-4-5-20251101': None,
|
|
18
|
+
'claude-opus-4-5': 'claude-opus-4-5-20251101',
|
|
19
|
+
'claude-opus': 'claude-opus-4-5',
|
|
20
20
|
|
|
21
21
|
'claude-sonnet-4-5-20250929': None,
|
|
22
22
|
'claude-sonnet-4-5': 'claude-sonnet-4-5-20250929',
|
|
@@ -16,6 +16,12 @@ from ...strings.manifests import BackendStringsManifest
|
|
|
16
16
|
MODEL_NAMES = ModelNameCollection(
|
|
17
17
|
default='gemini',
|
|
18
18
|
aliases={
|
|
19
|
+
'gemini-3-pro-preview': None,
|
|
20
|
+
'gemini-3-pro': 'gemini-3-pro-preview',
|
|
21
|
+
|
|
22
|
+
'gemini-3-flash-preview': None,
|
|
23
|
+
'gemini-3-flash': 'gemini-3-flash-preview',
|
|
24
|
+
|
|
19
25
|
'gemini-2.5-pro': None,
|
|
20
26
|
'gemini-2.5-flash': None,
|
|
21
27
|
'gemini-2.5-flash-lite': None,
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
The core service abstraction. In general, Services are intended to encapsulate non-trivial, resourceful, effectful
|
|
2
|
+
operations, which are likely to have various implementations, each having their own specific capabilities in addition
|
|
3
|
+
to their common interface, and where wrapping, adapting, and transforming them in a uniform manner is desirable.
|
|
4
|
+
|
|
5
|
+
For example:
|
|
6
|
+
- A ChatService is passed a Request with a Chat value and returns a Response with an AiChat value.
|
|
7
|
+
- A ChatChoicesService is passed a Request with a Chat and returns a Response with a list of AiChoices.
|
|
8
|
+
- A ChatChoicesServiceChatService is a simple adapter taking a ChatChoicesService which it will invoke with its given
|
|
9
|
+
Request, expect a single AiChoice value in that Response, and return that single AiChat as its Response - thus acting
|
|
10
|
+
as a ChatService.
|
|
11
|
+
- Thus, all chat backends that return choices can be adapted to code expecting a single chat as output.
|
|
12
|
+
- A ChatStreamService is passed a Request with a Chat value and returns a Response with a value from which AiDeltas
|
|
13
|
+
may be streamed.
|
|
14
|
+
- A ChatChoicesStreamService is passed a Request with a Chat value and returns a Response with a value from which
|
|
15
|
+
AiChoicesDeltas may be streamed.
|
|
16
|
+
- A ChatChoicesStreamServiceChatChoicesService is an adapter taking a ChatChoicesStreamService and aggregating the
|
|
17
|
+
AiChoicesDeltas into joined, non-delta AiChoices.
|
|
18
|
+
- This may then be wrapped in a ChatChoicesServiceChatService to act as a ChatService.
|
|
19
|
+
- In practice however there are usually dedicated streaming and non-streaming implementations if possible as
|
|
20
|
+
non-streaming will usually have less overhead.
|
|
21
|
+
- An OpenaiChatChoicesService can act as a ChatChoicesService, and will accept all generic ChatOptions, in addition to
|
|
22
|
+
any OpenaiChatOptions inapplicable to any other backend. It may also produce all generic ChatOutputs, in addition to
|
|
23
|
+
OpenaiChatOutputs that will not be produced by other backends.
|
|
24
|
+
- Beyond chat, a VectorSearchService is passed a Request with a VectorSearch value and returns a Response with a
|
|
25
|
+
VectorHits value.
|
|
26
|
+
- A RetryService wraps any other Service and will attempt to re-invoke it on failure.
|
|
27
|
+
- A FirstInWinsService wraps any number of other Services and will return the first non-error Response it receives.
|
|
28
|
+
|
|
29
|
+
The service abstraction consists of 3 interrelated generic types:
|
|
30
|
+
- Request, an immutable final generic class containing a single value and any number of options.
|
|
31
|
+
- Response, an immutable final generic class containing a single value and any number of outputs.
|
|
32
|
+
- Service, a generic protocol consisting of a single async method `invoke`, taking a request and returning a response.
|
|
33
|
+
|
|
34
|
+
There are 2 related abstract base classes in the parent package:
|
|
35
|
+
- Option, a non-generic abstract class representing a service option.
|
|
36
|
+
- Output, a non-generic abstract class representing a service output.
|
|
37
|
+
|
|
38
|
+
The purpose of this arrangement is to provide the following:
|
|
39
|
+
- There is only one method - `Service.invoke` - to deal with.
|
|
40
|
+
- There is no base `Service` class - service types are distinguished only by the requests they accept and responses
|
|
41
|
+
they return.
|
|
42
|
+
- It facilitates a clear, introspectable, generally type-safe means for handling 'less-specific' and 'more-specific'
|
|
43
|
+
service types.
|
|
44
|
+
- It facilitates generic wrapper and transformation machinery.
|
|
45
|
+
|
|
46
|
+
The variance of the type parameters of the 3 classes is central:
|
|
47
|
+
- `Request[V_co, OptionT_co]`
|
|
48
|
+
- `Response[V_co, OutputT_contra]`
|
|
49
|
+
- `Service[RequestT_contra, ResponseT_co]`
|
|
50
|
+
|
|
51
|
+
And to understand this, it's important to understand how Option and Output subtypes are intended to be arranged:
|
|
52
|
+
- These types are *not* intended to form a deep type hierarchy:
|
|
53
|
+
- A RemoteChatOption is *not* intended to inherit from a ChatOption: a ChatOption (be it a base class or union alias)
|
|
54
|
+
represents an option that *any* ChatService can accept, whereas a RemoteChatOption represents an option that *only*
|
|
55
|
+
applies to a RemoteChatService.
|
|
56
|
+
- If RemoteChatOption inherited from a base ChatOption, then it would have to apply to *all* ChatService
|
|
57
|
+
implementations.
|
|
58
|
+
- For example: were ApiKey to inherit from ChatOption, then it would have to apply to all ChatServices, including
|
|
59
|
+
LocalChatService, which has no concept of an api key.
|
|
60
|
+
- Similarly, a RemoteChatOutput is *not* intended to inherit from a ChatOutput: a ChatOutput represents an output that
|
|
61
|
+
*any* ChatService can produce, whereas a RemoteChatOutput represents an output that *only* applies to a
|
|
62
|
+
RemoteChatService.
|
|
63
|
+
- These 2 types are intended to form flat, disjoint, unrelated families of subtypes, and Request and Response are
|
|
64
|
+
intended to be parameterized by the unions of all such families they may contain.
|
|
65
|
+
- Because of this, one's visual intuition regarding types and subtypes may be reversed: `int` is effectively a subtype
|
|
66
|
+
of `int | str` despite `int` being a visually shorter, less complex type.
|
|
67
|
+
- `int` is a *MORE SPECIFIC* / *STRICT SUBSET* subtype of `int | str`, the *LESS SPECIFIC* / *STRICT SUPERSET*
|
|
68
|
+
supertype.
|
|
69
|
+
|
|
70
|
+
Regarding type variance:
|
|
71
|
+
- Service has the classic setup of contravariant input and covariant output:
|
|
72
|
+
- A RemoteChatService *is a* ChatService.
|
|
73
|
+
- A RemoteChatService may accept less specific requests than a ChatService.
|
|
74
|
+
- A RemoteChatService may return more specific responses than a ChatService.
|
|
75
|
+
- Request is covariant on its options:
|
|
76
|
+
- Recall, a RemoteChatOption *is not a* ChatOption.
|
|
77
|
+
- A ChatRequest *is a* RemoteChatRequest as it will not contain options RemoteChatService cannot accept.
|
|
78
|
+
- Response is contravariant on its outputs:
|
|
79
|
+
- Recall, a RemoteChatOutput *is not a* ChatOutput.
|
|
80
|
+
- A RemoteChatResponse *is a* ChatResponse even though it may contain additional output variants not produced by
|
|
81
|
+
every ChatService.
|
|
82
|
+
- Code that calls a ChatService and is given a ChatResponse must be prepared to handle (usually by simply ignoring)
|
|
83
|
+
outputs not necessarily produced by a base ChatService.
|
|
84
|
+
|
|
85
|
+
Finally, in addition to a value and either options or outputs, a Request and Response each also contain a collection of
|
|
86
|
+
metadata. Very much unlike the Options and Outputs, the elements of these collections are simply of the types
|
|
87
|
+
`RequestMetadata | CommonMetadata` and `ResponseMetadata | CommonMetadata`, and are not otherwise parameterized. These
|
|
88
|
+
are intended for looser inputs and outputs: a generic unique id, timestamps, metrics, etc., and in general should
|
|
89
|
+
neither affect the behavior of services nor be depended upon by callers.
|
|
90
|
+
|
|
91
|
+
Below is a representative illustration of these types and their relationships. Note how:
|
|
92
|
+
- There is no subclassing of Request, Response, or Service - just type aliasing.
|
|
93
|
+
- There is no deep, shared subclassing of Option or Output.
|
|
94
|
+
- The type args passed to Request and Response are unions of all the Option and Output subtypes they may contain.
|
|
95
|
+
- These unions are kept in pluralized type aliases for convenience.
|
|
96
|
+
- There is no base ChatOption or ChatOutput class - were there, it would not be included in the base classes of any
|
|
97
|
+
local or remote only option or output.
|
|
98
|
+
- The local and remote sections take different but equivalent approaches:
|
|
99
|
+
- There are no base LocalChatOption or LocalChatOutput classes, but there *are* base RemoteChatOption and
|
|
100
|
+
RemoteChatOutput classes.
|
|
101
|
+
- Without any common base classes (besides the lowest level Output and Option classes), the local section treats them
|
|
102
|
+
as each distinct and bespoke, and the pluralized LocalChatOptions and LocalChatOutputs type aliases aggregate them
|
|
103
|
+
by explicitly listing them.
|
|
104
|
+
- With the common RemoteChatOption and RemoteChatOutput base classes, the remote section treats them as a related
|
|
105
|
+
family that any 'RemoteChat'-like service should accept and produce.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# Common chat
|
|
109
|
+
|
|
110
|
+
class MaxTokens(Option, tv.UniqueScalarTypedValue[int]): pass
|
|
111
|
+
class Temperature(Option, tv.UniqueScalarTypedValue[float]): pass
|
|
112
|
+
|
|
113
|
+
ChatOptions: ta.TypeAlias = MaxTokens | Temperature
|
|
114
|
+
ChatRequest: ta.TypeAlias = Request[Chat, ChatOptions]
|
|
115
|
+
|
|
116
|
+
class TokenUsage(Output, tv.UniqueScalarTypedValue[int]): pass
|
|
117
|
+
class ElapsedTime(Output, tv.UniqueScalarTypedValue[float]): pass
|
|
118
|
+
|
|
119
|
+
ChatOutputs: ta.TypeAlias = TokenUsage | ElapsedTime
|
|
120
|
+
ChatResponse: ta.TypeAlias = Response[Message, ChatOutputs]
|
|
121
|
+
|
|
122
|
+
ChatService: ta.TypeAlias = Service[ChatRequest, ChatResponse]
|
|
123
|
+
|
|
124
|
+
# Local chat
|
|
125
|
+
|
|
126
|
+
class ModelPath(Option, tv.ScalarTypedValue[str]): pass
|
|
127
|
+
|
|
128
|
+
LocalChatOptions: ta.TypeAlias = ChatOptions | ModelPath
|
|
129
|
+
LocalChatRequest: ta.TypeAlias = Request[Chat, LocalChatOptions]
|
|
130
|
+
|
|
131
|
+
class LogPath(Output, tv.ScalarTypedValue[str]): pass
|
|
132
|
+
|
|
133
|
+
LocalChatOutputs: ta.TypeAlias = ChatOutputs | LogPath
|
|
134
|
+
LocalChatResponse: ta.TypeAlias = Response[Message, LocalChatOutputs]
|
|
135
|
+
|
|
136
|
+
LocalChatService: ta.TypeAlias = Service[LocalChatRequest, LocalChatResponse]
|
|
137
|
+
|
|
138
|
+
# Remote chat
|
|
139
|
+
|
|
140
|
+
class RemoteChatOption(Option, lang.Abstract): pass
|
|
141
|
+
class ApiKey(RemoteChatOption, tv.ScalarTypedValue[str]): pass
|
|
142
|
+
|
|
143
|
+
RemoteChatOptions: ta.TypeAlias = ChatOptions | RemoteChatOption
|
|
144
|
+
RemoteChatRequest: ta.TypeAlias = Request[Chat, RemoteChatOptions]
|
|
145
|
+
|
|
146
|
+
class RemoteChatOutput(Output, lang.Abstract): pass
|
|
147
|
+
class BilledCostInUsd(RemoteChatOutput, tv.UniqueScalarTypedValue[float]): pass
|
|
148
|
+
|
|
149
|
+
RemoteChatOutputs: ta.TypeAlias = ChatOutputs | RemoteChatOutput
|
|
150
|
+
RemoteChatResponse: ta.TypeAlias = Response[Message, RemoteChatOutputs]
|
|
151
|
+
|
|
152
|
+
RemoteChatService: ta.TypeAlias = Service[RemoteChatRequest, RemoteChatResponse]
|
|
153
|
+
```
|
|
154
|
+
|
|
@@ -1,155 +1,4 @@
|
|
|
1
1
|
# ruff: noqa: I001
|
|
2
|
-
"""
|
|
3
|
-
The core service abstraction. In general, Services are intended to encapsulate non-trivial, resourceful, effectful
|
|
4
|
-
operations, which are likely to have various implementations, each having their own specific capabilities in addition
|
|
5
|
-
to their common interface, and where wrapping, adapting, and transforming them in a uniform manner is desirable.
|
|
6
|
-
|
|
7
|
-
For example:
|
|
8
|
-
- A ChatService is passed a Request with a Chat value and returns a Response with an AiChat value.
|
|
9
|
-
- A ChatChoicesService is passed a Request with a Chat and returns a Response with a list of AiChoices.
|
|
10
|
-
- A ChatChoicesServiceChatService is a simple adapter taking a ChatChoicesService which it will invoke with its given
|
|
11
|
-
Request, expect a single AiChoice value in that Response, and return that single AiChat as its Response - thus acting
|
|
12
|
-
as a ChatService.
|
|
13
|
-
- Thus, all chat backends that return choices can be adapted to code expecting a single chat as output.
|
|
14
|
-
- A ChatStreamService is passed a Request with a Chat value and returns a Response with a value from which AiDeltas
|
|
15
|
-
may be streamed.
|
|
16
|
-
- A ChatChoicesStreamService is passed a Request with a Chat value and returns a Response with a value from which
|
|
17
|
-
AiChoicesDeltas may be streamed.
|
|
18
|
-
- A ChatChoicesStreamServiceChatChoicesService is an adapter taking a ChatChoicesStreamService and aggregating the
|
|
19
|
-
AiChoicesDeltas into joined, non-delta AiChoices.
|
|
20
|
-
- This may then be wrapped in a ChatChoicesServiceChatService to act as a ChatService.
|
|
21
|
-
- In practice however there are usually dedicated streaming and non-streaming implementations if possible as
|
|
22
|
-
non-streaming will usually have less overhead.
|
|
23
|
-
- An OpenaiChatChoicesService can act as a ChatChoicesService, and will accept all generic ChatOptions, in addition to
|
|
24
|
-
any OpenaiChatOptions inapplicable to any other backend. It may also produce all generic ChatOutputs, in addition to
|
|
25
|
-
OpenaiChatOutputs that will not be produced by other backends.
|
|
26
|
-
- Beyond chat, a VectorSearchService is passed a Request with a VectorSearch value and returns a Response with a
|
|
27
|
-
VectorHits value.
|
|
28
|
-
- A RetryService wraps any other Service and will attempt to re-invoke it on failure.
|
|
29
|
-
- A FirstInWinsService wraps any number of other Services and will return the first non-error Response it receives.
|
|
30
|
-
|
|
31
|
-
The service abstraction consists of 3 interrelated generic types:
|
|
32
|
-
- Request, an immutable final generic class containing a single value and any number of options.
|
|
33
|
-
- Response, an immutable final generic class containing a single value and any number of outputs.
|
|
34
|
-
- Service, a generic protocol consisting of a single method `invoke`, taking a request and returning a response.
|
|
35
|
-
|
|
36
|
-
There are 2 related abstract base classes in the parent package:
|
|
37
|
-
- Option, a non-generic abstract class representing a service option.
|
|
38
|
-
- Output, a non-generic abstract class representing a service output.
|
|
39
|
-
|
|
40
|
-
The purpose of this arrangement is to provide the following:
|
|
41
|
-
- There is only one method - `Service.invoke` - to deal with.
|
|
42
|
-
- There is no base `Service` class - service types are distinguished only by the requests they accept and responses
|
|
43
|
-
they return.
|
|
44
|
-
- It facilitates a clear, introspectable, generally type-safe means for handling 'less-specific' and 'more-specific'
|
|
45
|
-
service types.
|
|
46
|
-
- It facilitates generic wrapper and transformation machinery.
|
|
47
|
-
|
|
48
|
-
The variance of the type parameters of the 3 classes is central:
|
|
49
|
-
- `Request[V_co, OptionT_co]`
|
|
50
|
-
- `Response[V_co, OutputT_contra]`
|
|
51
|
-
- `Service[RequestT_contra, ResponseT_co]`
|
|
52
|
-
|
|
53
|
-
And to understand this, it's important to understand how Option and Output subtypes are intended to be arranged:
|
|
54
|
-
- These types are *not* intended to form a deep type hierarchy:
|
|
55
|
-
- A RemoteChatOption is *not* intended to inherit from a ChatOption: a ChatOption (be it a base class or union alias)
|
|
56
|
-
represents an option that *any* ChatService can accept, whereas a RemoteChatOption represents an option that *only*
|
|
57
|
-
applies to a RemoteChatService.
|
|
58
|
-
- If RemoteChatOption inherited from a base ChatOption, then it would have to apply to *all* ChatService
|
|
59
|
-
implementations.
|
|
60
|
-
- For example: were ApiKey to inherit from ChatOption, then it would have to apply to all ChatServices, including
|
|
61
|
-
LocalChatService, which has no concept of an api key.
|
|
62
|
-
- Similarly, a RemoteChatOutput is *not* intended to inherit from a ChatOutput: a ChatOutput represents an output that
|
|
63
|
-
*any* ChatService can produce, whereas a RemoteChatOutput represents an output that *only* applies to a
|
|
64
|
-
RemoteChatService.
|
|
65
|
-
- These 2 types are intended to form flat, disjoint, unrelated families of subtypes, and Request and Response are
|
|
66
|
-
intended to be parameterized by the unions of all such families they may contain.
|
|
67
|
-
- Because of this, one's visual intuition regarding types and subtypes may be reversed: `int` is effectively a subtype
|
|
68
|
-
of `int | str` despite `int` being a visually shorter, less complex type.
|
|
69
|
-
- `int` is a *MORE SPECIFIC* / *STRICT SUBSET* subtype of `int | str`, the *LESS SPECIFIC* / *STRICT SUPERSET*
|
|
70
|
-
supertype.
|
|
71
|
-
|
|
72
|
-
Regarding type variance:
|
|
73
|
-
- Service has the classic setup of contravariant input and covariant output:
|
|
74
|
-
- A RemoteChatService *is a* ChatService.
|
|
75
|
-
- A RemoteChatService may accept less specific requests than a ChatService.
|
|
76
|
-
- A RemoteChatService may return more specific responses than a ChatService.
|
|
77
|
-
- Request is covariant on its options:
|
|
78
|
-
- Recall, a RemoteChatOption *is not a* ChatOption.
|
|
79
|
-
- A ChatRequest *is a* RemoteChatRequest as it will not contain options RemoteChatService cannot accept.
|
|
80
|
-
- Response is contravariant on its outputs:
|
|
81
|
-
- Recall, a RemoteChatOutput *is not a* ChatOutput.
|
|
82
|
-
- A RemoteChatResponse *is a* ChatResponse even though it may contain additional output variants not produced by
|
|
83
|
-
every ChatService.
|
|
84
|
-
- Code that calls a ChatService and is given a ChatResponse must be prepared to handle (usually by simply ignoring)
|
|
85
|
-
outputs not necessarily produced by a base ChatService.
|
|
86
|
-
|
|
87
|
-
Below is a representative illustration of these types and their relationships. Note how:
|
|
88
|
-
- There is no subclassing of Request, Response, or Service - just type aliasing.
|
|
89
|
-
- There is no deep, shared subclassing of Option or Output.
|
|
90
|
-
- The type args passed to Request and Response are unions of all the Option and Output subtypes they may contain.
|
|
91
|
-
- These unions are kept in pluralized type aliases for convenience.
|
|
92
|
-
- There is no base ChatOption or ChatOutput class - were there, it would not be included in the base classes of any
|
|
93
|
-
local or remote only option or output.
|
|
94
|
-
- The local and remote sections take different but equivalent approaches:
|
|
95
|
-
- There are no base LocalChatOption or LocalChatOutput classes, but there *are* base RemoteChatOption and
|
|
96
|
-
RemoteChatOutput classes.
|
|
97
|
-
- Without any common base classes (besides the lowest level Output and Option classes), the local section treats them
|
|
98
|
-
as each distinct and bespoke, and the pluralized LocalChatOptions and LocalChatOutputs type aliases aggregate them
|
|
99
|
-
by explicitly listing them.
|
|
100
|
-
- With the common RemoteChatOption and RemoteChatOutput base classes, the remote section treats them as a related
|
|
101
|
-
family that any 'RemoteChat'-like service should accept and produce.
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
# Common chat
|
|
105
|
-
|
|
106
|
-
class MaxTokens(Option, tv.UniqueScalarTypedValue[int]): pass
|
|
107
|
-
class Temperature(Option, tv.UniqueScalarTypedValue[float]): pass
|
|
108
|
-
|
|
109
|
-
ChatOptions: ta.TypeAlias = MaxTokens | Temperature
|
|
110
|
-
ChatRequest: ta.TypeAlias = Request[Chat, ChatOptions]
|
|
111
|
-
|
|
112
|
-
class TokenUsage(Output, tv.UniqueScalarTypedValue[int]): pass
|
|
113
|
-
class ElapsedTime(Output, tv.UniqueScalarTypedValue[float]): pass
|
|
114
|
-
|
|
115
|
-
ChatOutput: ta.TypeAlias = TokenUsage | ElapsedTime
|
|
116
|
-
ChatResponse: ta.TypeAlias = Response[Message, ChatOutput]
|
|
117
|
-
|
|
118
|
-
ChatService: ta.TypeAlias = Service[ChatRequest, ChatResponse]
|
|
119
|
-
|
|
120
|
-
# Local chat
|
|
121
|
-
|
|
122
|
-
class ModelPath(Option, tv.ScalarTypedValue[str]): pass
|
|
123
|
-
|
|
124
|
-
LocalChatOptions: ta.TypeAlias = ChatOptions | ModelPath
|
|
125
|
-
LocalChatRequest: ta.TypeAlias = Request[Chat, LocalChatOptions]
|
|
126
|
-
|
|
127
|
-
class LogPath(Output, tv.ScalarTypedValue[str]): pass
|
|
128
|
-
|
|
129
|
-
LocalChatOutputs: ta.TypeAlias = ChatOutput | LogPath
|
|
130
|
-
LocalChatResponse: ta.TypeAlias = Response[Message, LocalChatOutputs]
|
|
131
|
-
|
|
132
|
-
LocalChatService: ta.TypeAlias = Service[LocalChatRequest, LocalChatResponse]
|
|
133
|
-
|
|
134
|
-
# Remote chat
|
|
135
|
-
|
|
136
|
-
class RemoteChatOption(Option, lang.Abstract): pass
|
|
137
|
-
class ApiKey(RemoteChatOption, tv.ScalarTypedValue[str]): pass
|
|
138
|
-
|
|
139
|
-
RemoteChatOptions: ta.TypeAlias = ChatOptions | RemoteChatOption
|
|
140
|
-
RemoteChatRequest: ta.TypeAlias = Request[Chat, RemoteChatOptions]
|
|
141
|
-
|
|
142
|
-
class RemoteChatOutput(Output, lang.Abstract): pass
|
|
143
|
-
class BilledCostInUsd(RemoteChatOutput, tv.UniqueScalarTypedValue[float]): pass
|
|
144
|
-
|
|
145
|
-
RemoteChatOutputs: ta.TypeAlias = ChatOutput | RemoteChatOutput
|
|
146
|
-
RemoteChatResponse: ta.TypeAlias = Response[Message, RemoteChatOutputs]
|
|
147
|
-
|
|
148
|
-
RemoteChatService: ta.TypeAlias = Service[RemoteChatRequest, RemoteChatResponse]
|
|
149
|
-
```
|
|
150
|
-
"""
|
|
151
|
-
|
|
152
|
-
|
|
153
2
|
from .facades import ( # noqa
|
|
154
3
|
ServiceFacade,
|
|
155
4
|
|
|
@@ -51,7 +51,7 @@ class Request( # type: ignore[type-var] # FIXME: _TypedValues param is invaria
|
|
|
51
51
|
- a sequence of options of type `OptionT_co`
|
|
52
52
|
- metadata of type `RequestMetadatas`
|
|
53
53
|
|
|
54
|
-
Refer to the package
|
|
54
|
+
Refer to the package README.md for an explanation of its type var variance.
|
|
55
55
|
|
|
56
56
|
This class is final, but each instance's `__orig_class__` (if present) is significant. It is encouraged to construct
|
|
57
57
|
these through a pre-parameterized type alias, and the provided `with_` methods should be used rather than
|
|
@@ -49,7 +49,7 @@ class Response( # type: ignore[type-var] # FIXME: _TypedValues param is invari
|
|
|
49
49
|
- a sequence of outputs of type `OutputT_contra`
|
|
50
50
|
- metadata of type `ResponseMetadatas`
|
|
51
51
|
|
|
52
|
-
Refer to the package
|
|
52
|
+
Refer to the package README.md for an explanation of its type var variance.
|
|
53
53
|
|
|
54
54
|
This class is final, but each instance's `__orig_class__` (if present) is significant. It is encouraged to construct
|
|
55
55
|
these through a pre-parameterized type alias, and the provided `with_` methods should be used rather than
|
|
@@ -15,7 +15,7 @@ class Service(lang.ProtocolForbiddenAsBaseClass, ta.Protocol[RequestT_contra, Re
|
|
|
15
15
|
Universal service protocol, comprised of a single method `invoke`, accepting a request of type `RequestT_contra` and
|
|
16
16
|
returning a response of type `ResponseT_co`.
|
|
17
17
|
|
|
18
|
-
Refer to the package
|
|
18
|
+
Refer to the package README.md for an explanation of its type var variance.
|
|
19
19
|
|
|
20
20
|
This class is final, but each instance's `__orig_class__` (if present) is significant.
|
|
21
21
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev502
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -14,9 +14,9 @@ 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: omlish==0.0.0.
|
|
17
|
+
Requires-Dist: omlish==0.0.0.dev502
|
|
18
18
|
Provides-Extra: all
|
|
19
|
-
Requires-Dist: omdev==0.0.0.
|
|
19
|
+
Requires-Dist: omdev==0.0.0.dev502; extra == "all"
|
|
20
20
|
Requires-Dist: llama-cpp-python~=0.3; extra == "all"
|
|
21
21
|
Requires-Dist: mlx~=0.30; sys_platform == "darwin" and extra == "all"
|
|
22
22
|
Requires-Dist: mlx-lm~=0.29; sys_platform == "darwin" and extra == "all"
|
|
@@ -38,7 +38,7 @@ Requires-Dist: mwparserfromhell~=0.7; extra == "all"
|
|
|
38
38
|
Requires-Dist: wikitextparser~=0.56; extra == "all"
|
|
39
39
|
Requires-Dist: lxml>=5.3; python_version < "3.13" and extra == "all"
|
|
40
40
|
Provides-Extra: omdev
|
|
41
|
-
Requires-Dist: omdev==0.0.0.
|
|
41
|
+
Requires-Dist: omdev==0.0.0.dev502; extra == "omdev"
|
|
42
42
|
Provides-Extra: backends
|
|
43
43
|
Requires-Dist: llama-cpp-python~=0.3; extra == "backends"
|
|
44
44
|
Requires-Dist: mlx~=0.30; sys_platform == "darwin" and extra == "backends"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ommlds/.omlish-manifests.json,sha256=
|
|
1
|
+
ommlds/.omlish-manifests.json,sha256=s6qy0XrbNb0iojn6OOLp-nuuELfpYGwX_SB9GFyShqU,28066
|
|
2
2
|
ommlds/README.md,sha256=xhbl2n19GznXrIzAGdlX8PAYJYsOo_Zu63I7G1UFRZE,398
|
|
3
3
|
ommlds/__about__.py,sha256=cdexoZ9J6msGQeIwveAx4JM0WlBDrWdjRkhSI9VHB9Q,1901
|
|
4
4
|
ommlds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -262,7 +262,7 @@ ommlds/minichain/backends/impls/sqlite.py,sha256=NOFm_fgr-OZ8mo7etj0zwvxsDnidRwK
|
|
|
262
262
|
ommlds/minichain/backends/impls/tavily.py,sha256=k67QQF4cL8vMtE5LOXxczNFMGlMeRWV0oGwugLgS-Y0,1986
|
|
263
263
|
ommlds/minichain/backends/impls/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
264
264
|
ommlds/minichain/backends/impls/anthropic/chat.py,sha256=e4Kcbjvca_yaZsNB_-h335gSCbz4ma1lMUvuR4WzEFE,4874
|
|
265
|
-
ommlds/minichain/backends/impls/anthropic/names.py,sha256=
|
|
265
|
+
ommlds/minichain/backends/impls/anthropic/names.py,sha256=t70dOuzqpSu9LE_MxfOl2mQmwfTkELT7jWduvuEVMbk,1099
|
|
266
266
|
ommlds/minichain/backends/impls/anthropic/protocol.py,sha256=eMqkl7ML5btqJ27_9l6RY2zdTMsQe0k3Kn_keNq0-Mk,3337
|
|
267
267
|
ommlds/minichain/backends/impls/anthropic/stream.py,sha256=jxKzytoYJLK9JftihGhWTcFIoXFgouQR7Yu5Q1j_ku8,8794
|
|
268
268
|
ommlds/minichain/backends/impls/cerebras/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -276,7 +276,7 @@ ommlds/minichain/backends/impls/dummy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
|
276
276
|
ommlds/minichain/backends/impls/dummy/chat.py,sha256=FUTvNPWmb4Hm-axglvPiqbvLwE7sajHOM5H7j9Qj2-c,2283
|
|
277
277
|
ommlds/minichain/backends/impls/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
278
278
|
ommlds/minichain/backends/impls/google/chat.py,sha256=lGb5blGLlcBlt9xeDZJvbh5SlV7fgfezd5_As_SPBXo,6499
|
|
279
|
-
ommlds/minichain/backends/impls/google/names.py,sha256=
|
|
279
|
+
ommlds/minichain/backends/impls/google/names.py,sha256=Yt7xL84JZEtPf7CIcBzEBrWAfEUUs2_gXk2W7m5wC3g,1051
|
|
280
280
|
ommlds/minichain/backends/impls/google/search.py,sha256=y5_6seSRU8CFnLA_Ja8XEMbIBWSgwBzE1iBf-qyz0tA,3427
|
|
281
281
|
ommlds/minichain/backends/impls/google/stream.py,sha256=AT8qbP0EqJUnf-D45aTbEQ0h5lvgtIK6XKki0t8RkZE,8029
|
|
282
282
|
ommlds/minichain/backends/impls/google/tools.py,sha256=bP4bqHt1oZTvrcObkjQCNAUJEXrR9fFIRuvjsVFM910,5109
|
|
@@ -427,14 +427,15 @@ ommlds/minichain/registries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
427
427
|
ommlds/minichain/registries/globals.py,sha256=M4-RTsjHfm7FRXqV-4ecWywEF1Di2lnTn3a7OJhtzkU,3224
|
|
428
428
|
ommlds/minichain/registries/manifests.py,sha256=GTWk4lssAk8mmG3ilGK2NvIU-rGS3otOZNuGQUDStMI,362
|
|
429
429
|
ommlds/minichain/registries/registry.py,sha256=wmk88NsM20Kl4PduX3Oy5roHPfNKtXENCITTc7M8gAY,4626
|
|
430
|
-
ommlds/minichain/services/
|
|
430
|
+
ommlds/minichain/services/README.md,sha256=uHS4Exv-9Wlm3WMDn9myZ_MBPgsjKG_AN1YeCrBn4qo,9428
|
|
431
|
+
ommlds/minichain/services/__init__.py,sha256=Su3p_xIAdTK4uTabmSAEIwnoVq0EL5_OpFi1TROfQ5U,424
|
|
431
432
|
ommlds/minichain/services/_marshal.py,sha256=zIp4WnbGh-e2DS2lN2qi_Y3XO-MJN8sVYGB4HAPOOIU,5321
|
|
432
433
|
ommlds/minichain/services/_origclasses.py,sha256=cUao3vxNzArsHH3RAC3PKHLBWN66oQDvYyGT_agYZ-g,1625
|
|
433
434
|
ommlds/minichain/services/_typedvalues.py,sha256=j3Rw6cZ-xfhzSTOPDe4OLsvzsADuy9r0lVmW9_egvjM,3040
|
|
434
435
|
ommlds/minichain/services/facades.py,sha256=zoTY5GT7yIrFUY3fX7a-sSOvkk1_4GK5FlJJmRL_ems,1734
|
|
435
|
-
ommlds/minichain/services/requests.py,sha256=
|
|
436
|
-
ommlds/minichain/services/responses.py,sha256=
|
|
437
|
-
ommlds/minichain/services/services.py,sha256=
|
|
436
|
+
ommlds/minichain/services/requests.py,sha256=PznUkVISx8PEPtio7KGH0YEvktkBp9FqU_W5KxQDqHM,3422
|
|
437
|
+
ommlds/minichain/services/responses.py,sha256=jSUFUrY0DDnRyimh3pD2ee2ZnOcH8oQxxZnwiLf5p9A,3381
|
|
438
|
+
ommlds/minichain/services/services.py,sha256=c2uHH5Pt0wtUDQgJQEbw6NsS5NVSXMJirWISJ5FaRNg,685
|
|
438
439
|
ommlds/minichain/stream/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
439
440
|
ommlds/minichain/stream/services.py,sha256=YXfEj3ZXKZ3Svkig6f3hOReHgZnLY2tDn2bgB0RIoRI,5566
|
|
440
441
|
ommlds/minichain/stream/wrap.py,sha256=nQC0aCi49I18nF0Yx8qiiLkhIAECV6s6o4pvOy5Kx98,2041
|
|
@@ -512,9 +513,9 @@ ommlds/wiki/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
512
513
|
ommlds/wiki/utils/io.py,sha256=UKgDJGtmpnWvIqVd2mJc2QNPOqlToEY1GEveNp6_pMo,7088
|
|
513
514
|
ommlds/wiki/utils/progress.py,sha256=EhvKcMFYtsarCQhIahlO6f0SboyAKP3UwUyrnVnP-Vk,3222
|
|
514
515
|
ommlds/wiki/utils/xml.py,sha256=sNJNkZ9rT8B-kJMO6bRz8J1USy4fyPx0m2PwTX7vxYY,3846
|
|
515
|
-
ommlds-0.0.0.
|
|
516
|
-
ommlds-0.0.0.
|
|
517
|
-
ommlds-0.0.0.
|
|
518
|
-
ommlds-0.0.0.
|
|
519
|
-
ommlds-0.0.0.
|
|
520
|
-
ommlds-0.0.0.
|
|
516
|
+
ommlds-0.0.0.dev502.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
517
|
+
ommlds-0.0.0.dev502.dist-info/METADATA,sha256=gaDPjUyCBXbQflQQZvorRw3dRZyJ5cDtalsPcM9L-X4,3495
|
|
518
|
+
ommlds-0.0.0.dev502.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
519
|
+
ommlds-0.0.0.dev502.dist-info/entry_points.txt,sha256=Z5YWtX7ClfiCKdW-dd_CSVvM0h4yQpJPi-2G3q6gNFo,35
|
|
520
|
+
ommlds-0.0.0.dev502.dist-info/top_level.txt,sha256=Rbnk5d5wi58vnAXx13WFZqdQ4VX8hBCS2hEL3WeXOhY,7
|
|
521
|
+
ommlds-0.0.0.dev502.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|