sference-cli 0.1.3__tar.gz → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sference-cli
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: sference command-line interface
5
5
  Project-URL: Homepage, https://sference.com
6
6
  Project-URL: Repository, https://github.com/s-ference/sference
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
22
  Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
- Requires-Dist: sference-sdk>=0.1.3
24
+ Requires-Dist: sference-sdk>=0.1.4
25
25
  Requires-Dist: typer>=0.24.1
26
26
  Description-Content-Type: text/markdown
27
27
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sference-cli"
3
- version = "0.1.3"
3
+ version = "0.1.4"
4
4
  description = "sference command-line interface"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  ]
24
24
  dependencies = [
25
25
  "typer>=0.24.1",
26
- "sference-sdk>=0.1.3",
26
+ "sference-sdk>=0.1.4",
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -148,7 +148,58 @@ def _print(value: object, as_json: bool) -> None:
148
148
 
149
149
  def _list_models(*, client: SferenceClient, as_json: bool) -> None:
150
150
  payload = _call_api(client.list_models)
151
- typer.echo(json.dumps(payload, indent=None if as_json else 2))
151
+ if as_json:
152
+ typer.echo(json.dumps(payload, indent=2, default=str))
153
+ return
154
+ _print_models_table(payload)
155
+
156
+
157
+ def _capability_flag(caps: object, key: str) -> str:
158
+ if not isinstance(caps, dict):
159
+ return "—"
160
+ entry = caps.get(key)
161
+ if isinstance(entry, dict) and "supported" in entry:
162
+ return "yes" if entry["supported"] else "no"
163
+ return "—"
164
+
165
+
166
+ def _print_models_table(payload: object) -> None:
167
+ if not isinstance(payload, dict):
168
+ typer.echo(str(payload))
169
+ return
170
+ rows = payload.get("data")
171
+ if not isinstance(rows, list):
172
+ typer.echo(json.dumps(payload, indent=2, default=str))
173
+ return
174
+ if not rows:
175
+ typer.echo("No models.")
176
+ return
177
+
178
+ w_id, w_name, w_ctx, w_vis, w_pdf, w_think, w_tools = 34, 18, 8, 6, 4, 8, 5
179
+ typer.echo(
180
+ f"{'id':<{w_id}} {'display_name':<{w_name}} {'context':>{w_ctx}} "
181
+ f"{'vision':>{w_vis}} {'pdf':>{w_pdf}} {'thinking':>{w_think}} {'tools':>{w_tools}}"
182
+ )
183
+ for row in rows:
184
+ if not isinstance(row, dict):
185
+ continue
186
+ model_id = str(row.get("id", ""))
187
+ if len(model_id) > w_id:
188
+ model_id = model_id[: w_id - 3] + "..."
189
+ display_name = str(row.get("display_name") or "")
190
+ if len(display_name) > w_name:
191
+ display_name = display_name[: w_name - 1] + "…"
192
+ ctx_raw = row.get("context_tokens")
193
+ context = str(ctx_raw) if isinstance(ctx_raw, int) else "—"
194
+ caps = row.get("capabilities")
195
+ vision = _capability_flag(caps, "image_input")
196
+ pdf = _capability_flag(caps, "pdf_input")
197
+ thinking = _capability_flag(caps, "thinking")
198
+ tools = _capability_flag(caps, "tools")
199
+ typer.echo(
200
+ f"{model_id:<{w_id}} {display_name:<{w_name}} {context:>{w_ctx}} "
201
+ f"{vision:>{w_vis}} {pdf:>{w_pdf}} {thinking:>{w_think}} {tools:>{w_tools}}"
202
+ )
152
203
 
153
204
 
154
205
  def _window_choice(value: str) -> str:
File without changes
File without changes
File without changes