Skip to content

Raise the right error for unknown model providers - #374

Open
anbuzin wants to merge 1 commit into
mainfrom
fix-unknown-provider-error
Open

anbuzin wants to merge 1 commit into
mainfrom
fix-unknown-provider-error

Conversation

@anbuzin

@anbuzin anbuzin commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

ai.get_model("ollama:llama3") gave you a blank AssertionError instead of the documented UnsupportedProviderError. Now you can catch ai.UnsupportedProviderError and read the unknown prefix from exc.provider_id.

try:
    ai.get_model("ollama:llama3")  # before: a blank AssertionError escapes
except ai.UnsupportedProviderError as exc:
    print(exc.provider_id)  # after: ollama

Replace the provider assertion in get_model with
UnsupportedProviderError. Include the unrecognized prefix in the error,
as the public contract already promises. Cover unknown and unsupported
provider prefixes.
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ai-python Ready Ready Preview, v0 Nov 20, 2026 12:09am UTC

This branch was successfully deployed

1 active deployment
Preview — 3c11876f Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant