inferencesh 0.1.17__py3-none-any.whl → 0.1.19__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/sdk.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from typing import Optional, Union, ClassVar
2
- from pydantic import BaseModel, ConfigDict, PrivateAttr
2
+ from pydantic import BaseModel, ConfigDict, PrivateAttr, model_validator
3
3
  import mimetypes
4
4
  import os
5
5
  import urllib.request
@@ -101,7 +101,7 @@ class BaseApp(BaseModel):
101
101
 
102
102
  class File(BaseModel):
103
103
  """A class representing a file in the inference.sh ecosystem."""
104
- uri: str # Original location (URL or file path)
104
+ uri: Optional[str] = None # Original location (URL or file path)
105
105
  path: Optional[str] = None # Resolved local file path
106
106
  content_type: Optional[str] = None # MIME type of the file
107
107
  size: Optional[int] = None # File size in bytes
@@ -113,12 +113,19 @@ class File(BaseModel):
113
113
  populate_by_name=True
114
114
  )
115
115
 
116
+ @model_validator(mode='after')
117
+ def check_uri_or_path(self) -> 'File':
118
+ """Validate that either uri or path is provided."""
119
+ if not self.uri and not self.path:
120
+ raise ValueError("Either 'uri' or 'path' must be provided")
121
+ return self
122
+
116
123
  def model_post_init(self, _: Any) -> None:
117
- if self._is_url(self.uri):
124
+ if self.uri and self._is_url(self.uri):
118
125
  self._download_url()
119
- elif not os.path.isabs(self.uri):
126
+ elif self.uri and not os.path.isabs(self.uri):
120
127
  self.path = os.path.abspath(self.uri)
121
- else:
128
+ elif self.uri:
122
129
  self.path = self.uri
123
130
  self._populate_metadata()
124
131
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: inferencesh
3
- Version: 0.1.17
3
+ Version: 0.1.19
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -0,0 +1,8 @@
1
+ inferencesh/__init__.py,sha256=pR0MXSJe41LgJkjGK-jhZR7LjqCFdRZtNTV6qcjYSTI,123
2
+ inferencesh/sdk.py,sha256=fcFYIy82rh7rY8V0tsippm2vks8EHtd_Lu22VXKorj4,8210
3
+ inferencesh-0.1.19.dist-info/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
4
+ inferencesh-0.1.19.dist-info/METADATA,sha256=HOxzFwACm0dpR2ne6-PURmWDhJSXfcscnAufbGCp4FA,2590
5
+ inferencesh-0.1.19.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
6
+ inferencesh-0.1.19.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
7
+ inferencesh-0.1.19.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
8
+ inferencesh-0.1.19.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- inferencesh/__init__.py,sha256=pR0MXSJe41LgJkjGK-jhZR7LjqCFdRZtNTV6qcjYSTI,123
2
- inferencesh/sdk.py,sha256=Hc7VAwIVbk0IgP2ZWplnPwHZukFaNuBNqhR92CRHsV4,7867
3
- inferencesh-0.1.17.dist-info/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
4
- inferencesh-0.1.17.dist-info/METADATA,sha256=xtmh0tAiPy_OIP8CXcHXs2kYwdWVJTv99ZGi7GVuA3U,2590
5
- inferencesh-0.1.17.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
6
- inferencesh-0.1.17.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
7
- inferencesh-0.1.17.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
8
- inferencesh-0.1.17.dist-info/RECORD,,