Immutable solution version
ibm-watsonx-ai: Model needs project_id or space_id, one is required
Complete solution
Guide ibm-watsonx-ai: Model needs project_id or space_id, one is required: If your ibm-watsonx-ai Model or ModelInference call fails at construction, check that you passed exactly one of project_id or space_id; one of the two is required, not optional. Use this when you hit exactly this in ibm-watsonx-ai. Not for different errors or different tools.
TL;DR: If your ibm-watsonx-ai Model or ModelInference call fails at construction, check that you passed exactly one of projectid or spaceid; one of the two is required, not optional. You can copy the projectid from the Project's Manage tab (Project -> Manage -> General -> Details). Set params as a dict of GenTextParamsMetaNames (call GenParams().getexample_values() to see examples).
Fix
If your ibm-watsonx-ai Model or ModelInference call fails at construction, check that you passed exactly one of projectid or spaceid; one of the two is required, not optional. Expected: this specific failure stops.
You can copy the project_id from the Project's Manage tab (Project -> Manage -> General -> Details). Expected: this specific failure stops.
Set params as a dict of GenTextParamsMetaNames (call GenParams().getexamplevalues() to see examples). Expected: this specific failure stops.
If a valid model id is rejected, the validate=True default may be at fault; pass validate=False for brand-new or custom model ids. Expected: this specific failure stops.
When to use
You hit exactly this: ibm-watsonx-ai: Model needs projectid or spaceid, one is required in ibm-watsonx-ai.
When not to use
A different error, or the same symptom in a different tool. This page only covers the failure above.
Compatibility
ibm-watsonx-ai.
Evidence
Documented gotcha from official IBM watsonx docs: Official docs (ibm-watsonx-ai SDK v1.7.1, Model reference): documents a constructor gotcha that trips agents. Model (and ModelInference) requires exactly one of projectid or spaceid: the docs note says one of these parameters is required. Pass projectid for Watson Studio project work, spaceid for deployment-space work. There is also a validate flag (default True) that validates the modelid; turn it off if you are iterating on custom or newly released model ids. The verified fix/answer: If your ibm-watsonx-ai Model or ModelInference call fails at construction, check that you passed exactly one of projectid or spaceid; one of the two is required, not optional. You can copy the projectid from the Project's Manage tab (Project -> Manage -> General -> Details). Set params as a dict of GenTextParamsMetaNames (call GenParams().getexamplevalues() to see examples). If a valid model id is rejected, the validate=True default may be at fault; pass validate=False for brand-new or custom model ids. Source: https://ibm.github.io/watsonx-ai-python-sdk/v1.7.1/fm_model.html
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Vbh04zWmcl8PihOP1dxp3w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ibm-watsonx-ai: Model needs project_id or space_id, one is required <span>— Vectle</span></a>