inferencesh 0.4.9__py3-none-any.whl → 0.4.11__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 inferencesh might be problematic. Click here for more details.
- inferencesh/models/file.py +30 -20
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/METADATA +1 -1
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/RECORD +7 -7
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/WHEEL +0 -0
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/entry_points.txt +0 -0
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/licenses/LICENSE +0 -0
- {inferencesh-0.4.9.dist-info → inferencesh-0.4.11.dist-info}/top_level.txt +0 -0
inferencesh/models/file.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
from typing import Optional, Union, Any
|
|
2
|
-
from pydantic import BaseModel, Field, PrivateAttr, model_validator
|
|
1
|
+
from typing import Optional, Union, Any, Type
|
|
2
|
+
from pydantic import BaseModel, Field, PrivateAttr, model_validator, GetCoreSchemaHandler, GetJsonSchemaHandler
|
|
3
|
+
from pydantic_core import CoreSchema, core_schema
|
|
3
4
|
import mimetypes
|
|
4
5
|
import os
|
|
5
6
|
import urllib.request
|
|
@@ -7,9 +8,9 @@ import urllib.parse
|
|
|
7
8
|
import hashlib
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from tqdm import tqdm
|
|
10
|
-
from pydantic_core import core_schema
|
|
11
|
-
from pydantic_core.core_schema import GetJsonSchemaHandler, JsonSchemaValue
|
|
12
11
|
|
|
12
|
+
from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler
|
|
13
|
+
from pydantic_core import CoreSchema, core_schema
|
|
13
14
|
|
|
14
15
|
class File(BaseModel):
|
|
15
16
|
"""A class representing a file in the inference.sh ecosystem."""
|
|
@@ -239,26 +240,35 @@ class File(BaseModel):
|
|
|
239
240
|
self.filename = self._get_filename()
|
|
240
241
|
|
|
241
242
|
@classmethod
|
|
242
|
-
def
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
{"type": "string"}, # Accept string input
|
|
249
|
-
schema # Accept full object input
|
|
250
|
-
]
|
|
251
|
-
}
|
|
243
|
+
def __get_pydantic_core_schema__(
|
|
244
|
+
cls, source: Type[Any], handler: GetCoreSchemaHandler
|
|
245
|
+
) -> CoreSchema:
|
|
246
|
+
"""Generates a Pydantic Core schema for validation of this File class"""
|
|
247
|
+
# Get the default schema for our class
|
|
248
|
+
schema = handler(source)
|
|
252
249
|
|
|
250
|
+
return core_schema.json_or_python_schema(
|
|
251
|
+
json_schema=core_schema.union_schema([
|
|
252
|
+
core_schema.str_schema(), # Accept string input
|
|
253
|
+
schema, # Accept full object input
|
|
254
|
+
]),
|
|
255
|
+
python_schema=schema,
|
|
256
|
+
serialization=schema.get("serialization", {}),
|
|
257
|
+
)
|
|
258
|
+
|
|
253
259
|
@classmethod
|
|
254
260
|
def __get_pydantic_json_schema__(
|
|
255
|
-
cls,
|
|
256
|
-
) ->
|
|
257
|
-
schema
|
|
258
|
-
|
|
261
|
+
cls, schema: CoreSchema, handler: GetJsonSchemaHandler
|
|
262
|
+
) -> dict[str, Any]:
|
|
263
|
+
"""Customizes the JSON schema generation for this File class"""
|
|
264
|
+
json_schema = handler(schema)
|
|
265
|
+
json_schema = handler.resolve_ref_schema(json_schema)
|
|
266
|
+
json_schema.update({
|
|
267
|
+
"$id": "/schemas/File",
|
|
259
268
|
"oneOf": [
|
|
260
269
|
{"type": "string"},
|
|
261
|
-
|
|
270
|
+
json_schema
|
|
262
271
|
]
|
|
263
|
-
}
|
|
272
|
+
})
|
|
273
|
+
return json_schema
|
|
264
274
|
|
|
@@ -2,14 +2,14 @@ inferencesh/__init__.py,sha256=dY3l3yCkWoMtGX0gNXgxFnrprFRl6PPWjH8V7Qedx5g,772
|
|
|
2
2
|
inferencesh/client.py,sha256=6wTCLqLq-QapvjCjMg8ZE3BQyg8iTL8hv8UU7t-oxmE,39360
|
|
3
3
|
inferencesh/models/__init__.py,sha256=FDwcdtT6c4hbRitymjmN-hZMlQa8RbKSftkZZyjtUXA,536
|
|
4
4
|
inferencesh/models/base.py,sha256=eTwRvXAjMGh6b8AUXWKSGpRyeScAkPs6bNYY8AXKSz8,5505
|
|
5
|
-
inferencesh/models/file.py,sha256
|
|
5
|
+
inferencesh/models/file.py,sha256=ACqWkw97XLI5m0l3inJBd63fSmNqKhe3K8PXeZyDu5Q,11357
|
|
6
6
|
inferencesh/models/llm.py,sha256=FPkTqVkH4mdKxUEdDVNimaPEr_mkpGofX7qTK4G1IHo,27873
|
|
7
7
|
inferencesh/utils/__init__.py,sha256=-xiD6uo2XzcrPAWFb_fUbaimmnW4KFKc-8IvBzaxNd4,148
|
|
8
8
|
inferencesh/utils/download.py,sha256=DRGBudiPVa5bDS35KfR-DYeGRk7gO03WOelnisecwMo,1815
|
|
9
9
|
inferencesh/utils/storage.py,sha256=E4J8emd4eFKdmdDgAqzz3TpaaDd3n0l8gYlMHuY8yIU,519
|
|
10
|
-
inferencesh-0.4.
|
|
11
|
-
inferencesh-0.4.
|
|
12
|
-
inferencesh-0.4.
|
|
13
|
-
inferencesh-0.4.
|
|
14
|
-
inferencesh-0.4.
|
|
15
|
-
inferencesh-0.4.
|
|
10
|
+
inferencesh-0.4.11.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
11
|
+
inferencesh-0.4.11.dist-info/METADATA,sha256=LK2Az16XQWlaMMFjrvpqVYggrJRn-XYlaC6afN4ks9s,5406
|
|
12
|
+
inferencesh-0.4.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
inferencesh-0.4.11.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
14
|
+
inferencesh-0.4.11.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
15
|
+
inferencesh-0.4.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|