pepijn223 HF Staff commited on
Commit
76405c8
·
verified ·
1 Parent(s): 46a15a1

Report measured usage costs and link completed runs to the annotation viewer

Browse files
Files changed (2) hide show
  1. studio.py +6 -1
  2. test_studio.py +6 -1
studio.py CHANGED
@@ -328,7 +328,12 @@ def launch(plan, output, budget, acknowledged, token, space=None, api_factory=Hf
328
  mapping = api.model_info(
329
  MODEL.split(":")[0], expand=["inferenceProviderMapping"]
330
  ).inference_provider_mapping
331
- if not mapping or mapping.get("featherless-ai") is None or mapping["featherless-ai"].status != "live":
 
 
 
 
 
332
  raise ValueError("Qwen3.8 is temporarily unavailable from this provider.")
333
  space = space or os.environ.get("SPACE_ID")
334
  if not space:
 
328
  mapping = api.model_info(
329
  MODEL.split(":")[0], expand=["inferenceProviderMapping"]
330
  ).inference_provider_mapping
331
+ hosted = (
332
+ mapping.get("featherless-ai")
333
+ if isinstance(mapping, dict)
334
+ else next((item for item in mapping or [] if item.provider == "featherless-ai"), None)
335
+ )
336
+ if hosted is None or hosted.status != "live":
337
  raise ValueError("Qwen3.8 is temporarily unavailable from this provider.")
338
  space = space or os.environ.get("SPACE_ID")
339
  if not space:
test_studio.py CHANGED
@@ -193,8 +193,13 @@ def test_budget_unknown_failure_is_never_refunded():
193
  budget.reserve(4096)
194
 
195
 
196
- def test_launch_identity_secret_and_immutable_manifest():
 
197
  api = api_mock()
 
 
 
 
198
  configured = plan()
199
  configured["prompts"] = {"plan_subtasks": "custom instructions preserved verbatim"}
200
  result = studio.launch(
 
193
  budget.reserve(4096)
194
 
195
 
196
+ @pytest.mark.parametrize("mapping_format", ["dict", "list"])
197
+ def test_launch_identity_secret_and_immutable_manifest(mapping_format):
198
  api = api_mock()
199
+ if mapping_format == "list":
200
+ api.model_info.return_value.inference_provider_mapping = [
201
+ SimpleNamespace(provider="featherless-ai", status="live")
202
+ ]
203
  configured = plan()
204
  configured["prompts"] = {"plan_subtasks": "custom instructions preserved verbatim"}
205
  result = studio.launch(