inferencesh 0.4.11__tar.gz → 0.4.13__tar.gz
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-0.4.11/src/inferencesh.egg-info → inferencesh-0.4.13}/PKG-INFO +1 -1
- {inferencesh-0.4.11 → inferencesh-0.4.13}/pyproject.toml +1 -1
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/models/file.py +29 -26
- {inferencesh-0.4.11 → inferencesh-0.4.13/src/inferencesh.egg-info}/PKG-INFO +1 -1
- {inferencesh-0.4.11 → inferencesh-0.4.13}/LICENSE +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/README.md +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/setup.cfg +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/__init__.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/client.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/models/__init__.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/models/base.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/models/llm.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/utils/__init__.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/utils/download.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh/utils/storage.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh.egg-info/SOURCES.txt +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh.egg-info/dependency_links.txt +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh.egg-info/entry_points.txt +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh.egg-info/requires.txt +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/src/inferencesh.egg-info/top_level.txt +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/tests/test_client.py +0 -0
- {inferencesh-0.4.11 → inferencesh-0.4.13}/tests/test_sdk.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from typing import Optional, Union, Any
|
|
2
|
-
from pydantic import BaseModel, Field, PrivateAttr, model_validator,
|
|
3
|
-
from pydantic_core import CoreSchema
|
|
1
|
+
from typing import Optional, Union, Any
|
|
2
|
+
from pydantic import BaseModel, Field, PrivateAttr, model_validator, GetJsonSchemaHandler
|
|
3
|
+
from pydantic_core import CoreSchema
|
|
4
4
|
import mimetypes
|
|
5
5
|
import os
|
|
6
6
|
import urllib.request
|
|
@@ -9,9 +9,6 @@ import hashlib
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from tqdm import tqdm
|
|
11
11
|
|
|
12
|
-
from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler
|
|
13
|
-
from pydantic_core import CoreSchema, core_schema
|
|
14
|
-
|
|
15
12
|
class File(BaseModel):
|
|
16
13
|
"""A class representing a file in the inference.sh ecosystem."""
|
|
17
14
|
|
|
@@ -239,36 +236,42 @@ class File(BaseModel):
|
|
|
239
236
|
self.size = self._get_file_size() # Always update size
|
|
240
237
|
self.filename = self._get_filename()
|
|
241
238
|
|
|
242
|
-
@classmethod
|
|
243
|
-
def __get_pydantic_core_schema__(
|
|
244
|
-
|
|
245
|
-
) -> CoreSchema:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
# @classmethod
|
|
240
|
+
# def __get_pydantic_core_schema__(
|
|
241
|
+
# cls, source: Type[Any], handler: GetCoreSchemaHandler
|
|
242
|
+
# ) -> CoreSchema:
|
|
243
|
+
# """Generates a Pydantic Core schema for validation of this File class"""
|
|
244
|
+
# # Get the default schema for our class
|
|
245
|
+
# schema = handler(source)
|
|
246
|
+
|
|
247
|
+
# # Create a proper serialization schema that includes the type
|
|
248
|
+
# serialization = core_schema.plain_serializer_function_ser_schema(
|
|
249
|
+
# lambda x: x.uri if x.uri else x.path,
|
|
250
|
+
# return_schema=core_schema.str_schema(),
|
|
251
|
+
# when_used="json",
|
|
252
|
+
# )
|
|
249
253
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
254
|
+
# return core_schema.json_or_python_schema(
|
|
255
|
+
# json_schema=core_schema.union_schema([
|
|
256
|
+
# core_schema.str_schema(), # Accept string input
|
|
257
|
+
# schema, # Accept full object input
|
|
258
|
+
# ]),
|
|
259
|
+
# python_schema=schema,
|
|
260
|
+
# serialization=serialization,
|
|
261
|
+
# )
|
|
258
262
|
|
|
259
263
|
@classmethod
|
|
260
264
|
def __get_pydantic_json_schema__(
|
|
261
265
|
cls, schema: CoreSchema, handler: GetJsonSchemaHandler
|
|
262
266
|
) -> dict[str, Any]:
|
|
263
|
-
"""
|
|
267
|
+
"""Generate a simple JSON schema that accepts either a string or an object"""
|
|
264
268
|
json_schema = handler(schema)
|
|
265
|
-
|
|
266
|
-
|
|
269
|
+
# Don't resolve refs here - that's what was causing the recursion
|
|
270
|
+
return {
|
|
267
271
|
"$id": "/schemas/File",
|
|
268
272
|
"oneOf": [
|
|
269
273
|
{"type": "string"},
|
|
270
274
|
json_schema
|
|
271
275
|
]
|
|
272
|
-
}
|
|
273
|
-
return json_schema
|
|
276
|
+
}
|
|
274
277
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|