{"record":{"id":"d2d350774b77a0d6","repo":"BerriAI/litellm","slug":"quantization-config-must-be-one-of-scalar-bina","errorCode":null,"errorMessage":"Quantization config must be one of 'scalar', 'binary' or 'product'","messagePattern":"Quantization config must be one of 'scalar', 'binary' or 'product'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/caching/qdrant_semantic_cache.py","lineNumber":125,"sourceCode":"            quantization_params: dict[str, Any]\n            if quantization_config is None or quantization_config == \"binary\":\n                quantization_params = {\n                    \"binary\": {\n                        \"always_ram\": False,\n                    }\n                }\n            elif quantization_config == \"scalar\":\n                quantization_params = {\n                    \"scalar\": {\n                        \"type\": \"int8\",\n                        \"quantile\": QDRANT_SCALAR_QUANTILE,\n                        \"always_ram\": False,\n                    }\n                }\n            elif quantization_config == \"product\":\n                quantization_params = {\"product\": {\"compression\": \"x16\", \"always_ram\": False}}\n            else:\n                raise Exception(\"Quantization config must be one of 'scalar', 'binary' or 'product'\")\n\n            new_collection_status: Final = self.sync_client.put(\n                url=f\"{self.qdrant_api_base}/collections/{self.collection_name}\",\n                json={\n                    \"vectors\": {\"size\": self.vector_size, \"distance\": \"Cosine\"},\n                    \"quantization_config\": quantization_params,\n                },\n                headers=self.headers,\n            )\n            if new_collection_status.json()[\"result\"]:\n                collection_details = self.sync_client.get(\n                    url=f\"{self.qdrant_api_base}/collections/{self.collection_name}\",\n                    headers=self.headers,\n                )\n                self.collection_info = collection_details.json()\n                print_verbose(f\"New collection created.\\nCollection details:{self.collection_info}\")\n                self._ensure_cache_key_payload_index()\n            else:","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/caching/qdrant_semantic_cache.py#L107-L143","documentation":"When the collection does not yet exist, the cache creates it with a quantization_config. Only three string values are accepted: 'scalar', 'binary' (or None, which defaults to binary), and 'product'. Any other string — or a dict the code does not recognize — falls through to this exception. Note the error message text omits that None is also accepted (None means default binary quantization).","triggerScenarios":"Passing quantization_config='int8', 'none', 'off', 'fp16', or an arbitrary dict to QdrantSemanticCache when the collection is being created for the first time; existing collections skip this branch entirely.","commonSituations":"Trying to disable quantization with quantization_config='none' instead of leaving it out; guessing a quantization name from Qdrant docs that doesn't match the three allowed aliases.","solutions":["Use one of the supported values: quantization_config='scalar', 'binary', or 'product'","To get the default binary quantization, omit quantization_config (or pass None)"],"exampleFix":"# before\ncache = QdrantSemanticCache(..., quantization_config='int8')\n\n# after\ncache = QdrantSemanticCache(..., quantization_config='scalar')  # int8 scalar quantization","handlingStrategy":"validation","validationCode":"ALLOWED_QUANTIZATION = {'scalar', 'binary', 'product'}\nq = cfg.get('quantization_config')\nif q is not None and q not in ALLOWED_QUANTIZATION:\n    raise ValueError(f'quantization_config must be one of {sorted(ALLOWED_QUANTIZATION)} or omitted')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document the three accepted values wherever cache configs are authored","Use an enum/ Literal type in your own config layer so invalid values never reach litellm"],"tags":["qdrant","quantization","validation","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}