-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow custom provider factory to be passed into infer_model
#3341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slkoo-cc Thanks, I like that this diff is a lot smaller :) Can you add a test please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slkoo-cc Thanks, I like that this diff is a lot smaller :) Can you add a test please?
Co-authored-by: Douwe Maan <[email protected]>
infer_model
| def infer_model( # noqa: C901 | ||
| model: Model | KnownModelName | str, provider_factory: Callable[[str], Provider[Any]] = infer_provider | ||
| ) -> Model: | ||
| """Infer the model from the name. May optionally pass a callable that setup a custom provider for the model.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth clarifying that the factory is passed the provider name, not the model name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the Args:\n... format
Fix #3163 based on feedback in #3185