MCPcopy
hub / github.com/docker/docker-agent / populateCatalogMetadata

Method populateCatalogMetadata

pkg/runtime/model_switcher.go:707–715  ·  view source on GitHub ↗

populateCatalogMetadata fetches models.dev metadata for the given provider/model pair and copies it onto choice. It silently does nothing when the lookup fails or when the runtime has no models store.

(ctx context.Context, choice *ModelChoice, providerID, modelID string)

Source from the content-addressed store, hash-verified

705// provider/model pair and copies it onto choice. It silently does
706// nothing when the lookup fails or when the runtime has no models store.
707func (r *LocalRuntime) populateCatalogMetadata(ctx context.Context, choice *ModelChoice, providerID, modelID string) {
708 if r.modelsStore == nil {
709 return
710 }
711 m, err := r.modelsStore.GetModel(ctx, modelsdev.NewID(providerID, modelID))
712 if err == nil {
713 applyCatalogMetadata(choice, m)
714 }
715}
716
717// applyCatalogMetadata copies pricing/limit/modality information from a
718// models.dev Model entry onto a ModelChoice.

Callers 1

AvailableModelsMethod · 0.95

Calls 3

NewIDFunction · 0.92
applyCatalogMetadataFunction · 0.85
GetModelMethod · 0.65

Tested by

no test coverage detected