inferencesh 0.4.10__tar.gz → 0.4.12__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.

Files changed (22) hide show
  1. {inferencesh-0.4.10/src/inferencesh.egg-info → inferencesh-0.4.12}/PKG-INFO +1 -1
  2. {inferencesh-0.4.10 → inferencesh-0.4.12}/pyproject.toml +1 -1
  3. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/models/file.py +36 -22
  4. {inferencesh-0.4.10 → inferencesh-0.4.12/src/inferencesh.egg-info}/PKG-INFO +1 -1
  5. {inferencesh-0.4.10 → inferencesh-0.4.12}/LICENSE +0 -0
  6. {inferencesh-0.4.10 → inferencesh-0.4.12}/README.md +0 -0
  7. {inferencesh-0.4.10 → inferencesh-0.4.12}/setup.cfg +0 -0
  8. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/__init__.py +0 -0
  9. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/client.py +0 -0
  10. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/models/__init__.py +0 -0
  11. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/models/base.py +0 -0
  12. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/models/llm.py +0 -0
  13. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/utils/__init__.py +0 -0
  14. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/utils/download.py +0 -0
  15. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh/utils/storage.py +0 -0
  16. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh.egg-info/SOURCES.txt +0 -0
  17. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh.egg-info/dependency_links.txt +0 -0
  18. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh.egg-info/entry_points.txt +0 -0
  19. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh.egg-info/requires.txt +0 -0
  20. {inferencesh-0.4.10 → inferencesh-0.4.12}/src/inferencesh.egg-info/top_level.txt +0 -0
  21. {inferencesh-0.4.10 → inferencesh-0.4.12}/tests/test_client.py +0 -0
  22. {inferencesh-0.4.10 → inferencesh-0.4.12}/tests/test_sdk.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.4.10
3
+ Version: 0.4.12
4
4
  Summary: inference.sh Python SDK
5
5
  Author-email: "Inference Shell Inc." <hello@inference.sh>
6
6
  Project-URL: Homepage, https://github.com/inference-sh/sdk
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "inferencesh"
7
- version = "0.4.10"
7
+ version = "0.4.12"
8
8
  description = "inference.sh Python SDK"
9
9
  authors = [
10
10
  {name = "Inference Shell Inc.", email = "hello@inference.sh"},
@@ -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
@@ -8,9 +9,6 @@ import hashlib
8
9
  from pathlib import Path
9
10
  from tqdm import tqdm
10
11
 
11
- from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler, JsonSchemaValue
12
- from pydantic_core import CoreSchema, core_schema
13
-
14
12
  class File(BaseModel):
15
13
  """A class representing a file in the inference.sh ecosystem."""
16
14
 
@@ -238,27 +236,43 @@ class File(BaseModel):
238
236
  self.size = self._get_file_size() # Always update size
239
237
  self.filename = self._get_filename()
240
238
 
241
- @classmethod
242
- def model_json_schema(cls, **kwargs):
243
- schema = super().model_json_schema(**kwargs)
244
- schema["$id"] = "/schemas/File"
245
- # Create a schema that accepts either a string or the full object
246
- return {
247
- "oneOf": [
248
- {"type": "string"}, # Accept string input
249
- schema # Accept full object input
250
- ]
251
- }
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)
252
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
+ # )
253
+
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
+ # )
262
+
253
263
  @classmethod
254
264
  def __get_pydantic_json_schema__(
255
- cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
256
- ) -> JsonSchemaValue:
257
- schema = handler(core_schema) # this is the "normal" schema
258
- return {
265
+ cls, schema: CoreSchema, handler: GetJsonSchemaHandler
266
+ ) -> dict[str, Any]:
267
+ """Customizes the JSON schema generation for this File class"""
268
+ json_schema = handler(schema)
269
+ json_schema = handler.resolve_ref_schema(json_schema)
270
+ json_schema.update({
271
+ "$id": "/schemas/File",
259
272
  "oneOf": [
260
273
  {"type": "string"},
261
- schema
274
+ json_schema
262
275
  ]
263
- }
276
+ })
277
+ return json_schema
264
278
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.4.10
3
+ Version: 0.4.12
4
4
  Summary: inference.sh Python SDK
5
5
  Author-email: "Inference Shell Inc." <hello@inference.sh>
6
6
  Project-URL: Homepage, https://github.com/inference-sh/sdk
File without changes
File without changes
File without changes