-
Notifications
You must be signed in to change notification settings - Fork 58
LCORE-642: BYOK RAG configuration #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-642: BYOK RAG configuration #638
Conversation
WalkthroughAdds BYOK RAG defaults to constants, introduces a ByokRag pydantic model and a top-level Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App
participant Configuration
participant ByokRag
participant Constants
User->>App: Load configuration file
App->>Configuration: parse/instantiate Configuration
alt byok_rag entries present
Configuration->>ByokRag: instantiate per entry
ByokRag->>Constants: apply defaults for missing rag_type / embedding_model / embedding_dimension
ByokRag-->>Configuration: validated instances
else none provided
Configuration->>Configuration: set byok_rag = []
end
App->>Configuration: request dump()
Configuration-->>App: serialized JSON including "byok_rag": [...]
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/constants.py(1 hunks)src/models/config.py(4 hunks)tests/unit/models/config/test_byok_rag.py(1 hunks)tests/unit/models/config/test_dump_configuration.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
src/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use absolute imports for internal modules (e.g., from auth import get_auth_dependency)
Files:
src/constants.pysrc/models/config.py
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: All modules start with descriptive module-level docstrings explaining purpose
Use logger = logging.getLogger(name) for module logging after import logging
Define type aliases at module level for clarity
All functions require docstrings with brief descriptions
Provide complete type annotations for all function parameters and return types
Use typing_extensions.Self in model validators where appropriate
Use modern union syntax (str | int) and Optional[T] or T | None consistently
Function names use snake_case with descriptive, action-oriented prefixes (get_, validate_, check_)
Avoid in-place parameter modification; return new data structures instead of mutating arguments
Use appropriate logging levels: debug, info, warning, error with clear messages
All classes require descriptive docstrings explaining purpose
Class names use PascalCase with conventional suffixes (Configuration, Error/Exception, Resolver, Interface)
Abstract base classes should use abc.ABC and @AbstractMethod for interfaces
Provide complete type annotations for all class attributes
Follow Google Python docstring style for modules, classes, and functions, including Args, Returns, Raises, Attributes sections as needed
Files:
src/constants.pytests/unit/models/config/test_dump_configuration.pysrc/models/config.pytests/unit/models/config/test_byok_rag.py
src/constants.py
📄 CodeRabbit inference engine (CLAUDE.md)
Keep shared constants in a central src/constants.py with descriptive comments
Files:
src/constants.py
tests/{unit,integration}/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests
Do not use unittest in tests; pytest is the standard
Files:
tests/unit/models/config/test_dump_configuration.pytests/unit/models/config/test_byok_rag.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/**/*.py: Use pytest-mock to create AsyncMock objects for async interactions in tests
Use the shared auth mock constant: MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token") in tests
Files:
tests/unit/models/config/test_dump_configuration.pytests/unit/models/config/test_byok_rag.py
src/{models/config.py,configuration.py}
📄 CodeRabbit inference engine (CLAUDE.md)
src/{models/config.py,configuration.py}: All configuration uses Pydantic models extending ConfigurationBase
Configuration base models must set model_config with extra="forbid" to reject unknown fields
Files:
src/models/config.py
src/{models/**/*.py,configuration.py}
📄 CodeRabbit inference engine (CLAUDE.md)
src/{models/**/*.py,configuration.py}: Use @field_validator and @model_validator for custom validation in Pydantic models
Use precise type hints in configuration (e.g., Optional[FilePath], PositiveInt, SecretStr)
Files:
src/models/config.py
src/models/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
src/models/**/*.py: Pydantic models: use BaseModel for data models and extend ConfigurationBase for configuration
Use @model_validator and @field_validator for Pydantic model validation
Files:
src/models/config.py
🧬 Code graph analysis (1)
tests/unit/models/config/test_byok_rag.py (1)
src/models/config.py (2)
config(139-145)ByokRag(549-559)
🪛 GitHub Actions: Python linter
src/models/config.py
[error] 4-4: Pylint: W0611 Unused Annotated imported from typing (unused-import).
🪛 GitHub Actions: Ruff
src/models/config.py
[error] 4-4: F401: 'typing.Annotated' imported but unused. Remove unused import: 'typing.Annotated'. This can be fixed with 'ruff --fix'.
🪛 GitHub Actions: Unit tests
tests/unit/models/config/test_byok_rag.py
[error] 1-1: Pytest failure: ByokRag validation error. db_path 'tests/configuration/rag.txt' does not point to an existing file.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-pr
- GitHub Check: e2e_tests (ci)
🔇 Additional comments (3)
tests/unit/models/config/test_dump_configuration.py (1)
91-91: LGTM!The additions correctly validate that the new
byok_ragfield is present in the serialized configuration and defaults to an empty list, which aligns with theField(default_factory=list)declaration inConfiguration.Also applies to: 173-173
src/models/config.py (2)
549-560: LGTM! Well-structured configuration model.The
ByokRagclass follows Pydantic best practices:
- Extends
ConfigurationBasewithextra="forbid"- Uses appropriate type constraints (
constr(min_length=1),PositiveInt,FilePath)- Provides sensible defaults from constants
FilePathfordb_pathensures file existence validationThe validation rules will properly reject empty strings and negative dimensions, as tested in
test_byok_rag.py.
580-580: LGTM! Field properly integrated.The
byok_ragfield is correctly added to theConfigurationmodel with an appropriate default factory, ensuring an empty list when not specified.
Description
LCORE-642: BYOK RAG configuration
Type of change
Related Tickets & Documents
Summary by CodeRabbit
New Features
Tests