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

Function fetchModelsFromURL

cmd/root/models.go:317–324  ·  view source on GitHub ↗

fetchModelsFromURL fetches and parses an OpenAI-compatible models list from the given URL using the supplied client. It is a thin wrapper around dispatchModelsRequest for tests that inject an httptest server's client.

(ctx context.Context, url string, client *http.Client)

Source from the content-addressed store, hash-verified

315// the given URL using the supplied client. It is a thin wrapper around
316// dispatchModelsRequest for tests that inject an httptest server's client.
317func fetchModelsFromURL(ctx context.Context, url string, client *http.Client) []string {
318 req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, http.NoBody)
319 if err != nil {
320 slog.WarnContext(ctx, "failed to create request for provider models", "url", url, "error", err)
321 return nil
322 }
323 return dispatchModelsRequest(ctx, req, client)
324}
325
326// dispatchModelsRequest sends req via client and parses the OpenAI-style model
327// list returned. Empty IDs are skipped; duplicates are preserved (the caller

Calls 1

dispatchModelsRequestFunction · 0.85