{"record":{"id":"58d54358a62e3e4d","repo":"VectifyAI/PageIndex","slug":"unknown-chat-keys-keys-chat-takes-model-an","errorCode":null,"errorMessage":"Unknown chat keys ({keys}) — chat takes \"model\" and \"backend\" (your own model), or {\"mode\": \"cloud\"} / \"cloud\" for the managed chat.","messagePattern":"Unknown chat keys \\((.+?)\\) — chat takes \"model\" and \"backend\" \\(your own model\\), or (.+?) / \"cloud\" for the managed chat\\.","errorType":"validation","errorClass":"PageIndexAPIError","httpStatus":null,"severity":"error","filePath":"pageindex/client.py","lineNumber":205,"sourceCode":"        if word == \"local\":\n            return \"own\", {}\n        if word in _RESERVED_MODE_WORDS:\n            raise PageIndexAPIError(\n                f'chat=\"{chat}\" is not a mode word — the managed chat is '\n                'chat=\"cloud\".')\n        if chat.strip():\n            return \"own\", {\"chat_model\": chat}\n        raise PageIndexAPIError(\n            \"chat is an empty string — pass a model name, or \"\n            '\"cloud\" for the managed chat.')\n    if isinstance(chat, Mapping):\n        # None-valued keys mean \"absent\", exactly like the flat arguments.\n        conf = {name: value for name, value in chat.items()\n                if value is not None}\n        declared = _declared_mode(conf.pop(\"mode\", None), \"chat\")\n        unknown = set(conf) - {\"model\", \"backend\"}\n        if (not conf and declared is None) or unknown:\n            raise PageIndexAPIError(\n                (\"chat is an empty dict\" if not conf else\n                 f\"Unknown chat keys ({', '.join(sorted(unknown))})\")\n                + ' — chat takes \"model\" and \"backend\" (your own model), '\n                'or {\"mode\": \"cloud\"} / \"cloud\" for the managed chat.')\n        if declared == \"cloud\":\n            if conf:\n                raise PageIndexAPIError(\n                    'chat declares mode \"cloud\" but carries '\n                    f\"({', '.join(sorted(conf))}) — the managed chat \"\n                    \"selects its own model. Drop the mode, or the keys.\")\n            return \"managed\", {}\n        mapped = {\"chat_model\": conf.get(\"model\"),\n                  \"chat_backend\": conf.get(\"backend\")}\n        return \"own\", {name: value for name, value in mapped.items()\n                       if value is not None}\n    raise PageIndexAPIError(\"chat must be a string or a dict.\")\n\n","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/VectifyAI/PageIndex/blob/afb5e119766630af6014b04fe8b53357527bc05e/pageindex/client.py#L187-L223","documentation":"The chat dict contained keys other than the allowed \"model\", \"backend\", and \"mode\". The SDK strictly validates the slot's schema so typos and stale option names fail fast instead of being silently ignored.","triggerScenarios":"PageIndexClient(chat={\"model\": \"x\", \"temperature\": 0.2}) or chat={\"models\": \"x\"} (typo), or passing a raw provider kwargs dict (e.g. OpenAI params) as chat.","commonSituations":"Typos like \"models\" or \"name\"; upgrading from an older SDK version that accepted different keys; pasting provider-specific option dicts into the chat slot.","solutions":["Rename unknown keys to the supported ones: only \"model\", \"backend\", and \"mode\" are accepted","Move provider-specific options (temperature, api_key, etc.) inside the \"backend\" dict","Check the error message — it lists exactly which keys are unknown"],"exampleFix":"# before\nPageIndexClient(chat={\"model\": \"gpt-4o-mini\", \"temperature\": 0.2})\n# after\nPageIndexClient(chat={\"model\": \"gpt-4o-mini\", \"backend\": {\"temperature\": 0.2}})","handlingStrategy":"validation","validationCode":"ALLOWED = {\"model\", \"backend\", \"mode\"}\nassert set(chat_dict) <= ALLOWED, f\"bad chat keys: {set(chat_dict) - ALLOWED}\"","typeGuard":"def chat_keys_valid(d: dict) -> bool:\n    return set(d) <= {\"model\", \"backend\", \"mode\"}","tryCatchPattern":null,"preventionTips":["Keep provider-specific options inside the \"backend\" sub-dict, never at the top level of chat","Run a key allowlist check when loading chat config from user-supplied files"],"tags":["config","chat","unknown-keys","typo"],"backgroundTag":"unknown-config-key","analyzedSha":"afb5e119766630af6014b04fe8b53357527bc05e","analyzedAt":"2026-08-27T11:20:48.519Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}