MCPcopy Index your code
hub / github.com/docker/docker-agent / getProvider

Method getProvider

pkg/modelsdev/store.go:200–214  ·  view source on GitHub ↗

getProvider returns a specific provider by ID. A provider the Store's knownProvider predicate rejects (a user-defined custom provider) is looked up without ever fetching the catalog from the network, so a self-contained custom-provider config keeps working when models.dev is unreachable.

(ctx context.Context, providerID string)

Source from the content-addressed store, hash-verified

198// up without ever fetching the catalog from the network, so a self-contained
199// custom-provider config keeps working when models.dev is unreachable.
200func (s *Store) getProvider(ctx context.Context, providerID string) (*Provider, error) {
201 allowFetch := s.knownProvider == nil || s.knownProvider(providerID)
202
203 db, err := s.getDatabase(ctx, allowFetch)
204 if err != nil {
205 return nil, err
206 }
207
208 provider, exists := db.Providers[providerID]
209 if !exists {
210 return nil, fmt.Errorf("provider %q not found", providerID)
211 }
212
213 return &provider, nil
214}
215
216// GetModel returns a specific model by ID. The ID must carry both a
217// provider and a model component; pass the result of [NewID], [ParseID],

Callers 2

GetModelMethod · 0.95
ResolveModelAliasMethod · 0.95

Calls 1

getDatabaseMethod · 0.95

Tested by

no test coverage detected