MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / AddProviderModel

Method AddProviderModel

controller/ai-model/iml.go:57–72  ·  view source on GitHub ↗
(ctx *gin.Context, provider string, input *model_dto.Model)

Source from the content-addressed store, hash-verified

55}
56
57func (i *imlProviderModelController) AddProviderModel(ctx *gin.Context, provider string, input *model_dto.Model) (*model_dto.SimpleModel, error) {
58 if !common.ModelNameValid(input.Name) {
59 return nil, fmt.Errorf("model name illegal(a-zA-Z0-9-_.:/)")
60 }
61 if strings.TrimSpace(provider) == "" {
62 return nil, fmt.Errorf("provider is empty")
63 }
64 // check access config & model parameter is json format
65 if strings.TrimSpace(input.AccessConfiguration) != "" && !json.Valid([]byte(input.AccessConfiguration)) {
66 return nil, fmt.Errorf("access configuration is not json format")
67 }
68 if strings.TrimSpace(input.ModelParameters) != "" && !json.Valid([]byte(input.ModelParameters)) {
69 return nil, fmt.Errorf("model parameters is not json format")
70 }
71 return i.module.AddProviderModel(ctx, provider, input)
72}

Callers

nothing calls this directly

Calls 3

ModelNameValidFunction · 0.92
ValidMethod · 0.65
AddProviderModelMethod · 0.65

Tested by

no test coverage detected