ommlds 0.0.0.dev506__py3-none-any.whl → 0.0.0.dev508__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 +24 -0
- ommlds/backends/anthropic/protocol/types.py +5 -7
- ommlds/backends/cerebras/protocol.py +3 -5
- ommlds/backends/google/protocol/types.py +6 -8
- ommlds/backends/groq/protocol.py +3 -5
- ommlds/backends/huggingface/__init__.py +0 -0
- ommlds/backends/{huggingface.py → huggingface/cache.py} +1 -6
- ommlds/backends/huggingface/cli.py +208 -0
- ommlds/backends/ollama/_dataclasses.py +452 -0
- ommlds/backends/ollama/cli.py +36 -0
- ommlds/backends/ollama/protocol.py +36 -8
- ommlds/backends/openai/protocol/_common.py +3 -5
- ommlds/backends/tavily/protocol.py +3 -5
- ommlds/backends/torch/backends.py +1 -1
- ommlds/minichain/_typedvalues.py +4 -4
- ommlds/minichain/backends/impls/google/search.py +4 -4
- ommlds/minichain/backends/strings/parsing.py +1 -1
- ommlds/minichain/chat/messages.py +3 -3
- ommlds/minichain/models/configs.py +2 -2
- ommlds/minichain/services/_marshal.py +2 -2
- ommlds/minichain/tools/execution/catalog.py +1 -1
- ommlds/minichain/tools/types.py +4 -4
- ommlds/specs/mcp/protocol.py +4 -6
- ommlds/wiki/models.py +4 -4
- ommlds/wiki/text/mfh.py +9 -9
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/METADATA +4 -4
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/RECORD +31 -28
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev506.dist-info → ommlds-0.0.0.dev508.dist-info}/top_level.txt +0 -0
|
@@ -2008,6 +2008,249 @@ def _process_dataclass__d4de027591ccf1da84a98a2734b94a36c6340c4b():
|
|
|
2008
2008
|
return _process_dataclass
|
|
2009
2009
|
|
|
2010
2010
|
|
|
2011
|
+
@_register(
|
|
2012
|
+
plan_repr=(
|
|
2013
|
+
"Plans(tup=(CopyPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest', '"
|
|
2014
|
+
"details')), EqPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest', 'd"
|
|
2015
|
+
"etails')), FrozenPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest',"
|
|
2016
|
+
" 'details'), allow_dynamic_dunder_attrs=False), HashPlan(action='add', fields=('name', 'model', 'remote_model'"
|
|
2017
|
+
", 'remote_host', 'modified_at', 'size', 'digest', 'details'), cache=False), InitPlan(fields=(InitPlan.Field(na"
|
|
2018
|
+
"me='name', annotation=OpRef(name='init.fields.0.annotation'), default=None, default_factory=None, init=True, o"
|
|
2019
|
+
"verride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(nam"
|
|
2020
|
+
"e='model', annotation=OpRef(name='init.fields.1.annotation'), default=None, default_factory=None, init=True, o"
|
|
2021
|
+
"verride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(nam"
|
|
2022
|
+
"e='remote_model', annotation=OpRef(name='init.fields.2.annotation'), default=OpRef(name='init.fields.2.default"
|
|
2023
|
+
"'), default_factory=None, init=True, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None"
|
|
2024
|
+
", check_type=None), InitPlan.Field(name='remote_host', annotation=OpRef(name='init.fields.3.annotation'), defa"
|
|
2025
|
+
"ult=OpRef(name='init.fields.3.default'), default_factory=None, init=True, override=False, field_type=FieldType"
|
|
2026
|
+
".INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='modified_at', annotation=OpRef(n"
|
|
2027
|
+
"ame='init.fields.4.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fie"
|
|
2028
|
+
"ldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='size', annotation=OpRef(na"
|
|
2029
|
+
"me='init.fields.5.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fiel"
|
|
2030
|
+
"dType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='digest', annotation=OpRef(n"
|
|
2031
|
+
"ame='init.fields.6.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fie"
|
|
2032
|
+
"ldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='details', annotation=OpRef"
|
|
2033
|
+
"(name='init.fields.7.annotation'), default=OpRef(name='init.fields.7.default'), default_factory=None, init=Tru"
|
|
2034
|
+
"e, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None)), self_param='s"
|
|
2035
|
+
"elf', std_params=(), kw_only_params=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'd"
|
|
2036
|
+
"igest', 'details'), frozen=True, slots=False, post_init_params=None, init_fns=(), validate_fns=()), ReprPlan(f"
|
|
2037
|
+
"ields=(ReprPlan.Field(name='name', kw_only=True, fn=None), ReprPlan.Field(name='model', kw_only=True, fn=None)"
|
|
2038
|
+
", ReprPlan.Field(name='remote_model', kw_only=True, fn=None), ReprPlan.Field(name='remote_host', kw_only=True,"
|
|
2039
|
+
" fn=None), ReprPlan.Field(name='modified_at', kw_only=True, fn=None), ReprPlan.Field(name='size', kw_only=True"
|
|
2040
|
+
", fn=None), ReprPlan.Field(name='digest', kw_only=True, fn=None), ReprPlan.Field(name='details', kw_only=True,"
|
|
2041
|
+
" fn=None)), id=False, terse=False, default_fn=OpRef(name='repr.default_fn'))))"
|
|
2042
|
+
),
|
|
2043
|
+
plan_repr_sha1='39f7bcef98c1ad6b9fc898613abfef167e9b916f',
|
|
2044
|
+
op_ref_idents=(
|
|
2045
|
+
'__dataclass__init__fields__0__annotation',
|
|
2046
|
+
'__dataclass__init__fields__1__annotation',
|
|
2047
|
+
'__dataclass__init__fields__2__annotation',
|
|
2048
|
+
'__dataclass__init__fields__2__default',
|
|
2049
|
+
'__dataclass__init__fields__3__annotation',
|
|
2050
|
+
'__dataclass__init__fields__3__default',
|
|
2051
|
+
'__dataclass__init__fields__4__annotation',
|
|
2052
|
+
'__dataclass__init__fields__5__annotation',
|
|
2053
|
+
'__dataclass__init__fields__6__annotation',
|
|
2054
|
+
'__dataclass__init__fields__7__annotation',
|
|
2055
|
+
'__dataclass__init__fields__7__default',
|
|
2056
|
+
'__dataclass__repr__default_fn',
|
|
2057
|
+
),
|
|
2058
|
+
cls_names=(
|
|
2059
|
+
('ommlds.backends.ollama.protocol', 'ListModelResponse'),
|
|
2060
|
+
),
|
|
2061
|
+
)
|
|
2062
|
+
def _process_dataclass__39f7bcef98c1ad6b9fc898613abfef167e9b916f():
|
|
2063
|
+
def _process_dataclass(
|
|
2064
|
+
*,
|
|
2065
|
+
__dataclass__cls,
|
|
2066
|
+
__dataclass__init__fields__0__annotation,
|
|
2067
|
+
__dataclass__init__fields__1__annotation,
|
|
2068
|
+
__dataclass__init__fields__2__annotation,
|
|
2069
|
+
__dataclass__init__fields__2__default,
|
|
2070
|
+
__dataclass__init__fields__3__annotation,
|
|
2071
|
+
__dataclass__init__fields__3__default,
|
|
2072
|
+
__dataclass__init__fields__4__annotation,
|
|
2073
|
+
__dataclass__init__fields__5__annotation,
|
|
2074
|
+
__dataclass__init__fields__6__annotation,
|
|
2075
|
+
__dataclass__init__fields__7__annotation,
|
|
2076
|
+
__dataclass__init__fields__7__default,
|
|
2077
|
+
__dataclass__repr__default_fn,
|
|
2078
|
+
__dataclass__FieldFnValidationError, # noqa
|
|
2079
|
+
__dataclass__FieldTypeValidationError, # noqa
|
|
2080
|
+
__dataclass__FnValidationError, # noqa
|
|
2081
|
+
__dataclass__FrozenInstanceError=dataclasses.FrozenInstanceError, # noqa
|
|
2082
|
+
__dataclass__FunctionType=types.FunctionType, # noqa
|
|
2083
|
+
__dataclass__HAS_DEFAULT_FACTORY=dataclasses._HAS_DEFAULT_FACTORY, # noqa
|
|
2084
|
+
__dataclass__MISSING=dataclasses.MISSING, # noqa
|
|
2085
|
+
__dataclass__None=None, # noqa
|
|
2086
|
+
__dataclass__TypeError=TypeError, # noqa
|
|
2087
|
+
__dataclass___recursive_repr=reprlib.recursive_repr, # noqa
|
|
2088
|
+
__dataclass__isinstance=isinstance, # noqa
|
|
2089
|
+
__dataclass__object_setattr=object.__setattr__, # noqa
|
|
2090
|
+
__dataclass__property=property, # noqa
|
|
2091
|
+
):
|
|
2092
|
+
def __copy__(self):
|
|
2093
|
+
if self.__class__ is not __dataclass__cls:
|
|
2094
|
+
raise TypeError(self)
|
|
2095
|
+
return __dataclass__cls( # noqa
|
|
2096
|
+
name=self.name,
|
|
2097
|
+
model=self.model,
|
|
2098
|
+
remote_model=self.remote_model,
|
|
2099
|
+
remote_host=self.remote_host,
|
|
2100
|
+
modified_at=self.modified_at,
|
|
2101
|
+
size=self.size,
|
|
2102
|
+
digest=self.digest,
|
|
2103
|
+
details=self.details,
|
|
2104
|
+
)
|
|
2105
|
+
|
|
2106
|
+
__copy__.__qualname__ = f"{__dataclass__cls.__qualname__}.__copy__"
|
|
2107
|
+
if '__copy__' in __dataclass__cls.__dict__:
|
|
2108
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __copy__ in class {__dataclass__cls.__name__}")
|
|
2109
|
+
setattr(__dataclass__cls, '__copy__', __copy__)
|
|
2110
|
+
|
|
2111
|
+
def __eq__(self, other):
|
|
2112
|
+
if self is other:
|
|
2113
|
+
return True
|
|
2114
|
+
if self.__class__ is not other.__class__:
|
|
2115
|
+
return NotImplemented
|
|
2116
|
+
return (
|
|
2117
|
+
self.name == other.name and
|
|
2118
|
+
self.model == other.model and
|
|
2119
|
+
self.remote_model == other.remote_model and
|
|
2120
|
+
self.remote_host == other.remote_host and
|
|
2121
|
+
self.modified_at == other.modified_at and
|
|
2122
|
+
self.size == other.size and
|
|
2123
|
+
self.digest == other.digest and
|
|
2124
|
+
self.details == other.details
|
|
2125
|
+
)
|
|
2126
|
+
|
|
2127
|
+
__eq__.__qualname__ = f"{__dataclass__cls.__qualname__}.__eq__"
|
|
2128
|
+
if '__eq__' in __dataclass__cls.__dict__:
|
|
2129
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __eq__ in class {__dataclass__cls.__name__}")
|
|
2130
|
+
setattr(__dataclass__cls, '__eq__', __eq__)
|
|
2131
|
+
|
|
2132
|
+
__dataclass___setattr_frozen_fields = {
|
|
2133
|
+
'name',
|
|
2134
|
+
'model',
|
|
2135
|
+
'remote_model',
|
|
2136
|
+
'remote_host',
|
|
2137
|
+
'modified_at',
|
|
2138
|
+
'size',
|
|
2139
|
+
'digest',
|
|
2140
|
+
'details',
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
def __setattr__(self, name, value):
|
|
2144
|
+
if (
|
|
2145
|
+
type(self) is __dataclass__cls
|
|
2146
|
+
or name in __dataclass___setattr_frozen_fields
|
|
2147
|
+
):
|
|
2148
|
+
raise __dataclass__FrozenInstanceError(f"cannot assign to field {name!r}")
|
|
2149
|
+
super(__dataclass__cls, self).__setattr__(name, value)
|
|
2150
|
+
|
|
2151
|
+
__setattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__setattr__"
|
|
2152
|
+
if '__setattr__' in __dataclass__cls.__dict__:
|
|
2153
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __setattr__ in class {__dataclass__cls.__name__}")
|
|
2154
|
+
setattr(__dataclass__cls, '__setattr__', __setattr__)
|
|
2155
|
+
|
|
2156
|
+
__dataclass___delattr_frozen_fields = {
|
|
2157
|
+
'name',
|
|
2158
|
+
'model',
|
|
2159
|
+
'remote_model',
|
|
2160
|
+
'remote_host',
|
|
2161
|
+
'modified_at',
|
|
2162
|
+
'size',
|
|
2163
|
+
'digest',
|
|
2164
|
+
'details',
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
def __delattr__(self, name):
|
|
2168
|
+
if (
|
|
2169
|
+
type(self) is __dataclass__cls
|
|
2170
|
+
or name in __dataclass___delattr_frozen_fields
|
|
2171
|
+
):
|
|
2172
|
+
raise __dataclass__FrozenInstanceError(f"cannot delete field {name!r}")
|
|
2173
|
+
super(__dataclass__cls, self).__delattr__(name)
|
|
2174
|
+
|
|
2175
|
+
__delattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__delattr__"
|
|
2176
|
+
if '__delattr__' in __dataclass__cls.__dict__:
|
|
2177
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __delattr__ in class {__dataclass__cls.__name__}")
|
|
2178
|
+
setattr(__dataclass__cls, '__delattr__', __delattr__)
|
|
2179
|
+
|
|
2180
|
+
def __hash__(self):
|
|
2181
|
+
return hash((
|
|
2182
|
+
self.name,
|
|
2183
|
+
self.model,
|
|
2184
|
+
self.remote_model,
|
|
2185
|
+
self.remote_host,
|
|
2186
|
+
self.modified_at,
|
|
2187
|
+
self.size,
|
|
2188
|
+
self.digest,
|
|
2189
|
+
self.details,
|
|
2190
|
+
))
|
|
2191
|
+
|
|
2192
|
+
__hash__.__qualname__ = f"{__dataclass__cls.__qualname__}.__hash__"
|
|
2193
|
+
setattr(__dataclass__cls, '__hash__', __hash__)
|
|
2194
|
+
|
|
2195
|
+
def __init__(
|
|
2196
|
+
self,
|
|
2197
|
+
*,
|
|
2198
|
+
name: __dataclass__init__fields__0__annotation,
|
|
2199
|
+
model: __dataclass__init__fields__1__annotation,
|
|
2200
|
+
remote_model: __dataclass__init__fields__2__annotation = __dataclass__init__fields__2__default,
|
|
2201
|
+
remote_host: __dataclass__init__fields__3__annotation = __dataclass__init__fields__3__default,
|
|
2202
|
+
modified_at: __dataclass__init__fields__4__annotation,
|
|
2203
|
+
size: __dataclass__init__fields__5__annotation,
|
|
2204
|
+
digest: __dataclass__init__fields__6__annotation,
|
|
2205
|
+
details: __dataclass__init__fields__7__annotation = __dataclass__init__fields__7__default,
|
|
2206
|
+
) -> __dataclass__None:
|
|
2207
|
+
__dataclass__object_setattr(self, 'name', name)
|
|
2208
|
+
__dataclass__object_setattr(self, 'model', model)
|
|
2209
|
+
__dataclass__object_setattr(self, 'remote_model', remote_model)
|
|
2210
|
+
__dataclass__object_setattr(self, 'remote_host', remote_host)
|
|
2211
|
+
__dataclass__object_setattr(self, 'modified_at', modified_at)
|
|
2212
|
+
__dataclass__object_setattr(self, 'size', size)
|
|
2213
|
+
__dataclass__object_setattr(self, 'digest', digest)
|
|
2214
|
+
__dataclass__object_setattr(self, 'details', details)
|
|
2215
|
+
|
|
2216
|
+
__init__.__qualname__ = f"{__dataclass__cls.__qualname__}.__init__"
|
|
2217
|
+
if '__init__' in __dataclass__cls.__dict__:
|
|
2218
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __init__ in class {__dataclass__cls.__name__}")
|
|
2219
|
+
setattr(__dataclass__cls, '__init__', __init__)
|
|
2220
|
+
|
|
2221
|
+
@__dataclass___recursive_repr()
|
|
2222
|
+
def __repr__(self):
|
|
2223
|
+
parts = []
|
|
2224
|
+
if (s := __dataclass__repr__default_fn(self.name)) is not None:
|
|
2225
|
+
parts.append(f"name={s}")
|
|
2226
|
+
if (s := __dataclass__repr__default_fn(self.model)) is not None:
|
|
2227
|
+
parts.append(f"model={s}")
|
|
2228
|
+
if (s := __dataclass__repr__default_fn(self.remote_model)) is not None:
|
|
2229
|
+
parts.append(f"remote_model={s}")
|
|
2230
|
+
if (s := __dataclass__repr__default_fn(self.remote_host)) is not None:
|
|
2231
|
+
parts.append(f"remote_host={s}")
|
|
2232
|
+
if (s := __dataclass__repr__default_fn(self.modified_at)) is not None:
|
|
2233
|
+
parts.append(f"modified_at={s}")
|
|
2234
|
+
if (s := __dataclass__repr__default_fn(self.size)) is not None:
|
|
2235
|
+
parts.append(f"size={s}")
|
|
2236
|
+
if (s := __dataclass__repr__default_fn(self.digest)) is not None:
|
|
2237
|
+
parts.append(f"digest={s}")
|
|
2238
|
+
if (s := __dataclass__repr__default_fn(self.details)) is not None:
|
|
2239
|
+
parts.append(f"details={s}")
|
|
2240
|
+
return (
|
|
2241
|
+
f"{self.__class__.__qualname__}("
|
|
2242
|
+
f"{', '.join(parts)}"
|
|
2243
|
+
f")"
|
|
2244
|
+
)
|
|
2245
|
+
|
|
2246
|
+
__repr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__repr__"
|
|
2247
|
+
if '__repr__' in __dataclass__cls.__dict__:
|
|
2248
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __repr__ in class {__dataclass__cls.__name__}")
|
|
2249
|
+
setattr(__dataclass__cls, '__repr__', __repr__)
|
|
2250
|
+
|
|
2251
|
+
return _process_dataclass
|
|
2252
|
+
|
|
2253
|
+
|
|
2011
2254
|
@_register(
|
|
2012
2255
|
plan_repr=(
|
|
2013
2256
|
"Plans(tup=(CopyPlan(fields=('role', 'content', 'thinking', 'images', 'tool_name', 'tool_calls')), EqPlan(field"
|
|
@@ -2541,6 +2784,215 @@ def _process_dataclass__c679b8dd972a245826381e3200fe81df0cd736c1():
|
|
|
2541
2784
|
return _process_dataclass
|
|
2542
2785
|
|
|
2543
2786
|
|
|
2787
|
+
@_register(
|
|
2788
|
+
plan_repr=(
|
|
2789
|
+
"Plans(tup=(CopyPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_le"
|
|
2790
|
+
"vel')), EqPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_level')"
|
|
2791
|
+
"), FrozenPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_level'),"
|
|
2792
|
+
" allow_dynamic_dunder_attrs=False), HashPlan(action='add', fields=('parent_model', 'format', 'family', 'famili"
|
|
2793
|
+
"es', 'parameter_size', 'quantization_level'), cache=False), InitPlan(fields=(InitPlan.Field(name='parent_model"
|
|
2794
|
+
"', annotation=OpRef(name='init.fields.0.annotation'), default=None, default_factory=None, init=True, override="
|
|
2795
|
+
"False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='forma"
|
|
2796
|
+
"t', annotation=OpRef(name='init.fields.1.annotation'), default=None, default_factory=None, init=True, override"
|
|
2797
|
+
"=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='fami"
|
|
2798
|
+
"ly', annotation=OpRef(name='init.fields.2.annotation'), default=None, default_factory=None, init=True, overrid"
|
|
2799
|
+
"e=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='fam"
|
|
2800
|
+
"ilies', annotation=OpRef(name='init.fields.3.annotation'), default=None, default_factory=None, init=True, over"
|
|
2801
|
+
"ride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='"
|
|
2802
|
+
"parameter_size', annotation=OpRef(name='init.fields.4.annotation'), default=None, default_factory=None, init=T"
|
|
2803
|
+
"rue, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Fie"
|
|
2804
|
+
"ld(name='quantization_level', annotation=OpRef(name='init.fields.5.annotation'), default=None, default_factory"
|
|
2805
|
+
"=None, init=True, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None))"
|
|
2806
|
+
", self_param='self', std_params=(), kw_only_params=('parent_model', 'format', 'family', 'families', 'parameter"
|
|
2807
|
+
"_size', 'quantization_level'), frozen=True, slots=False, post_init_params=None, init_fns=(), validate_fns=()),"
|
|
2808
|
+
" ReprPlan(fields=(ReprPlan.Field(name='parent_model', kw_only=True, fn=None), ReprPlan.Field(name='format', kw"
|
|
2809
|
+
"_only=True, fn=None), ReprPlan.Field(name='family', kw_only=True, fn=None), ReprPlan.Field(name='families', kw"
|
|
2810
|
+
"_only=True, fn=None), ReprPlan.Field(name='parameter_size', kw_only=True, fn=None), ReprPlan.Field(name='quant"
|
|
2811
|
+
"ization_level', kw_only=True, fn=None)), id=False, terse=False, default_fn=OpRef(name='repr.default_fn'))))"
|
|
2812
|
+
),
|
|
2813
|
+
plan_repr_sha1='6d086e850feb59746e721b8edda1c8a1d7256381',
|
|
2814
|
+
op_ref_idents=(
|
|
2815
|
+
'__dataclass__init__fields__0__annotation',
|
|
2816
|
+
'__dataclass__init__fields__1__annotation',
|
|
2817
|
+
'__dataclass__init__fields__2__annotation',
|
|
2818
|
+
'__dataclass__init__fields__3__annotation',
|
|
2819
|
+
'__dataclass__init__fields__4__annotation',
|
|
2820
|
+
'__dataclass__init__fields__5__annotation',
|
|
2821
|
+
'__dataclass__repr__default_fn',
|
|
2822
|
+
),
|
|
2823
|
+
cls_names=(
|
|
2824
|
+
('ommlds.backends.ollama.protocol', 'ModelDetails'),
|
|
2825
|
+
),
|
|
2826
|
+
)
|
|
2827
|
+
def _process_dataclass__6d086e850feb59746e721b8edda1c8a1d7256381():
|
|
2828
|
+
def _process_dataclass(
|
|
2829
|
+
*,
|
|
2830
|
+
__dataclass__cls,
|
|
2831
|
+
__dataclass__init__fields__0__annotation,
|
|
2832
|
+
__dataclass__init__fields__1__annotation,
|
|
2833
|
+
__dataclass__init__fields__2__annotation,
|
|
2834
|
+
__dataclass__init__fields__3__annotation,
|
|
2835
|
+
__dataclass__init__fields__4__annotation,
|
|
2836
|
+
__dataclass__init__fields__5__annotation,
|
|
2837
|
+
__dataclass__repr__default_fn,
|
|
2838
|
+
__dataclass__FieldFnValidationError, # noqa
|
|
2839
|
+
__dataclass__FieldTypeValidationError, # noqa
|
|
2840
|
+
__dataclass__FnValidationError, # noqa
|
|
2841
|
+
__dataclass__FrozenInstanceError=dataclasses.FrozenInstanceError, # noqa
|
|
2842
|
+
__dataclass__FunctionType=types.FunctionType, # noqa
|
|
2843
|
+
__dataclass__HAS_DEFAULT_FACTORY=dataclasses._HAS_DEFAULT_FACTORY, # noqa
|
|
2844
|
+
__dataclass__MISSING=dataclasses.MISSING, # noqa
|
|
2845
|
+
__dataclass__None=None, # noqa
|
|
2846
|
+
__dataclass__TypeError=TypeError, # noqa
|
|
2847
|
+
__dataclass___recursive_repr=reprlib.recursive_repr, # noqa
|
|
2848
|
+
__dataclass__isinstance=isinstance, # noqa
|
|
2849
|
+
__dataclass__object_setattr=object.__setattr__, # noqa
|
|
2850
|
+
__dataclass__property=property, # noqa
|
|
2851
|
+
):
|
|
2852
|
+
def __copy__(self):
|
|
2853
|
+
if self.__class__ is not __dataclass__cls:
|
|
2854
|
+
raise TypeError(self)
|
|
2855
|
+
return __dataclass__cls( # noqa
|
|
2856
|
+
parent_model=self.parent_model,
|
|
2857
|
+
format=self.format,
|
|
2858
|
+
family=self.family,
|
|
2859
|
+
families=self.families,
|
|
2860
|
+
parameter_size=self.parameter_size,
|
|
2861
|
+
quantization_level=self.quantization_level,
|
|
2862
|
+
)
|
|
2863
|
+
|
|
2864
|
+
__copy__.__qualname__ = f"{__dataclass__cls.__qualname__}.__copy__"
|
|
2865
|
+
if '__copy__' in __dataclass__cls.__dict__:
|
|
2866
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __copy__ in class {__dataclass__cls.__name__}")
|
|
2867
|
+
setattr(__dataclass__cls, '__copy__', __copy__)
|
|
2868
|
+
|
|
2869
|
+
def __eq__(self, other):
|
|
2870
|
+
if self is other:
|
|
2871
|
+
return True
|
|
2872
|
+
if self.__class__ is not other.__class__:
|
|
2873
|
+
return NotImplemented
|
|
2874
|
+
return (
|
|
2875
|
+
self.parent_model == other.parent_model and
|
|
2876
|
+
self.format == other.format and
|
|
2877
|
+
self.family == other.family and
|
|
2878
|
+
self.families == other.families and
|
|
2879
|
+
self.parameter_size == other.parameter_size and
|
|
2880
|
+
self.quantization_level == other.quantization_level
|
|
2881
|
+
)
|
|
2882
|
+
|
|
2883
|
+
__eq__.__qualname__ = f"{__dataclass__cls.__qualname__}.__eq__"
|
|
2884
|
+
if '__eq__' in __dataclass__cls.__dict__:
|
|
2885
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __eq__ in class {__dataclass__cls.__name__}")
|
|
2886
|
+
setattr(__dataclass__cls, '__eq__', __eq__)
|
|
2887
|
+
|
|
2888
|
+
__dataclass___setattr_frozen_fields = {
|
|
2889
|
+
'parent_model',
|
|
2890
|
+
'format',
|
|
2891
|
+
'family',
|
|
2892
|
+
'families',
|
|
2893
|
+
'parameter_size',
|
|
2894
|
+
'quantization_level',
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
def __setattr__(self, name, value):
|
|
2898
|
+
if (
|
|
2899
|
+
type(self) is __dataclass__cls
|
|
2900
|
+
or name in __dataclass___setattr_frozen_fields
|
|
2901
|
+
):
|
|
2902
|
+
raise __dataclass__FrozenInstanceError(f"cannot assign to field {name!r}")
|
|
2903
|
+
super(__dataclass__cls, self).__setattr__(name, value)
|
|
2904
|
+
|
|
2905
|
+
__setattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__setattr__"
|
|
2906
|
+
if '__setattr__' in __dataclass__cls.__dict__:
|
|
2907
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __setattr__ in class {__dataclass__cls.__name__}")
|
|
2908
|
+
setattr(__dataclass__cls, '__setattr__', __setattr__)
|
|
2909
|
+
|
|
2910
|
+
__dataclass___delattr_frozen_fields = {
|
|
2911
|
+
'parent_model',
|
|
2912
|
+
'format',
|
|
2913
|
+
'family',
|
|
2914
|
+
'families',
|
|
2915
|
+
'parameter_size',
|
|
2916
|
+
'quantization_level',
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
def __delattr__(self, name):
|
|
2920
|
+
if (
|
|
2921
|
+
type(self) is __dataclass__cls
|
|
2922
|
+
or name in __dataclass___delattr_frozen_fields
|
|
2923
|
+
):
|
|
2924
|
+
raise __dataclass__FrozenInstanceError(f"cannot delete field {name!r}")
|
|
2925
|
+
super(__dataclass__cls, self).__delattr__(name)
|
|
2926
|
+
|
|
2927
|
+
__delattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__delattr__"
|
|
2928
|
+
if '__delattr__' in __dataclass__cls.__dict__:
|
|
2929
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __delattr__ in class {__dataclass__cls.__name__}")
|
|
2930
|
+
setattr(__dataclass__cls, '__delattr__', __delattr__)
|
|
2931
|
+
|
|
2932
|
+
def __hash__(self):
|
|
2933
|
+
return hash((
|
|
2934
|
+
self.parent_model,
|
|
2935
|
+
self.format,
|
|
2936
|
+
self.family,
|
|
2937
|
+
self.families,
|
|
2938
|
+
self.parameter_size,
|
|
2939
|
+
self.quantization_level,
|
|
2940
|
+
))
|
|
2941
|
+
|
|
2942
|
+
__hash__.__qualname__ = f"{__dataclass__cls.__qualname__}.__hash__"
|
|
2943
|
+
setattr(__dataclass__cls, '__hash__', __hash__)
|
|
2944
|
+
|
|
2945
|
+
def __init__(
|
|
2946
|
+
self,
|
|
2947
|
+
*,
|
|
2948
|
+
parent_model: __dataclass__init__fields__0__annotation,
|
|
2949
|
+
format: __dataclass__init__fields__1__annotation,
|
|
2950
|
+
family: __dataclass__init__fields__2__annotation,
|
|
2951
|
+
families: __dataclass__init__fields__3__annotation,
|
|
2952
|
+
parameter_size: __dataclass__init__fields__4__annotation,
|
|
2953
|
+
quantization_level: __dataclass__init__fields__5__annotation,
|
|
2954
|
+
) -> __dataclass__None:
|
|
2955
|
+
__dataclass__object_setattr(self, 'parent_model', parent_model)
|
|
2956
|
+
__dataclass__object_setattr(self, 'format', format)
|
|
2957
|
+
__dataclass__object_setattr(self, 'family', family)
|
|
2958
|
+
__dataclass__object_setattr(self, 'families', families)
|
|
2959
|
+
__dataclass__object_setattr(self, 'parameter_size', parameter_size)
|
|
2960
|
+
__dataclass__object_setattr(self, 'quantization_level', quantization_level)
|
|
2961
|
+
|
|
2962
|
+
__init__.__qualname__ = f"{__dataclass__cls.__qualname__}.__init__"
|
|
2963
|
+
if '__init__' in __dataclass__cls.__dict__:
|
|
2964
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __init__ in class {__dataclass__cls.__name__}")
|
|
2965
|
+
setattr(__dataclass__cls, '__init__', __init__)
|
|
2966
|
+
|
|
2967
|
+
@__dataclass___recursive_repr()
|
|
2968
|
+
def __repr__(self):
|
|
2969
|
+
parts = []
|
|
2970
|
+
if (s := __dataclass__repr__default_fn(self.parent_model)) is not None:
|
|
2971
|
+
parts.append(f"parent_model={s}")
|
|
2972
|
+
if (s := __dataclass__repr__default_fn(self.format)) is not None:
|
|
2973
|
+
parts.append(f"format={s}")
|
|
2974
|
+
if (s := __dataclass__repr__default_fn(self.family)) is not None:
|
|
2975
|
+
parts.append(f"family={s}")
|
|
2976
|
+
if (s := __dataclass__repr__default_fn(self.families)) is not None:
|
|
2977
|
+
parts.append(f"families={s}")
|
|
2978
|
+
if (s := __dataclass__repr__default_fn(self.parameter_size)) is not None:
|
|
2979
|
+
parts.append(f"parameter_size={s}")
|
|
2980
|
+
if (s := __dataclass__repr__default_fn(self.quantization_level)) is not None:
|
|
2981
|
+
parts.append(f"quantization_level={s}")
|
|
2982
|
+
return (
|
|
2983
|
+
f"{self.__class__.__qualname__}("
|
|
2984
|
+
f"{', '.join(parts)}"
|
|
2985
|
+
f")"
|
|
2986
|
+
)
|
|
2987
|
+
|
|
2988
|
+
__repr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__repr__"
|
|
2989
|
+
if '__repr__' in __dataclass__cls.__dict__:
|
|
2990
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __repr__ in class {__dataclass__cls.__name__}")
|
|
2991
|
+
setattr(__dataclass__cls, '__repr__', __repr__)
|
|
2992
|
+
|
|
2993
|
+
return _process_dataclass
|
|
2994
|
+
|
|
2995
|
+
|
|
2544
2996
|
@_register(
|
|
2545
2997
|
plan_repr=(
|
|
2546
2998
|
"Plans(tup=(CopyPlan(fields=('numa', 'num_ctx', 'num_batch', 'num_gpu', 'main_gpu', 'low_vram', 'f16_kv', 'logi"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from omdev.cli import CliModule
|
|
2
|
+
from omlish import check
|
|
3
|
+
from omlish.argparse import all as ap
|
|
4
|
+
from omlish.formats import json
|
|
5
|
+
from omlish.http import all as http
|
|
6
|
+
from omlish.logs import all as logs
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
log = logs.get_module_logger(globals())
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Cli(ap.Cli):
|
|
16
|
+
@ap.cmd()
|
|
17
|
+
def list(self) -> None:
|
|
18
|
+
resp = http.request('http://localhost:11434/api/tags', check=True)
|
|
19
|
+
data = json.loads(check.not_none(resp.data).decode('utf-8'))
|
|
20
|
+
print(json.dumps_pretty(data))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _main() -> None:
|
|
27
|
+
logs.configure_standard_logging('INFO')
|
|
28
|
+
Cli()()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# @omlish-manifest
|
|
32
|
+
_CLI_MODULE = CliModule('ollama', __name__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == '__main__':
|
|
36
|
+
_main()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
https://docs.ollama.com/api
|
|
3
3
|
"""
|
|
4
|
+
import datetime
|
|
4
5
|
import typing as ta
|
|
5
6
|
|
|
6
7
|
from omlish import dataclasses as dc
|
|
@@ -11,7 +12,7 @@ from omlish import lang
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
14
|
-
@dc.extra_class_params(default_repr_fn=
|
|
15
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
15
16
|
class Options:
|
|
16
17
|
# loading
|
|
17
18
|
numa: bool | None = None
|
|
@@ -72,7 +73,7 @@ class BaseGenerateRequest(BaseStreamableRequest, lang.Abstract):
|
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
75
|
-
@dc.extra_class_params(default_repr_fn=
|
|
76
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
76
77
|
class GenerateRequest(BaseGenerateRequest):
|
|
77
78
|
prompt: str | None = None
|
|
78
79
|
suffix: str | None = None
|
|
@@ -102,7 +103,7 @@ class BaseGenerateResponse(lang.Abstract):
|
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
105
|
-
@dc.extra_class_params(default_repr_fn=
|
|
106
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
106
107
|
class GenerateResponse(BaseGenerateResponse):
|
|
107
108
|
response: str
|
|
108
109
|
thinking: str | None = None
|
|
@@ -121,7 +122,7 @@ Role: ta.TypeAlias = ta.Literal[
|
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
124
|
-
@dc.extra_class_params(default_repr_fn=
|
|
125
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
125
126
|
class Message:
|
|
126
127
|
role: Role
|
|
127
128
|
content: str | None = None
|
|
@@ -145,12 +146,12 @@ class Message:
|
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
148
|
-
@dc.extra_class_params(default_repr_fn=
|
|
149
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
149
150
|
class Tool:
|
|
150
151
|
type: str | None = 'function'
|
|
151
152
|
|
|
152
153
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
153
|
-
@dc.extra_class_params(default_repr_fn=
|
|
154
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
154
155
|
class Function:
|
|
155
156
|
name: str | None = None
|
|
156
157
|
description: str | None = None
|
|
@@ -160,7 +161,7 @@ class Tool:
|
|
|
160
161
|
|
|
161
162
|
|
|
162
163
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
163
|
-
@dc.extra_class_params(default_repr_fn=
|
|
164
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
164
165
|
class ChatRequest(BaseGenerateRequest):
|
|
165
166
|
messages: ta.Sequence[Message] | None = None
|
|
166
167
|
tools: ta.Sequence[Tool] | None = None
|
|
@@ -168,6 +169,33 @@ class ChatRequest(BaseGenerateRequest):
|
|
|
168
169
|
|
|
169
170
|
|
|
170
171
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
171
|
-
@dc.extra_class_params(default_repr_fn=
|
|
172
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
172
173
|
class ChatResponse(BaseGenerateResponse):
|
|
173
174
|
message: Message
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
|
181
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
182
|
+
class ModelDetails:
|
|
183
|
+
parent_model: str
|
|
184
|
+
format: str
|
|
185
|
+
family: str
|
|
186
|
+
families: ta.Sequence[str]
|
|
187
|
+
parameter_size: str
|
|
188
|
+
quantization_level: str
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
|
192
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
193
|
+
class ListModelResponse:
|
|
194
|
+
name: str
|
|
195
|
+
model: str
|
|
196
|
+
remote_model: str | None = None
|
|
197
|
+
remote_host: str | None = None
|
|
198
|
+
modified_at: datetime.datetime
|
|
199
|
+
size: int
|
|
200
|
+
digest: str
|
|
201
|
+
details: ModelDetails | None = None
|
|
@@ -6,12 +6,10 @@ from omlish import marshal as msh
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def _set_class_marshal_options(cls):
|
|
9
|
-
msh.
|
|
9
|
+
msh.update_object_options(
|
|
10
10
|
cls,
|
|
11
|
-
field_defaults=msh.
|
|
12
|
-
|
|
13
|
-
omit_if=lang.is_none,
|
|
14
|
-
),
|
|
11
|
+
field_defaults=msh.FieldOptions(
|
|
12
|
+
omit_if=lang.is_none,
|
|
15
13
|
),
|
|
16
14
|
)
|
|
17
15
|
|
|
@@ -12,12 +12,10 @@ from omlish import marshal as msh
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def _set_class_marshal_options(cls):
|
|
15
|
-
msh.
|
|
15
|
+
msh.update_object_options(
|
|
16
16
|
cls,
|
|
17
|
-
field_defaults=msh.
|
|
18
|
-
|
|
19
|
-
omit_if=lang.is_none,
|
|
20
|
-
),
|
|
17
|
+
field_defaults=msh.FieldOptions(
|
|
18
|
+
omit_if=lang.is_none,
|
|
21
19
|
),
|
|
22
20
|
)
|
|
23
21
|
|
|
@@ -33,7 +33,7 @@ class MemoryStats:
|
|
|
33
33
|
|
|
34
34
|
@dc.dataclass(frozen=True, kw_only=True)
|
|
35
35
|
class AggregateMemoryStats(MemoryStats):
|
|
36
|
-
by_device: ta.Mapping[ta.Any, MemoryStats] | None = dc.xfield(repr_fn=
|
|
36
|
+
by_device: ta.Mapping[ta.Any, MemoryStats] | None = dc.xfield(repr_fn=lang.opt_repr)
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
##
|
ommlds/minichain/_typedvalues.py
CHANGED
|
@@ -75,11 +75,11 @@ def _tv_field_metadata(
|
|
|
75
75
|
repr_fn=_tv_field_repr,
|
|
76
76
|
),
|
|
77
77
|
|
|
78
|
-
msh.
|
|
78
|
+
msh.FieldOptions: msh.FieldOptions(
|
|
79
79
|
name=marshal_name,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
|
|
81
|
+
omit_if=operator.not_,
|
|
82
|
+
|
|
83
83
|
marshaler_factory=msh.FuncMarshalerFactory(
|
|
84
84
|
lambda ctx, rty: _marshal._TypedValuesFieldMarshalerFactory(tvs_rty).make_marshaler(ctx, rty), # noqa
|
|
85
85
|
),
|