MCPcopy Index your code
hub / github.com/coder/coder / parseCanonicalModelRef

Function parseCanonicalModelRef

coderd/x/chatd/chatprovider/chatprovider.go:683–703  ·  view source on GitHub ↗
(modelRef string)

Source from the content-addressed store, hash-verified

681}
682
683func parseCanonicalModelRef(modelRef string) (provider string, model string, ok bool) {
684 modelRef = strings.TrimSpace(modelRef)
685 if modelRef == "" {
686 return "", "", false
687 }
688
689 for _, separator := range []string{":", "/"} {
690 parts := strings.SplitN(modelRef, separator, 2)
691 if len(parts) != 2 {
692 continue
693 }
694
695 provider := NormalizeProvider(parts[0])
696 modelID := strings.TrimSpace(parts[1])
697 if provider != "" && modelID != "" {
698 return provider, modelID, true
699 }
700 }
701
702 return "", "", false
703}
704
705func isChatModelForProvider(provider, modelID string) bool {
706 normalizedProvider := NormalizeProvider(provider)

Callers 1

Calls 1

NormalizeProviderFunction · 0.85

Tested by

no test coverage detected