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

Function resolveFirstAvailableModel

pkg/config/first_available.go:50–65  ·  view source on GitHub ↗
(ctx context.Context, cfg *latest.Config, name string, selectors map[string]bool, modelsGateway string, env environment.Provider)

Source from the content-addressed store, hash-verified

48}
49
50func resolveFirstAvailableModel(ctx context.Context, cfg *latest.Config, name string, selectors map[string]bool, modelsGateway string, env environment.Provider) error {
51 m := cfg.Models[name]
52 chosen, ref, err := selectFirstAvailable(ctx, cfg, m.FirstAvailable, selectors, modelsGateway, env)
53 if err != nil {
54 var missingErr *firstAvailableMissingEnvError
55 if errors.As(err, &missingErr) {
56 return missingErr
57 }
58 return fmt.Errorf("model '%s': %w", name, err)
59 }
60
61 slog.DebugContext(ctx, "Resolved first_available model",
62 "model_name", name, "selected", ref, "provider", chosen.Provider, "model", chosen.Model)
63 cfg.Models[name] = chosen
64 return nil
65}
66
67func reachableFirstAvailableModels(cfg *latest.Config, selectors map[string]bool) map[string]bool {
68 reachable := map[string]bool{}

Callers 1

Calls 1

selectFirstAvailableFunction · 0.85

Tested by

no test coverage detected