When products are loaded from PostgreSQL, JSON columns (effect_profile,
context_rules) are deserialized as plain dicts, not Pydantic models.
The build_product_context_summary function was accessing these fields
as object attributes (.safe_with_compromised_barrier) which caused:
AttributeError: 'dict' object has no attribute 'safe_with_compromised_barrier'
Fix: Add isinstance(dict) checks like build_product_context_detailed already does.
Handle both dict (from DB) and object (from Pydantic) cases.
Traceback from production:
File "llm_context.py", line 91, in build_product_context_summary
if product.context_rules.safe_with_compromised_barrier:
AttributeError: 'dict' object has no attribute...
|
||
|---|---|---|
| .. | ||
| alembic | ||
| innercontext | ||
| tests | ||
| .env.example | ||
| .python-version | ||
| alembic.ini | ||
| db.py | ||
| main.py | ||
| pyproject.toml | ||
| README.md | ||
| skincare.yaml | ||
| test_query.py | ||
| uv.lock | ||
See the root README for setup and usage instructions.