{"record":{"id":"21e6728cc79f83d1","repo":"weaviate/weaviate","slug":"wrong-frequencypenalty-configuration-values-are-b-21e672","errorCode":null,"errorMessage":"Wrong frequencyPenalty configuration, values are between -2.0 and 2.0","messagePattern":"Wrong frequencyPenalty configuration, values are between -2\\.0 and 2\\.0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/generative-deepseek/config/class_settings.go","lineNumber":96,"sourceCode":"\tif err := ic.propertyValuesHelper.ValidateBaseURL(ic.BaseURL()); err != nil {\n\t\treturn err\n\t}\n\n\ttemperature := ic.Temperature()\n\tif temperature != nil && (*temperature < 0 || *temperature > 2) {\n\t\treturn errors.Errorf(\"Wrong temperature configuration, values are between 0.0 and 2.0\")\n\t}\n\n\tmodel := ic.getStringProperty(modelProperty, DefaultDeepSeekModel)\n\tmaxTokens := ic.MaxTokens()\n\tmaxTokensForModel := GetMaxTokensForModel(*model)\n\tif maxTokens != nil && (*maxTokens < 0 || (maxTokensForModel != nil && *maxTokens > *maxTokensForModel)) {\n\t\treturn errors.Errorf(\"Wrong maxTokens configuration, values are should have a minimal value of 1 and max is dependant on the model used\")\n\t}\n\n\tfrequencyPenalty := ic.getFloatProperty(frequencyPenaltyProperty, &DefaultDeepSeekFrequencyPenalty)\n\tif frequencyPenalty == nil || (*frequencyPenalty < -2 || *frequencyPenalty > 2) {\n\t\treturn errors.Errorf(\"Wrong frequencyPenalty configuration, values are between -2.0 and 2.0\")\n\t}\n\n\tpresencePenalty := ic.getFloatProperty(presencePenaltyProperty, &DefaultDeepSeekPresencePenalty)\n\tif presencePenalty == nil || (*presencePenalty < -2 || *presencePenalty > 2) {\n\t\treturn errors.Errorf(\"Wrong presencePenalty configuration, values are between -2.0 and 2.0\")\n\t}\n\n\ttopP := ic.getFloatProperty(topPProperty, &DefaultDeepSeekTopP)\n\tif topP == nil || (*topP < 0 || *topP > 1) {\n\t\treturn errors.Errorf(\"Wrong topP configuration, values are should have a minimal value of 0 and max of 1\")\n\t}\n\n\treturn nil\n}\n\nfunc (ic *classSettings) getStringProperty(name, defaultValue string) *string {\n\tasString := ic.propertyValuesHelper.GetPropertyAsStringWithNotExists(ic.cfg, name, \"\", defaultValue)\n\treturn &asString","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/modules/generative-deepseek/config/class_settings.go#L78-L114","documentation":"Weaviate's generative-deepseek module validates the per-collection frequencyPenalty setting in class_settings.go Validate(). The DeepSeek chat API only accepts frequencyPenalty in the range [-2.0, 2.0], so any configured value outside that range (or a non-numeric value that fails to parse, yielding nil) is rejected at schema configuration time. This is a client-side guard so bad settings fail fast instead of erroring on every generation request.","triggerScenarios":"Creating or updating a collection with generative-deepseek configured where moduleConfig.generative-deepseek.frequencyPenalty is < -2, > 2, or is not a valid number (causing getFloatProperty to return nil).","commonSituations":"Copy-pasting a frequencyPenalty like 5 or -3 from another provider's docs; passing a string value ('0.5') that fails float parsing; typos in the JSON type when defining the collection schema.","solutions":["Set frequencyPenalty to a number within [-2.0, 2.0] (default is 0) in moduleConfig.generative-deepseek","Ensure the value is a JSON number, not a string","Remove the frequencyPenalty field entirely to use DefaultDeepSeekFrequencyPenalty","Re-apply the collection schema after correcting the value"],"exampleFix":"// before\n\"moduleConfig\": {\"generative-deepseek\": {\"frequencyPenalty\": 3.5}}\n// after\n\"moduleConfig\": {\"generative-deepseek\": {\"frequencyPenalty\": 0.5}}","handlingStrategy":"validation","validationCode":"func validFrequencyPenalty(v any) bool {\n\tn, ok := v.(float64)\n\treturn ok && n >= -2 && n <= 2\n}\n// use before building moduleConfig\nif !validFrequencyPenalty(cfg.FrequencyPenalty) { return errors.New(\"frequencyPenalty must be in [-2, 2]\") }","typeGuard":"func asRange(v any, lo, hi float64) (float64, bool) {\n\tn, ok := v.(float64)\n\tif !ok || n < lo || n > hi { return 0, false }\n\treturn n, true\n}","tryCatchPattern":null,"preventionTips":["Keep frequencyPenalty within [-2, 2] in all collection configs","Always emit JSON numbers, never strings, for numeric module options","Pin a validated shared schema/config template across environments","Diff schema changes against a known-good baseline before applying"],"tags":["validation","configuration","deepseek","weaviate"],"backgroundTag":"invalid-parameter-range","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}