refacto(admin): Remove ModelProviderGateway - #972
Open
bakr-a wants to merge 18 commits into
Open
Conversation
Extract provider capability-fetching (formerly ModelProviderGateway) into a shared module-level function in the use-case layer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ilities Replace the removed provider_gateway dependency in CreateProviderUseCase and BootstrapModelsUseCase with calls to the shared get_provider_capabilities helper, injecting provider_client and provider_adapter_builder instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the deleted ModelProviderGateway/ProviderGateway references: inject provider_client and provider_adapter_builder into the create-provider factory, and drop ProviderGateway from the provider domain package exports. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Relocate the ProviderCapabilities value object from the now-empty _providergateway module into entities.py (as a BaseModel, matching the other domain types) and delete _providergateway.py. Update importers to api.domain.provider.entities. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…f shared module in use-cases
Move the get_provider_capabilities use-case helper into a ProviderCapabilitiesRepository domain class and inject it where it's needed. - add ProviderCapabilitiesRepository under api/domain/provider, exposing get_provider_capabilities plus its context-length / vector-size helpers - wire it as a dependency and delegate from CreateProviderUseCase and BootstrapModelsUseCase, dropping their direct ProviderClient / ProviderAdapterBuilder dependencies - build it explicitly in the bootstrap_models lifespan hook - remove the now-unused api/use_cases/provider package Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- migrate the ModelProviderGateway integration test to ProviderCapabilitiesRepository under tests/integration/http - import ProviderClient / adapter classes from their submodules to break the circular import introduced by moving the repository into the provider package Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ository - move the orphaned ModelProviderGateway unit test to tests/unit/domain/provider, renaming symbols to ProviderCapabilitiesRepository - make _get_max_context_length / _get_vector_size instance methods that read self.provider_client, dropping the redundant argument threading Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Resolves #921.
Removes the
ModelProviderGatewayabstraction and replaces it with aProviderCapabilitiesRepositorythat lives in theproviderdomain package.What was done:
ProviderCapabilitiesRepositoryunderapi/domain/provider, exposingget_provider_capabilitiesProviderCapabilitiesdataclass intoprovider/entities.py.ModelProviderGatewayand the oldProviderGatewaydomain class, and dropped them from wiring / domain exports.CreateProviderUseCaseandBootstrapModelsUseCaseModelNotFoundErrorhandling inCreateProviderUseCase: it now maps to a 404 at the endpoint, matchingBootstrapModelsUseCaseDefinition of Done:
ModelProviderGateway/ProviderGatewayfully removed from the codebaseProviderCapabilitiesRepositoryCreateProviderUseCasehandlesModelNotFoundError(404) like bootstrapBreaking changes:
Check lists
Review checklist
user-facing or API documentation impact
If
api/sql/models.pyhas been modified, please confirm that the following steps have been completed:models.pynot modifiedDeployment checklist
No new environment variables and no special deployment steps required.