Repository navigation
Code cleanup: lazy clients, lifespan, schemas split, tests and CI - #5
Merged
Merged
Conversation
… and CI - OpenAI clients are created on first use; embeddings load in the FastAPI lifespan - Pydantic schemas moved to app/schemas.py; app/models.py keeps only the ORM - DatabaseService uses context-managed sessions; unused methods and load_knowledge_base/chunk_text removed - alembic/env.py reads DATABASE_URL (app/__init__.py loads .env); init_db.py removed - .model_dump(), sqlalchemy.orm.declarative_base, timezone-aware UTC helper - tests/ with fakes for OpenAI and the database; ruff config; GitHub Actions workflow - README updated to match Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QVi7kKzGQhgPKX8sDzTu6i
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QVi7kKzGQhgPKX8sDzTu6i
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #4 (base is
readme-rewrite; GitHub retargets tomainonce #4 merges).What changed
lifespan. Importing the app no longer needs a key.app/schemas.py(Pydantic) separated fromapp/models.py(ORM)..dict()→.model_dump(),sqlalchemy.orm.declarative_base, naive-UTC helper instead ofdatetime.utcnow.DatabaseService: context-managed sessions;get_db()(closed the session before returning it) and three unused methods removed.load_knowledge_baseandchunk_textremoved.app/__init__.pyloads.env, soalembic/env.pynow usesDATABASE_URL;init_db.pyremoved (single path to create the schema).tests/(13 tests: chunking, ranking, cache, endpoints with fakes),pyproject.tomlwith ruff config,requirements-dev.txt,.github/workflows/tests.yml.Verification (local, Python 3.14)
🤖 Generated with Claude Code
https://claude.ai/code/session_01QVi7kKzGQhgPKX8sDzTu6i