{"id":27997,"library":"nucliadb-models","title":"NucliaDB Models","description":"Data models and validation for NucliaDB, the AI-powered search database. Version 6.13.0.post6240 supports Python 3.10-3.12. Released as part of the nucliadb project, with frequent releases following nucliadb's release cadence.","status":"active","version":"6.13.0.post6240","language":"python","source_language":"en","source_url":"https://github.com/nuclia/nucliadb","tags":["nucliadb","models","pydantic","ai-search"],"install":[{"cmd":"pip install nucliadb-models","lang":"bash","label":"latest"}],"dependencies":[{"reason":"core dependency for data models","package":"pydantic","optional":false},{"reason":"used for serialization","package":"protobuf","optional":false}],"imports":[{"note":"","symbol":"Resource","correct":"from nucliadb_models.resource import Resource"},{"note":"","symbol":"TextField","correct":"from nucliadb_models.text import TextField"},{"note":"","symbol":"KnowledgeBoxObj","correct":"from nucliadb_models.knowledgebox import KnowledgeBoxObj"}],"quickstart":{"code":"from nucliadb_models.resource import Resource\nfrom nucliadb_models.text import TextField\n\nresource = Resource(\n    slug=\"example\",\n    texts={\"en\": TextField(body=\"Hello world\")}\n)\nprint(resource.model_dump_json(indent=2))","lang":"python","description":"Create a NucliaDB resource model and serialize to JSON."},"warnings":[{"fix":"Use `from nucliadb_models import ...` instead of `from nucliadb.models import ...`","message":"In v6.0.0, the package was renamed from nucliadb-models to nucliadb_models. All imports must use underscores.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Replace `from nucliadb_models.field import Field` with specific field imports like `from nucliadb_models.text import TextField`","message":"The `Field` class from nucliadb_models.field is deprecated in favor of direct field classes like `TextField`, `FileField`.","severity":"deprecated","affected_versions":">=6.5.0"},{"fix":"Use `model_extra = 'allow'` in config if you need to allow extra fields.","message":"Model validation is strict: unknown fields raise a ValidationError by default. This differs from older pydantic v1 behavior.","severity":"gotcha","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install nucliadb-models and import using underscores: `from nucliadb_models import Resource`","cause":"Old import pattern with dots instead of underscores.","error":"ModuleNotFoundError: No module named 'nucliadb.models'"},{"fix":"Check the model schema and provide only defined fields with correct types.","cause":"Passing unknown fields or invalid field types.","error":"pydantic_core._pydantic_core.ValidationError: 1 validation error for Resource"},{"fix":"Import specific field types like `TextField` from `nucliadb_models.text` instead.","cause":"Field class was moved/removed.","error":"ImportError: cannot import name 'Field' from 'nucliadb_models'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}