MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / NewCustomizeProvider

Function NewCustomizeProvider

ai-provider/model-runtime/provider.go:80–114  ·  view source on GitHub ↗
(id string, name string, models []IModel, defaultModel string, config string)

Source from the content-addressed store, hash-verified

78}
79
80func NewCustomizeProvider(id string, name string, models []IModel, defaultModel string, config string) (IProvider, error) {
81 uri, err := GetCustomizeProviderURI(config, true)
82 if err != nil {
83 return nil, err
84 }
85
86 provider := &Provider{
87 id: id,
88 name: name,
89 logo: GetCustomizeLogo(),
90 helpUrl: "",
91 registry: newModelRegistry(),
92 maskKeys: make([]string, 0),
93 recommend: false,
94 sort: 0,
95 uri: uri,
96 modelConfig: ModelConfig{
97 AccessConfigurationStatus: false,
98 AccessConfigurationDemo: "",
99 },
100 }
101 provider.IConfig = NewConfig("", nil)
102
103 for _, model := range models {
104 provider.SetModel(model.ID(), model)
105 if defaultModel == "" {
106 defaultModel = model.ID()
107 }
108 if model.ID() == defaultModel {
109 provider.SetDefaultModel(name, model)
110 }
111 }
112
113 return provider, nil
114}
115
116func NewProvider(providerData string, modelContents map[string]eosc.Untyped[string, string]) (IProvider, error) {
117 var providerCfg entity.Provider

Callers

nothing calls this directly

Calls 7

SetModelMethod · 0.95
SetDefaultModelMethod · 0.95
GetCustomizeProviderURIFunction · 0.85
GetCustomizeLogoFunction · 0.85
newModelRegistryFunction · 0.85
NewConfigFunction · 0.85
IDMethod · 0.65

Tested by

no test coverage detected