Component evidence
ParseModelRef parses provider/model strings into ModelConfig structures for AI model configuration.
// Source: https://github.com/docker/docker-agent | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package v13
import (
"fmt"
"strings"
)
// ParseModelRef parses an inline "provider/model" reference into a
// ModelConfig. It splits on the first "/", so the model portion may itself
// contain slashes (e.g. "dmr/ai/qwen3:latest" yields provider "dmr" and model
// "ai/qwen3:latest"). It returns an error when there is no "/" or when either
// part is empty.
//
// cfg, err := ParseModelRef("openai/gpt-4o")
// // cfg.Provider == "openai", cfg.Model == "gpt-4o"
func ParseModelRef(ref string) (ModelConfig, error) {
providerName, model, ok := strings.Cut(ref, "/")
if !ok || providerNa
... (truncated -- full source via MCP)