LCORE-1880: Replaced successful responses and common models#1676
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (118)
WalkthroughReorganized response and shared Pydantic models into ChangesModel reorganization, OpenAPI bases, import rewiring
Sequence Diagram(s)(omitted — changes are structural refactoring; no new multi-component control flow introduced) Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
|
| if self.tools is not None: | ||
| tool_dicts: list[dict[str, Any]] = [] | ||
| for t in self.tools: | ||
| for t in list(self.tools): |
There was a problem hiding this comment.
Pyright complaining
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/openapi.json`:
- Line 16505: The PromptDeleteResponse description is out of sync with its
schema—update the "description" for the PromptDeleteResponse schema to list all
actual payload properties (at minimum include "success" as a required boolean
and "prompt_id" and any other fields shown in the example), and ensure the text
matches the example and required fields in the schema; locate the
PromptDeleteResponse entry in the OpenAPI JSON and revise the description string
to enumerate each attribute and its type/meaning so consumers see an accurate
payload doc.
In `@src/models/api/README.md`:
- Around line 6-7: The heading "## [responses/](responses/README.md)" in
src/models/api/README.md is immediately followed by content on the next line;
insert a single blank line after that heading so the file has one empty line
between the heading and the paragraph to satisfy markdownlint rule MD022 (i.e.,
update the README so "## [responses/](responses/README.md)" is followed by one
blank line before the descriptive text).
In `@src/models/api/responses/README.md`:
- Around line 3-13: Add blank lines before and after each section heading so
markdownlint rule MD022 is satisfied: insert one empty line above and one empty
line below each "## [__init__.py](__init__.py)", "##
[constants.py](constants.py)", "## [error/](error/README.md)", and "##
[successful/](successful/README.md)" heading in README.md so headings are
separated from surrounding text.
In `@src/models/api/responses/successful/bases.py`:
- Around line 34-35: AbstractDeleteResponse should inherit from
AbstractSuccessfulResponse so delete responses share the successful-response
polymorphic contract; update the class definition of AbstractDeleteResponse to
inherit from AbstractSuccessfulResponse instead of BaseModel and ensure
AbstractSuccessfulResponse is imported in the module (replace or add the import
as needed), leaving other fields/annotations unchanged.
In `@src/models/api/responses/successful/feedback.py`:
- Around line 33-56: Replace the open-ended status: dict on
FeedbackStatusUpdateResponse with a small nested Pydantic model (e.g. class
FeedbackStatus(BaseModel)) that declares the four keys shown in the example:
previous_status: bool, updated_status: bool, updated_by: str, timestamp: str (or
datetime if you prefer stricter typing), then change the
FeedbackStatusUpdateResponse.status annotation to use that FeedbackStatus type
and keep the existing model_config example; also add any needed import for
BaseModel/typing so validation and schema generation enforce the exact shape.
In `@src/models/api/responses/successful/query.py`:
- Around line 143-160: Summary: The OpenAPI JSON Schema in openapi_response
currently includes the SSE MIME type in the "format" field, which is redundant
and noisy. Fix: In the classmethod openapi_response, remove the "format":
MEDIA_TYPE_EVENT_STREAM entry from the schema construction (keep "schema":
{"type": "string"}), leaving the SSE media type represented only by the
top-level content key; locate openapi_response, model_json_schema(), and
MEDIA_TYPE_EVENT_STREAM in the method and update the returned content
accordingly, preserving the example_value and raising SchemaError as before.
In `@src/models/api/responses/successful/README.md`:
- Around line 1-37: Update the README.md headings to satisfy MD022 by inserting
a single blank line immediately before and after each heading line (both the
level-1 title and every level-2 item such as "## [__init__.py](__init__.py)",
"## [bases.py](bases.py)", etc.); ensure there is exactly one blank line
separating headings from surrounding text so all section headers have one empty
line above and one empty line below.
In `@src/models/api/responses/successful/vector_stores.py`:
- Line 37: The usage_bytes attribute should be required instead of defaulting to
0: remove the default=0 and declare usage_bytes as a required Field (e.g.,
Field(...) or otherwise omit a default) so Pydantic will raise if upstream value
is missing; update the declaration of usage_bytes (the Field import usage) in
the vector store response model to eliminate the silent zero fallback and ensure
real upstream values are enforced.
In `@src/models/common/health.py`:
- Around line 8-28: The status field on ProviderHealthStatus currently accepts
any string; constrain it to the documented values by replacing the free-form
status annotation with a closed type: either use typing.Literal["ok",
"unhealthy", "not_implemented"] as the type for status or define an Enum (e.g.,
class ProviderStatus(Enum) with OK/UNHEALTHY/NOT_IMPLEMENTED members) and set
status: ProviderStatus; update imports (typing.Literal or enum.Enum) and keep
the Field metadata and examples in sync so Pydantic validation and the generated
schema only allow the three documented states.
In `@src/models/common/mcp.py`:
- Around line 16-33: The MCPServerInfo model's source field is currently an
unconstrained str; change it to a constrained type (e.g., Literal["config",
"api"] or a small Enum) so invalid values are rejected and the OpenAPI schema
documents only those options; update the Field type annotation for source in the
MCPServerInfo class to use typing.Literal (or an Enum class) and adjust any
imports (typing or typing_extensions) and examples/description as needed to
reflect the two allowed values ("config", "api").
In `@src/models/common/moderation.py`:
- Around line 13-17: Add an "Attributes" section to the docstrings of the
ShieldModerationPassed and ShieldModerationBlocked Pydantic models documenting
their fields (e.g., the decision field and its literal value) so they follow the
repo's docstring standard; update the docstrings for classes
ShieldModerationPassed and ShieldModerationBlocked to include an Attributes
bullet (or section) that describes each Pydantic attribute and its type/value.
In `@src/models/common/transcripts.py`:
- Around line 8-31: Update the class docstrings for TranscriptMetadata and
Transcript to include Google-style "Attributes" sections that list each Pydantic
field, its type, and a one-line description (include which fields are optional
or have defaults); specifically document provider, model, query_provider,
query_model, user_id, conversation_id, timestamp for TranscriptMetadata and
metadata, redacted_query, query_is_valid, llm_response, rag_chunks, truncated,
attachments, tool_calls, tool_results for Transcript (note the default_factory
lists and optional fields where applicable) so the model docs follow the
repository's docstring guidelines.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d81a4bf7-aad1-435a-931c-044b7339b10f
📒 Files selected for processing (117)
docs/openapi.jsonsrc/app/endpoints/authorized.pysrc/app/endpoints/config.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/feedback.pysrc/app/endpoints/health.pysrc/app/endpoints/info.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/query.pysrc/app/endpoints/rags.pysrc/app/endpoints/responses.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/root.pysrc/app/endpoints/shields.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/tools.pysrc/app/endpoints/vector_stores.pysrc/app/main.pysrc/authentication/jwk_token.pysrc/authentication/k8s.pysrc/authentication/utils.pysrc/authorization/middleware.pysrc/cache/cache.pysrc/cache/in_memory_cache.pysrc/cache/noop_cache.pysrc/cache/postgres_cache.pysrc/cache/sqlite_cache.pysrc/client.pysrc/metrics/utils.pysrc/models/api/README.mdsrc/models/api/responses/README.mdsrc/models/api/responses/__init__.pysrc/models/api/responses/error/README.mdsrc/models/api/responses/successful/README.mdsrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/catalog.pysrc/models/api/responses/successful/configuration.pysrc/models/api/responses/successful/conversations.pysrc/models/api/responses/successful/feedback.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/api/responses/successful/probes.pysrc/models/api/responses/successful/prompts.pysrc/models/api/responses/successful/query.pysrc/models/api/responses/successful/responses_openai.pysrc/models/api/responses/successful/vector_stores.pysrc/models/cache_entry.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/common/health.pysrc/models/common/mcp.pysrc/models/common/moderation.pysrc/models/common/responses/__init__.pysrc/models/common/responses/responses_api_params.pysrc/models/common/responses/responses_context.pysrc/models/common/responses/types.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/context.pysrc/models/requests.pysrc/models/responses.pysrc/models/rlsapi/responses.pysrc/utils/conversations.pysrc/utils/endpoints.pysrc/utils/mcp_oauth_probe.pysrc/utils/prompts.pysrc/utils/query.pysrc/utils/quota.pysrc/utils/responses.pysrc/utils/shields.pysrc/utils/transcripts.pysrc/utils/types.pysrc/utils/vector_search.pytests/integration/endpoints/test_query_byok_integration.pytests/integration/endpoints/test_rlsapi_v1_integration.pytests/integration/test_middleware_integration.pytests/unit/app/endpoints/test_a2a.pytests/unit/app/endpoints/test_config.pytests/unit/app/endpoints/test_conversations.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/endpoints/test_health.pytests/unit/app/endpoints/test_mcp_auth.pytests/unit/app/endpoints/test_mcp_servers.pytests/unit/app/endpoints/test_prompts.pytests/unit/app/endpoints/test_query.pytests/unit/app/endpoints/test_responses.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/app/endpoints/test_shields.pytests/unit/app/endpoints/test_stream_interrupt.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/app/endpoints/test_tools.pytests/unit/app/test_main_middleware.pytests/unit/cache/test_postgres_cache.pytests/unit/cache/test_sqlite_cache.pytests/unit/models/responses/test_authorized_response.pytests/unit/models/responses/test_error_responses.pytests/unit/models/responses/test_query_response.pytests/unit/models/responses/test_rag_chunk.pytests/unit/models/responses/test_response_types.pytests/unit/models/responses/test_successful_responses.pytests/unit/models/responses/test_types.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/utils/test_endpoints.pytests/unit/utils/test_query.pytests/unit/utils/test_shields.pytests/unit/utils/test_transcripts.pytests/unit/utils/test_types.pytests/unit/utils/test_vector_search.py
💤 Files with no reviewable changes (2)
- src/models/api/responses/error/README.md
- src/models/responses.py
📜 Review details
⏰ 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). (13)
- GitHub Check: unit_tests (3.12)
- GitHub Check: bandit
- GitHub Check: spectral
- GitHub Check: build-pr
- GitHub Check: Pyright
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
- GitHub Check: E2E: library mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 3
- GitHub Check: E2E: library mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 1
- GitHub Check: E2E Tests for Lightspeed Evaluation job
🧰 Additional context used
📓 Path-based instructions (7)
src/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.py: Use absolute imports for internal modules:from authentication import get_auth_dependency
All modules start with descriptive docstrings explaining purpose
Uselogger = get_logger(__name__)fromlog.pyfor module logging
Type aliases defined at module level for clarity
Use Final[type] as type hint for all constants
All functions require docstrings with brief descriptions
Complete type annotations for function parameters and return types
Use Union types with modern syntax:str | int
UseOptional[Type]for optional type hints
Use snake_case with descriptive, action-oriented function names (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns: return new data structures instead of modifying parameters
Useasync deffor I/O operations and external API calls
Uselogger.debug()for detailed diagnostic information
Uselogger.info()for general information about program execution
Uselogger.warning()for unexpected events or potential problems
Uselogger.error()for serious problems that prevented function execution
All classes require descriptive docstrings explaining purpose
Use PascalCase for class names with descriptive names and standard suffixes:Configuration,Error/Exception,Resolver,Interface
Abstract classes use ABC with@abstractmethoddecorators
Complete type annotations for all class attributes, use specific types, notAny
Follow Google Python docstring conventions for all modules, classes, and functions
Docstring Parameters section documents function parameters
Docstring Returns section documents function return values
Docstring Raises section documents exceptions that may be raised
Use black for code formatting
Use pylint for static analysis with source-roots configuration set to "src"
Use pyright for type checking
Use ruff for fast linting
Use pydocstyle for docstring style validation
Use mypy for additional type checking
Use bandit for security issue detection
Files:
src/cache/cache.pysrc/authentication/utils.pysrc/models/common/responses/types.pysrc/models/cache_entry.pysrc/models/rlsapi/responses.pysrc/authentication/jwk_token.pysrc/app/endpoints/rags.pysrc/app/endpoints/shields.pysrc/utils/prompts.pysrc/authentication/k8s.pysrc/client.pysrc/models/common/mcp.pysrc/models/common/health.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/configuration.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/feedback.pysrc/authorization/middleware.pysrc/app/endpoints/authorized.pysrc/utils/quota.pysrc/utils/mcp_oauth_probe.pysrc/models/common/moderation.pysrc/models/api/responses/successful/query.pysrc/cache/noop_cache.pysrc/app/endpoints/providers.pysrc/models/api/responses/successful/conversations.pysrc/app/main.pysrc/models/common/responses/__init__.pysrc/models/api/responses/successful/prompts.pysrc/app/endpoints/info.pysrc/models/common/responses/responses_api_params.pysrc/cache/sqlite_cache.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/tools.pysrc/app/endpoints/mcp_auth.pysrc/cache/in_memory_cache.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/api/responses/successful/vector_stores.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/responses.pysrc/utils/query.pysrc/app/endpoints/vector_stores.pysrc/app/endpoints/config.pysrc/models/api/responses/__init__.pysrc/app/endpoints/stream_interrupt.pysrc/models/context.pysrc/models/api/responses/successful/probes.pysrc/app/endpoints/feedback.pysrc/models/common/turn_summary.pysrc/utils/shields.pysrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/requests.pysrc/app/endpoints/root.pysrc/models/common/transcripts.pysrc/app/endpoints/rlsapi_v1.pysrc/utils/responses.pysrc/app/endpoints/health.pysrc/app/endpoints/prompts.pysrc/app/endpoints/mcp_servers.pysrc/utils/types.pysrc/utils/conversations.pysrc/models/api/responses/successful/responses_openai.pysrc/app/endpoints/query.pysrc/app/endpoints/streaming_query.pysrc/utils/vector_search.pysrc/models/api/responses/successful/catalog.pysrc/cache/postgres_cache.pysrc/utils/transcripts.pysrc/utils/endpoints.pysrc/metrics/utils.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
tests/unit/**/*.py: Use pytest for all unit and integration tests
Usepytest-mockfor AsyncMock objects in unit tests
Use markerpytest.mark.asynciofor async tests
Files:
tests/unit/models/responses/test_types.pytests/unit/app/endpoints/test_stream_interrupt.pytests/unit/models/responses/test_response_types.pytests/unit/app/endpoints/test_shields.pytests/unit/app/endpoints/test_mcp_servers.pytests/unit/cache/test_sqlite_cache.pytests/unit/app/endpoints/test_config.pytests/unit/utils/test_shields.pytests/unit/utils/test_endpoints.pytests/unit/models/responses/test_query_response.pytests/unit/utils/test_vector_search.pytests/unit/app/endpoints/test_query.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/models/responses/test_rag_chunk.pytests/unit/app/endpoints/test_responses.pytests/unit/utils/test_types.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/cache/test_postgres_cache.pytests/unit/models/responses/test_authorized_response.pytests/unit/app/endpoints/test_health.pytests/unit/app/endpoints/test_mcp_auth.pytests/unit/app/endpoints/test_tools.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/models/responses/test_successful_responses.pytests/unit/utils/test_query.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/test_main_middleware.pytests/unit/app/endpoints/test_prompts.pytests/unit/app/endpoints/test_conversations.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/app/endpoints/test_a2a.pytests/unit/models/responses/test_error_responses.pytests/unit/utils/test_transcripts.py
tests/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Do not use unittest - pytest is the standard testing framework for this project
Files:
tests/unit/models/responses/test_types.pytests/unit/app/endpoints/test_stream_interrupt.pytests/unit/models/responses/test_response_types.pytests/unit/app/endpoints/test_shields.pytests/unit/app/endpoints/test_mcp_servers.pytests/integration/test_middleware_integration.pytests/unit/cache/test_sqlite_cache.pytests/unit/app/endpoints/test_config.pytests/unit/utils/test_shields.pytests/integration/endpoints/test_rlsapi_v1_integration.pytests/unit/utils/test_endpoints.pytests/unit/models/responses/test_query_response.pytests/unit/utils/test_vector_search.pytests/unit/app/endpoints/test_query.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/models/responses/test_rag_chunk.pytests/unit/app/endpoints/test_responses.pytests/unit/utils/test_types.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/cache/test_postgres_cache.pytests/unit/models/responses/test_authorized_response.pytests/unit/app/endpoints/test_health.pytests/integration/endpoints/test_query_byok_integration.pytests/unit/app/endpoints/test_mcp_auth.pytests/unit/app/endpoints/test_tools.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/models/responses/test_successful_responses.pytests/unit/utils/test_query.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/test_main_middleware.pytests/unit/app/endpoints/test_prompts.pytests/unit/app/endpoints/test_conversations.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/app/endpoints/test_a2a.pytests/unit/models/responses/test_error_responses.pytests/unit/utils/test_transcripts.py
src/models/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/models/**/*.py: Use@field_validatorand@model_validatorfor custom validation in Pydantic models
Type hints for Pydantic models:Optional[FilePath],PositiveInt,SecretStr
Usetyping_extensions.Selffor model validators in Pydantic models
Pydantic config classes extendConfigurationBase, data models extendBaseModel
Use@model_validatorand@field_validatorfor validation in Pydantic models
Docstring Attributes section documents Pydantic model attributes
Files:
src/models/common/responses/types.pysrc/models/cache_entry.pysrc/models/rlsapi/responses.pysrc/models/common/mcp.pysrc/models/common/health.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/configuration.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/feedback.pysrc/models/common/moderation.pysrc/models/api/responses/successful/query.pysrc/models/api/responses/successful/conversations.pysrc/models/common/responses/__init__.pysrc/models/api/responses/successful/prompts.pysrc/models/common/responses/responses_api_params.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/__init__.pysrc/models/context.pysrc/models/api/responses/successful/probes.pysrc/models/common/turn_summary.pysrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/requests.pysrc/models/common/transcripts.pysrc/models/api/responses/successful/responses_openai.pysrc/models/api/responses/successful/catalog.py
src/app/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Use FastAPI dependencies:
from fastapi import APIRouter, HTTPException, Request, status, Depends
Files:
src/app/endpoints/rags.pysrc/app/endpoints/shields.pysrc/app/endpoints/authorized.pysrc/app/endpoints/providers.pysrc/app/main.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/tools.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/responses.pysrc/app/endpoints/vector_stores.pysrc/app/endpoints/config.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/feedback.pysrc/app/endpoints/root.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/health.pysrc/app/endpoints/prompts.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/query.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.py
src/app/endpoints/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Use FastAPI
HTTPExceptionwith appropriate status codes for API endpoint error handling
Files:
src/app/endpoints/rags.pysrc/app/endpoints/shields.pysrc/app/endpoints/authorized.pysrc/app/endpoints/providers.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/tools.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/responses.pysrc/app/endpoints/vector_stores.pysrc/app/endpoints/config.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/feedback.pysrc/app/endpoints/root.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/health.pysrc/app/endpoints/prompts.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/query.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.py
src/**/__init__.py
📄 CodeRabbit inference engine (AGENTS.md)
Package
__init__.pyfiles contain brief package descriptions
Files:
src/models/common/responses/__init__.pysrc/models/common/__init__.pysrc/models/api/responses/__init__.pysrc/models/api/responses/successful/__init__.py
🧠 Learnings (6)
📚 Learning: 2026-01-12T10:58:40.230Z
Learnt from: blublinsky
Repo: lightspeed-core/lightspeed-stack PR: 972
File: src/models/config.py:459-513
Timestamp: 2026-01-12T10:58:40.230Z
Learning: In lightspeed-core/lightspeed-stack, for Python files under src/models, when a user claims a fix is done but the issue persists, verify the current code state before accepting the fix. Steps: review the diff, fetch the latest changes, run relevant tests, reproduce the issue, search the codebase for lingering references to the original problem, confirm the fix is applied and not undone by subsequent commits, and validate with local checks to ensure the issue is resolved.
Applied to files:
src/models/common/responses/types.pysrc/models/cache_entry.pysrc/models/rlsapi/responses.pysrc/models/common/mcp.pysrc/models/common/health.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/configuration.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/feedback.pysrc/models/common/moderation.pysrc/models/api/responses/successful/query.pysrc/models/api/responses/successful/conversations.pysrc/models/common/responses/__init__.pysrc/models/api/responses/successful/prompts.pysrc/models/common/responses/responses_api_params.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/__init__.pysrc/models/context.pysrc/models/api/responses/successful/probes.pysrc/models/common/turn_summary.pysrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/requests.pysrc/models/common/transcripts.pysrc/models/api/responses/successful/responses_openai.pysrc/models/api/responses/successful/catalog.py
📚 Learning: 2026-02-25T07:46:33.545Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1211
File: src/models/responses.py:8-16
Timestamp: 2026-02-25T07:46:33.545Z
Learning: In the Python codebase, requests.py should use OpenAIResponseInputTool as Tool while responses.py uses OpenAIResponseTool as Tool. This difference is intentional due to differing schemas for input vs output tools in llama-stack-api. Apply this distinction consistently to other models under src/models (e.g., ensure request-related tools use the InputTool variant and response-related tools use the ResponseTool variant). If adding new tools, choose the corresponding InputTool or Tool class based on whether the tool represents input or output, and document the rationale in code comments.
Applied to files:
src/models/common/responses/types.pysrc/models/cache_entry.pysrc/models/rlsapi/responses.pysrc/models/common/mcp.pysrc/models/common/health.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/configuration.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/feedback.pysrc/models/common/moderation.pysrc/models/api/responses/successful/query.pysrc/models/api/responses/successful/conversations.pysrc/models/common/responses/__init__.pysrc/models/api/responses/successful/prompts.pysrc/models/common/responses/responses_api_params.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/__init__.pysrc/models/context.pysrc/models/api/responses/successful/probes.pysrc/models/common/turn_summary.pysrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/requests.pysrc/models/common/transcripts.pysrc/models/api/responses/successful/responses_openai.pysrc/models/api/responses/successful/catalog.py
📚 Learning: 2026-04-06T20:18:07.852Z
Learnt from: major
Repo: lightspeed-core/lightspeed-stack PR: 1463
File: src/app/endpoints/rlsapi_v1.py:266-271
Timestamp: 2026-04-06T20:18:07.852Z
Learning: In the lightspeed-stack codebase, within `src/app/endpoints/` inference/MCP endpoints, treat `tools: Optional[list[Any]]` in MCP tool definitions as an intentional, consistent typing pattern (used across `query`, `responses`, `streaming_query`, `rlsapi_v1`). Do not raise or suggest this as a typing issue during code review; changing it in isolation could break endpoint typing consistency across the codebase.
Applied to files:
src/app/endpoints/rags.pysrc/app/endpoints/shields.pysrc/app/endpoints/authorized.pysrc/app/endpoints/providers.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/tools.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/responses.pysrc/app/endpoints/vector_stores.pysrc/app/endpoints/config.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/feedback.pysrc/app/endpoints/root.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/health.pysrc/app/endpoints/prompts.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/query.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.py
📚 Learning: 2026-04-15T18:54:07.540Z
Learnt from: Lifto
Repo: lightspeed-core/lightspeed-stack PR: 1510
File: src/models/requests.py:769-773
Timestamp: 2026-04-15T18:54:07.540Z
Learning: In lightspeed-core/lightspeed-stack request models, keep schema-level size limits defined as inline numeric literals (e.g., Pydantic Field max_length values used for validation) rather than extracting them into constants.py. Only extract values intended as configurable runtime defaults (e.g., DEFAULT_* settings like header/file upload sizes). Do not flag inline numeric literals used directly in Pydantic Field constraints or field validators as an extraction-to-constants issue.
Applied to files:
src/models/requests.py
📚 Learning: 2026-02-23T14:56:59.186Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1198
File: src/utils/responses.py:184-192
Timestamp: 2026-02-23T14:56:59.186Z
Learning: In the lightspeed-stack codebase (lightspeed-core/lightspeed-stack), do not enforce de-duplication of duplicate client.models.list() calls in model selection flows (e.g., in src/utils/responses.py prepare_responses_params). These calls are considered relatively cheap and removing duplicates could add unnecessary complexity to the flow. Apply this guideline specifically to this file/context unless similar performance characteristics and design decisions are documented elsewhere.
Applied to files:
src/utils/responses.py
📚 Learning: 2026-01-14T09:37:51.612Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 988
File: src/app/endpoints/query.py:319-339
Timestamp: 2026-01-14T09:37:51.612Z
Learning: In the lightspeed-stack repository, when provider_id == "azure", the Azure provider with provider_type "remote::azure" is guaranteed to be present in the providers list. Therefore, avoid defensive StopIteration handling for next() when locating the Azure provider in providers within src/app/endpoints/query.py. This change applies specifically to this file (or nearby provider lookup code) and relies on the invariant that the Azure provider exists; if the invariant could be violated, keep the existing StopIteration handling.
Applied to files:
src/app/endpoints/query.py
🪛 markdownlint-cli2 (0.22.1)
src/models/api/README.md
[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
src/models/api/responses/README.md
[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 9-9: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 12-12: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
src/models/api/responses/successful/README.md
[warning] 3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 9-9: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 12-12: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 15-15: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 18-18: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 21-21: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 24-24: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 27-27: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 30-30: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 33-33: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
794d9bc to
ad420c2
Compare
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/models/api/responses/successful/catalog.py (1)
10-259: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAll seven classes in this file are missing
Attributessections in their docstrings.
ModelsResponse,ToolsResponse,ShieldsResponse,RAGInfoResponse,RAGListResponse,ProvidersListResponse, andProviderResponseeach have a single-line docstring with noAttributessection documenting their Pydantic fields.Example fix for
RAGInfoResponse(apply the same pattern to the remaining six):📝 Proposed fix (RAGInfoResponse example)
class RAGInfoResponse(AbstractSuccessfulResponse): - """Model representing a response with information about RAG DB.""" + """Model representing a response with information about RAG DB. + + Attributes: + id: Vector DB unique ID. + name: Human readable vector DB name (optional). + created_at: Unix timestamp when the vector store was created. + last_active_at: Unix timestamp of last activity (optional). + usage_bytes: Storage bytes used by this vector DB. + expires_at: Unix timestamp when the vector store expires (optional). + object: Object type identifier. + status: Vector DB status string. + """As per coding guidelines, "Docstring Attributes section documents Pydantic model attributes."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/api/responses/successful/catalog.py` around lines 10 - 259, Each Pydantic response class (ModelsResponse, ToolsResponse, ShieldsResponse, RAGInfoResponse, RAGListResponse, ProvidersListResponse, ProviderResponse) needs an "Attributes" section added to its docstring listing each model field (name and short type/description) to satisfy the project's docstring guideline; update each class docstring to include an Attributes block that documents fields like models (list[dict]), tools (list[dict]), shields (list[dict]), id/name/created_at/last_active_at/usage_bytes/expires_at/object/status for RAGInfoResponse, rags (list[str]) for RAGListResponse, providers (dict[str, list[dict]]) for ProvidersListResponse, and api/config/health/provider_id/provider_type for ProviderResponse — keep descriptions concise and mirror the field descriptions already in the Field(...) calls.src/models/common/turn_summary.py (1)
13-105: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAdd
Attributessections for the new Pydantic model docstrings.Several class docstrings describe purpose but omit field-level
Attributesdocumentation, which breaks the repo’s docstring standard for models.As per coding guidelines: "Follow Google Python docstring conventions for all modules, classes, and functions" and "Docstring Attributes section documents Pydantic model attributes".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/common/turn_summary.py` around lines 13 - 105, The model classes (RAGChunk, ReferencedDocument, RAGContext, ToolCallSummary, ToolResultSummary, TurnSummary) have docstrings but lack the Google-style "Attributes" sections required by our docstring standard; update each class docstring to include an "Attributes" section that lists and briefly describes each Pydantic field (e.g., for RAGChunk: content, source, score, attributes; for ReferencedDocument: doc_url, doc_title, source; for RAGContext: context_text, rag_chunks, referenced_documents; for ToolCallSummary: id, name, args, type; for ToolResultSummary: id, status, content, type, round; for TurnSummary: id, llm_response, tool_calls, tool_results, rag_chunks, referenced_documents, token_usage), using Google Python docstring formatting and matching the Field descriptions already present.docs/openapi.json (1)
6176-19470:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winCI blocker:
docs/openapi.jsonmust be regenerated, not hand-edited.The Spectral pipeline fails with:
OpenAPI schema is out of date. diff -u docs/openapi.json /tmp/openapi-generated.json failed; regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.jsonAll the description expansions and the
format: "text/event-stream"removal were applied directly to the JSON file. The correct workflow is to update the Pydantic model docstrings/class bodies and then let the generation script produce the JSON. Committing a manually-editeddocs/openapi.jsonwill keep failing CI on every run until regenerated.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/openapi.json` around lines 6176 - 19470, Manual edits to the generated OpenAPI JSON caused CI to fail; revert the changes to docs/openapi.json and regenerate it from the source Pydantic models by running the generation script (use the project's command: uv run python scripts/generate_openapi_schema.py docs/openapi.json), and if you intended to change descriptions or the SSE schema update the Pydantic model docstrings / class attributes (models referenced by ResponsesRequest/ResponsesResponse, RlsapiV1*, QueryRequest, etc.) then re-run the generator so the JSON is produced deterministically rather than hand-editing docs/openapi.json.
♻️ Duplicate comments (3)
src/models/api/responses/README.md (1)
9-13:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd required blank lines around these section headings.
The new headings still violate MD022 (
blanks-around-headings), which will keep markdownlint warnings active.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/api/responses/README.md` around lines 9 - 13, The section headings "## [error/](error/README.md)" and "## [successful/](successful/README.md)" lack the required blank lines; insert a single blank line before and after each heading so they are separated from surrounding content (i.e., ensure one empty line above "## [error/](error/README.md)" and one empty line below it, and do the same for "## [successful/](successful/README.md)") to satisfy MD022.src/models/api/responses/successful/README.md (1)
3-37:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix MD022 heading spacing in this README.
The section headings still are not surrounded with required blank lines, so markdownlint continues to fail.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/api/responses/successful/README.md` around lines 3 - 37, The README.md violates MD022 because each level-2 heading (e.g., "## [__init__.py](__init__.py)", "## [bases.py](bases.py)", etc.) is not surrounded by blank lines; update the file so there is exactly one blank line before and one blank line after each "## ..." heading (including the first heading) to satisfy markdownlint MD022, preserving the existing heading text and list content.src/models/api/responses/successful/feedback.py (1)
42-56:⚠️ Potential issue | 🟠 Major | ⚡ Quick winTighten
statusto a typed nested model instead ofdict[str, Any].
status: dict[str, Any]keeps validation/schema open-ended and weakens the response contract. Define a dedicated Pydantic model forstatusand use it here.Suggested change
-from typing import Any - -from pydantic import Field +from pydantic import BaseModel, Field ... +class FeedbackStatus(BaseModel): + """Status payload for feedback status updates.""" + + previous_status: bool + updated_status: bool + updated_by: str + timestamp: str + + class FeedbackStatusUpdateResponse(AbstractSuccessfulResponse): ... - status: dict[str, Any] + status: FeedbackStatusAs per coding guidelines, "Complete type annotations for all class attributes, use specific types, not
Any."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/api/responses/successful/feedback.py` around lines 42 - 56, Replace the open-ended status: dict[str, Any] with a concrete nested Pydantic model: create a new class (e.g., FeedbackStatus or StatusModel) inheriting from BaseModel that defines fields previous_status: bool, updated_status: bool, updated_by: str, timestamp: str (or datetime if preferred), then update the parent response model's status annotation to that new model and adjust the model_config example to use the typed model shape; ensure imports for BaseModel and typing are added and any JSON/schema generation will reflect the stricter contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/openapi.json`:
- Around line 16501-16504: The OpenAPI schema for PromptDeleteResponse is
inconsistent: the required array lists "success" but the description (and likely
Pydantic model) uses "deleted". Update the PromptDeleteResponse schema so the
required property matches the actual field name — either rename the property
back to "success" everywhere or change the required entry to "deleted" (and
regenerate the spec from the Pydantic model if the model field is named deleted)
so the schema properties, required array, and description are all consistent.
In `@src/app/endpoints/conversations_v2.py`:
- Around line 27-30: The current imports of ConversationTurn and Message from
models.common are incompatible with how build_conversation_turn_from_cache_entry
populates fields (referenced_documents, tool_results, provider, model,
started_at, completed_at); update the import to use the conversation response
models that contain the full turn/message schema used by
ConversationResponse.chat_history (replace the models.common imports with the
ConversationResponse/ConversationTurn/Message classes from the conversation
response module) and ensure build_conversation_turn_from_cache_entry still maps
those fields to the response model properties.
In `@src/models/api/responses/successful/bases.py`:
- Around line 17-31: The openapi_response classmethod in this file currently
raises SchemaError when examples are missing; replace that runtime exception
with ValueError (update the raise in cls.openapi_response to raise
ValueError(f"Examples not found in {cls.__name__}")), and also update the
docstring/Raises section in AbstractDeleteResponse.openapi_response() to list
ValueError instead of SchemaError; keep the error message text the same for
consistency.
- Around line 34-57: The class docstring for AbstractDeleteResponse is missing
an Attributes section; update the docstring on AbstractDeleteResponse to include
an "Attributes" subsection that documents the Pydantic fields and computed
properties: deleted (bool) — whether the deletion was successful, resource_name
(ClassVar[str]) — the resource identifier, response (computed_field) —
human-readable outcome of the delete operation, and success (computed_field,
deprecated) — legacy success flag that returns True and is deprecated. Ensure
the wording matches existing docstring style and note that success is
deprecated.
- Around line 53-57: The computed_field method success currently calls
logger.warning on every serialization which floods logs; replace that call with
Python's warnings.warn using DeprecationWarning (e.g.,
warnings.warn("...deprecated...", DeprecationWarning, stacklevel=2)) so warnings
are deduplicated per process; add the necessary import for the warnings module
and keep the method returning True (method name: success, decorator:
`@computed_field`).
In `@src/models/api/responses/successful/conversations.py`:
- Around line 77-108: Update the ConversationDeleteResponse class docstring to
include an Attributes section that documents the Pydantic fields: document
resource_name: ClassVar[str] (the resource label, e.g., "Conversation") and
conversation_id: str (identifier passed to delete, with example UUID). Add brief
types and descriptions for both in the Attributes section of the
ConversationDeleteResponse docstring so it follows the project's docstring
guideline for Pydantic models.
In `@src/models/api/responses/successful/probes.py`:
- Around line 127-131: The attribute `status` is currently annotated as bare
`dict`; update its type to `dict[str, Any]` to provide a string-keyed mapping
and import `Any` from `typing` (or `collections.abc` if preferred) so the
annotation is complete; locate the `status: dict = Field(...)` declaration and
change it to `status: dict[str, Any] = Field(...)` and add the necessary `from
typing import Any` import near the other imports.
In `@src/models/api/responses/successful/query.py`:
- Around line 197-203: The SSE example for the "end" event currently places
"available_quotas" as a sibling of "event" and "data" due to how the string
fragments are concatenated; update the concatenation so that the
'"available_quotas": {}' key is included inside the "data" object for the
'"event": "end"' payload (i.e., ensure the fragment with '"available_quotas":
{}' is appended within the same string literal that builds the '"data": { ... }'
block in the SSE "end" event example).
In `@src/models/common/mcp.py`:
- Around line 6-13: The MCPServerAuthInfo Pydantic model docstring lacks an
Attributes section; update the class docstring for MCPServerAuthInfo to include
an "Attributes" section documenting the model fields `name: str` (MCP server
name) and `client_auth_headers: list[str]` (list of authentication header names
for client-provided tokens), describing their types and purposes consistent with
other model docstrings in the codebase.
In `@src/models/common/responses/__init__.py`:
- Around line 14-21: The module-level constant __all__ should be annotated as a
Final; add an import for Final from typing (e.g. from typing import Final) if
missing and change the declaration to use Final (for example: __all__:
Final[List[str]] = [...]) so the constant follows the project's typing
convention; update any existing typing imports to include Final and keep the
same list contents and name (__all__).
In `@tests/unit/app/endpoints/test_conversations_v2.py`:
- Line 25: The test imports models.common.ConversationData but constructs a
fixture with conversation_id, topic_summary, and last_message_timestamp which
doesn't match that schema; fix by either importing and using the correct
cache/list metadata model that contains those fields (replace the
ConversationData import with the appropriate model used elsewhere for list/cache
metadata) or change the fixture to a lightweight mock (e.g., SimpleNamespace or
a small dict/object) that exposes conversation_id, topic_summary, and
last_message_timestamp so validation won't run against the stricter
ConversationData schema.
---
Outside diff comments:
In `@docs/openapi.json`:
- Around line 6176-19470: Manual edits to the generated OpenAPI JSON caused CI
to fail; revert the changes to docs/openapi.json and regenerate it from the
source Pydantic models by running the generation script (use the project's
command: uv run python scripts/generate_openapi_schema.py docs/openapi.json),
and if you intended to change descriptions or the SSE schema update the Pydantic
model docstrings / class attributes (models referenced by
ResponsesRequest/ResponsesResponse, RlsapiV1*, QueryRequest, etc.) then re-run
the generator so the JSON is produced deterministically rather than hand-editing
docs/openapi.json.
In `@src/models/api/responses/successful/catalog.py`:
- Around line 10-259: Each Pydantic response class (ModelsResponse,
ToolsResponse, ShieldsResponse, RAGInfoResponse, RAGListResponse,
ProvidersListResponse, ProviderResponse) needs an "Attributes" section added to
its docstring listing each model field (name and short type/description) to
satisfy the project's docstring guideline; update each class docstring to
include an Attributes block that documents fields like models (list[dict]),
tools (list[dict]), shields (list[dict]),
id/name/created_at/last_active_at/usage_bytes/expires_at/object/status for
RAGInfoResponse, rags (list[str]) for RAGListResponse, providers (dict[str,
list[dict]]) for ProvidersListResponse, and
api/config/health/provider_id/provider_type for ProviderResponse — keep
descriptions concise and mirror the field descriptions already in the Field(...)
calls.
In `@src/models/common/turn_summary.py`:
- Around line 13-105: The model classes (RAGChunk, ReferencedDocument,
RAGContext, ToolCallSummary, ToolResultSummary, TurnSummary) have docstrings but
lack the Google-style "Attributes" sections required by our docstring standard;
update each class docstring to include an "Attributes" section that lists and
briefly describes each Pydantic field (e.g., for RAGChunk: content, source,
score, attributes; for ReferencedDocument: doc_url, doc_title, source; for
RAGContext: context_text, rag_chunks, referenced_documents; for ToolCallSummary:
id, name, args, type; for ToolResultSummary: id, status, content, type, round;
for TurnSummary: id, llm_response, tool_calls, tool_results, rag_chunks,
referenced_documents, token_usage), using Google Python docstring formatting and
matching the Field descriptions already present.
---
Duplicate comments:
In `@src/models/api/responses/README.md`:
- Around line 9-13: The section headings "## [error/](error/README.md)" and "##
[successful/](successful/README.md)" lack the required blank lines; insert a
single blank line before and after each heading so they are separated from
surrounding content (i.e., ensure one empty line above "##
[error/](error/README.md)" and one empty line below it, and do the same for "##
[successful/](successful/README.md)") to satisfy MD022.
In `@src/models/api/responses/successful/feedback.py`:
- Around line 42-56: Replace the open-ended status: dict[str, Any] with a
concrete nested Pydantic model: create a new class (e.g., FeedbackStatus or
StatusModel) inheriting from BaseModel that defines fields previous_status:
bool, updated_status: bool, updated_by: str, timestamp: str (or datetime if
preferred), then update the parent response model's status annotation to that
new model and adjust the model_config example to use the typed model shape;
ensure imports for BaseModel and typing are added and any JSON/schema generation
will reflect the stricter contract.
In `@src/models/api/responses/successful/README.md`:
- Around line 3-37: The README.md violates MD022 because each level-2 heading
(e.g., "## [__init__.py](__init__.py)", "## [bases.py](bases.py)", etc.) is not
surrounded by blank lines; update the file so there is exactly one blank line
before and one blank line after each "## ..." heading (including the first
heading) to satisfy markdownlint MD022, preserving the existing heading text and
list content.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7f4f63e3-781b-4765-a04a-3cdae335c3dd
📒 Files selected for processing (118)
docs/openapi.jsonsrc/app/endpoints/authorized.pysrc/app/endpoints/config.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/feedback.pysrc/app/endpoints/health.pysrc/app/endpoints/info.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/metrics.pysrc/app/endpoints/models.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/query.pysrc/app/endpoints/rags.pysrc/app/endpoints/responses.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/root.pysrc/app/endpoints/shields.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/tools.pysrc/app/endpoints/vector_stores.pysrc/app/main.pysrc/authentication/jwk_token.pysrc/authentication/k8s.pysrc/authentication/utils.pysrc/authorization/middleware.pysrc/cache/cache.pysrc/cache/in_memory_cache.pysrc/cache/noop_cache.pysrc/cache/postgres_cache.pysrc/cache/sqlite_cache.pysrc/client.pysrc/metrics/utils.pysrc/models/api/README.mdsrc/models/api/responses/README.mdsrc/models/api/responses/__init__.pysrc/models/api/responses/error/README.mdsrc/models/api/responses/successful/README.mdsrc/models/api/responses/successful/__init__.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/catalog.pysrc/models/api/responses/successful/configuration.pysrc/models/api/responses/successful/conversations.pysrc/models/api/responses/successful/feedback.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/api/responses/successful/probes.pysrc/models/api/responses/successful/prompts.pysrc/models/api/responses/successful/query.pysrc/models/api/responses/successful/responses_openai.pysrc/models/api/responses/successful/vector_stores.pysrc/models/cache_entry.pysrc/models/common/__init__.pysrc/models/common/conversation.pysrc/models/common/health.pysrc/models/common/mcp.pysrc/models/common/moderation.pysrc/models/common/responses/__init__.pysrc/models/common/responses/responses_api_params.pysrc/models/common/responses/responses_context.pysrc/models/common/responses/responses_conversation_context.pysrc/models/common/responses/types.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/context.pysrc/models/requests.pysrc/models/responses.pysrc/models/rlsapi/responses.pysrc/utils/conversations.pysrc/utils/endpoints.pysrc/utils/mcp_oauth_probe.pysrc/utils/prompts.pysrc/utils/query.pysrc/utils/quota.pysrc/utils/responses.pysrc/utils/shields.pysrc/utils/transcripts.pysrc/utils/types.pysrc/utils/vector_search.pytests/integration/endpoints/test_query_byok_integration.pytests/integration/endpoints/test_rlsapi_v1_integration.pytests/integration/test_middleware_integration.pytests/unit/app/endpoints/test_a2a.pytests/unit/app/endpoints/test_config.pytests/unit/app/endpoints/test_conversations.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/endpoints/test_health.pytests/unit/app/endpoints/test_mcp_auth.pytests/unit/app/endpoints/test_mcp_servers.pytests/unit/app/endpoints/test_prompts.pytests/unit/app/endpoints/test_query.pytests/unit/app/endpoints/test_responses.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/app/endpoints/test_shields.pytests/unit/app/endpoints/test_stream_interrupt.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/app/endpoints/test_tools.pytests/unit/app/test_main_middleware.pytests/unit/cache/test_postgres_cache.pytests/unit/cache/test_sqlite_cache.pytests/unit/models/responses/test_authorized_response.pytests/unit/models/responses/test_error_responses.pytests/unit/models/responses/test_query_response.pytests/unit/models/responses/test_rag_chunk.pytests/unit/models/responses/test_response_types.pytests/unit/models/responses/test_successful_responses.pytests/unit/models/responses/test_types.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/utils/test_endpoints.pytests/unit/utils/test_query.pytests/unit/utils/test_shields.pytests/unit/utils/test_transcripts.pytests/unit/utils/test_types.pytests/unit/utils/test_vector_search.py
💤 Files with no reviewable changes (2)
- src/models/api/responses/error/README.md
- src/models/responses.py
📜 Review details
⏰ 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). (9)
- GitHub Check: build-pr
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
- GitHub Check: E2E: server mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 2
- GitHub Check: E2E: library mode / ci / group 1
- GitHub Check: E2E Tests for Lightspeed Evaluation job
- GitHub Check: E2E: library mode / ci / group 3
🧰 Additional context used
📓 Path-based instructions (7)
src/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.py: Use absolute imports for internal modules:from authentication import get_auth_dependency
All modules start with descriptive docstrings explaining purpose
Uselogger = get_logger(__name__)fromlog.pyfor module logging
Type aliases defined at module level for clarity
Use Final[type] as type hint for all constants
All functions require docstrings with brief descriptions
Complete type annotations for function parameters and return types
Use Union types with modern syntax:str | int
UseOptional[Type]for optional type hints
Use snake_case with descriptive, action-oriented function names (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns: return new data structures instead of modifying parameters
Useasync deffor I/O operations and external API calls
Uselogger.debug()for detailed diagnostic information
Uselogger.info()for general information about program execution
Uselogger.warning()for unexpected events or potential problems
Uselogger.error()for serious problems that prevented function execution
All classes require descriptive docstrings explaining purpose
Use PascalCase for class names with descriptive names and standard suffixes:Configuration,Error/Exception,Resolver,Interface
Abstract classes use ABC with@abstractmethoddecorators
Complete type annotations for all class attributes, use specific types, notAny
Follow Google Python docstring conventions for all modules, classes, and functions
Docstring Parameters section documents function parameters
Docstring Returns section documents function return values
Docstring Raises section documents exceptions that may be raised
Use black for code formatting
Use pylint for static analysis with source-roots configuration set to "src"
Use pyright for type checking
Use ruff for fast linting
Use pydocstyle for docstring style validation
Use mypy for additional type checking
Use bandit for security issue detection
Files:
src/app/endpoints/metrics.pysrc/cache/cache.pysrc/utils/prompts.pysrc/models/context.pysrc/app/endpoints/config.pysrc/models/common/responses/__init__.pysrc/app/endpoints/info.pysrc/models/common/responses/responses_conversation_context.pysrc/models/common/health.pysrc/authentication/jwk_token.pysrc/utils/quota.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/shields.pysrc/models/common/__init__.pysrc/models/common/mcp.pysrc/models/api/responses/successful/configuration.pysrc/authorization/middleware.pysrc/models/api/responses/successful/feedback.pysrc/utils/query.pysrc/app/endpoints/stream_interrupt.pysrc/models/api/responses/successful/mcp_servers.pysrc/app/endpoints/query.pysrc/app/endpoints/rlsapi_v1.pysrc/utils/mcp_oauth_probe.pysrc/models/common/moderation.pysrc/models/requests.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/root.pysrc/cache/sqlite_cache.pysrc/app/main.pysrc/client.pysrc/utils/conversations.pysrc/cache/in_memory_cache.pysrc/cache/postgres_cache.pysrc/models/common/conversation.pysrc/models/rlsapi/responses.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/successful/catalog.pysrc/app/endpoints/mcp_auth.pysrc/models/common/responses/responses_api_params.pysrc/models/api/responses/successful/query.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/probes.pysrc/app/endpoints/tools.pysrc/authentication/utils.pysrc/models/api/responses/successful/prompts.pysrc/metrics/utils.pysrc/app/endpoints/feedback.pysrc/models/api/responses/successful/conversations.pysrc/utils/endpoints.pysrc/models/cache_entry.pysrc/utils/types.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/health.pysrc/models/api/responses/successful/bases.pysrc/authentication/k8s.pysrc/app/endpoints/rags.pysrc/models/api/responses/successful/__init__.pysrc/app/endpoints/responses.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/models.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/api/responses/__init__.pysrc/models/api/responses/successful/responses_openai.pysrc/utils/responses.pysrc/app/endpoints/streaming_query.pysrc/utils/vector_search.pysrc/utils/shields.pysrc/cache/noop_cache.pysrc/app/endpoints/authorized.pysrc/app/endpoints/vector_stores.pysrc/models/common/responses/types.pysrc/utils/transcripts.py
src/app/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Use FastAPI dependencies:
from fastapi import APIRouter, HTTPException, Request, status, Depends
Files:
src/app/endpoints/metrics.pysrc/app/endpoints/config.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/shields.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/query.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/root.pysrc/app/main.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/tools.pysrc/app/endpoints/feedback.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/health.pysrc/app/endpoints/rags.pysrc/app/endpoints/responses.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/models.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/authorized.pysrc/app/endpoints/vector_stores.py
src/app/endpoints/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Use FastAPI
HTTPExceptionwith appropriate status codes for API endpoint error handling
Files:
src/app/endpoints/metrics.pysrc/app/endpoints/config.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/shields.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/query.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/root.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/tools.pysrc/app/endpoints/feedback.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/health.pysrc/app/endpoints/rags.pysrc/app/endpoints/responses.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/models.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/authorized.pysrc/app/endpoints/vector_stores.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
tests/unit/**/*.py: Use pytest for all unit and integration tests
Usepytest-mockfor AsyncMock objects in unit tests
Use markerpytest.mark.asynciofor async tests
Files:
tests/unit/app/test_main_middleware.pytests/unit/models/responses/test_response_types.pytests/unit/models/responses/test_types.pytests/unit/app/endpoints/test_stream_interrupt.pytests/unit/app/endpoints/test_prompts.pytests/unit/utils/test_types.pytests/unit/app/endpoints/test_shields.pytests/unit/cache/test_sqlite_cache.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/endpoints/test_config.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/cache/test_postgres_cache.pytests/unit/models/responses/test_query_response.pytests/unit/app/endpoints/test_mcp_servers.pytests/unit/utils/test_vector_search.pytests/unit/utils/test_transcripts.pytests/unit/app/endpoints/test_query.pytests/unit/models/responses/test_error_responses.pytests/unit/utils/test_shields.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/models/responses/test_rag_chunk.pytests/unit/app/endpoints/test_a2a.pytests/unit/utils/test_endpoints.pytests/unit/models/responses/test_authorized_response.pytests/unit/models/responses/test_successful_responses.pytests/unit/app/endpoints/test_health.pytests/unit/app/endpoints/test_responses.pytests/unit/app/endpoints/test_mcp_auth.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/app/endpoints/test_tools.pytests/unit/app/endpoints/test_conversations.pytests/unit/utils/test_query.py
tests/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Do not use unittest - pytest is the standard testing framework for this project
Files:
tests/unit/app/test_main_middleware.pytests/unit/models/responses/test_response_types.pytests/unit/models/responses/test_types.pytests/unit/app/endpoints/test_stream_interrupt.pytests/integration/test_middleware_integration.pytests/unit/app/endpoints/test_prompts.pytests/unit/utils/test_types.pytests/unit/app/endpoints/test_shields.pytests/unit/cache/test_sqlite_cache.pytests/unit/app/endpoints/test_conversations_v2.pytests/unit/app/endpoints/test_config.pytests/unit/app/endpoints/test_responses_splunk.pytests/unit/cache/test_postgres_cache.pytests/unit/models/responses/test_query_response.pytests/unit/app/endpoints/test_mcp_servers.pytests/unit/utils/test_vector_search.pytests/unit/utils/test_transcripts.pytests/unit/app/endpoints/test_query.pytests/unit/models/responses/test_error_responses.pytests/unit/utils/test_shields.pytests/unit/models/rlsapi/test_responses.pytests/unit/utils/test_conversations.pytests/unit/app/endpoints/test_rlsapi_v1.pytests/unit/models/responses/test_rag_chunk.pytests/unit/app/endpoints/test_a2a.pytests/unit/utils/test_endpoints.pytests/unit/models/responses/test_authorized_response.pytests/unit/models/responses/test_successful_responses.pytests/unit/app/endpoints/test_health.pytests/integration/endpoints/test_query_byok_integration.pytests/unit/app/endpoints/test_responses.pytests/unit/app/endpoints/test_mcp_auth.pytests/integration/endpoints/test_rlsapi_v1_integration.pytests/unit/app/endpoints/test_streaming_query.pytests/unit/app/endpoints/test_tools.pytests/unit/app/endpoints/test_conversations.pytests/unit/utils/test_query.py
src/models/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/models/**/*.py: Use@field_validatorand@model_validatorfor custom validation in Pydantic models
Type hints for Pydantic models:Optional[FilePath],PositiveInt,SecretStr
Usetyping_extensions.Selffor model validators in Pydantic models
Pydantic config classes extendConfigurationBase, data models extendBaseModel
Use@model_validatorand@field_validatorfor validation in Pydantic models
Docstring Attributes section documents Pydantic model attributes
Files:
src/models/context.pysrc/models/common/responses/__init__.pysrc/models/common/responses/responses_conversation_context.pysrc/models/common/health.pysrc/models/common/__init__.pysrc/models/common/mcp.pysrc/models/api/responses/successful/configuration.pysrc/models/api/responses/successful/feedback.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/common/moderation.pysrc/models/requests.pysrc/models/common/conversation.pysrc/models/rlsapi/responses.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/successful/catalog.pysrc/models/common/responses/responses_api_params.pysrc/models/api/responses/successful/query.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/probes.pysrc/models/api/responses/successful/prompts.pysrc/models/api/responses/successful/conversations.pysrc/models/cache_entry.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/__init__.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/api/responses/__init__.pysrc/models/api/responses/successful/responses_openai.pysrc/models/common/responses/types.py
src/**/__init__.py
📄 CodeRabbit inference engine (AGENTS.md)
Package
__init__.pyfiles contain brief package descriptions
Files:
src/models/common/responses/__init__.pysrc/models/common/__init__.pysrc/models/api/responses/successful/__init__.pysrc/models/api/responses/__init__.py
🧠 Learnings (6)
📚 Learning: 2026-04-06T20:18:07.852Z
Learnt from: major
Repo: lightspeed-core/lightspeed-stack PR: 1463
File: src/app/endpoints/rlsapi_v1.py:266-271
Timestamp: 2026-04-06T20:18:07.852Z
Learning: In the lightspeed-stack codebase, within `src/app/endpoints/` inference/MCP endpoints, treat `tools: Optional[list[Any]]` in MCP tool definitions as an intentional, consistent typing pattern (used across `query`, `responses`, `streaming_query`, `rlsapi_v1`). Do not raise or suggest this as a typing issue during code review; changing it in isolation could break endpoint typing consistency across the codebase.
Applied to files:
src/app/endpoints/metrics.pysrc/app/endpoints/config.pysrc/app/endpoints/info.pysrc/app/endpoints/conversations_v1.pysrc/app/endpoints/shields.pysrc/app/endpoints/stream_interrupt.pysrc/app/endpoints/query.pysrc/app/endpoints/rlsapi_v1.pysrc/app/endpoints/conversations_v2.pysrc/app/endpoints/root.pysrc/app/endpoints/mcp_auth.pysrc/app/endpoints/tools.pysrc/app/endpoints/feedback.pysrc/app/endpoints/mcp_servers.pysrc/app/endpoints/health.pysrc/app/endpoints/rags.pysrc/app/endpoints/responses.pysrc/app/endpoints/prompts.pysrc/app/endpoints/providers.pysrc/app/endpoints/models.pysrc/app/endpoints/streaming_query.pysrc/app/endpoints/authorized.pysrc/app/endpoints/vector_stores.py
📚 Learning: 2026-01-12T10:58:40.230Z
Learnt from: blublinsky
Repo: lightspeed-core/lightspeed-stack PR: 972
File: src/models/config.py:459-513
Timestamp: 2026-01-12T10:58:40.230Z
Learning: In lightspeed-core/lightspeed-stack, for Python files under src/models, when a user claims a fix is done but the issue persists, verify the current code state before accepting the fix. Steps: review the diff, fetch the latest changes, run relevant tests, reproduce the issue, search the codebase for lingering references to the original problem, confirm the fix is applied and not undone by subsequent commits, and validate with local checks to ensure the issue is resolved.
Applied to files:
src/models/context.pysrc/models/common/responses/__init__.pysrc/models/common/responses/responses_conversation_context.pysrc/models/common/health.pysrc/models/common/__init__.pysrc/models/common/mcp.pysrc/models/api/responses/successful/configuration.pysrc/models/api/responses/successful/feedback.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/common/moderation.pysrc/models/requests.pysrc/models/common/conversation.pysrc/models/rlsapi/responses.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/successful/catalog.pysrc/models/common/responses/responses_api_params.pysrc/models/api/responses/successful/query.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/probes.pysrc/models/api/responses/successful/prompts.pysrc/models/api/responses/successful/conversations.pysrc/models/cache_entry.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/__init__.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/api/responses/__init__.pysrc/models/api/responses/successful/responses_openai.pysrc/models/common/responses/types.py
📚 Learning: 2026-02-25T07:46:33.545Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1211
File: src/models/responses.py:8-16
Timestamp: 2026-02-25T07:46:33.545Z
Learning: In the Python codebase, requests.py should use OpenAIResponseInputTool as Tool while responses.py uses OpenAIResponseTool as Tool. This difference is intentional due to differing schemas for input vs output tools in llama-stack-api. Apply this distinction consistently to other models under src/models (e.g., ensure request-related tools use the InputTool variant and response-related tools use the ResponseTool variant). If adding new tools, choose the corresponding InputTool or Tool class based on whether the tool represents input or output, and document the rationale in code comments.
Applied to files:
src/models/context.pysrc/models/common/responses/__init__.pysrc/models/common/responses/responses_conversation_context.pysrc/models/common/health.pysrc/models/common/__init__.pysrc/models/common/mcp.pysrc/models/api/responses/successful/configuration.pysrc/models/api/responses/successful/feedback.pysrc/models/api/responses/successful/mcp_servers.pysrc/models/common/moderation.pysrc/models/requests.pysrc/models/common/conversation.pysrc/models/rlsapi/responses.pysrc/models/api/responses/successful/vector_stores.pysrc/models/api/responses/successful/catalog.pysrc/models/common/responses/responses_api_params.pysrc/models/api/responses/successful/query.pysrc/models/common/responses/responses_context.pysrc/models/api/responses/successful/probes.pysrc/models/api/responses/successful/prompts.pysrc/models/api/responses/successful/conversations.pysrc/models/cache_entry.pysrc/models/api/responses/successful/bases.pysrc/models/api/responses/successful/__init__.pysrc/models/common/transcripts.pysrc/models/common/turn_summary.pysrc/models/api/responses/__init__.pysrc/models/api/responses/successful/responses_openai.pysrc/models/common/responses/types.py
📚 Learning: 2026-01-14T09:37:51.612Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 988
File: src/app/endpoints/query.py:319-339
Timestamp: 2026-01-14T09:37:51.612Z
Learning: In the lightspeed-stack repository, when provider_id == "azure", the Azure provider with provider_type "remote::azure" is guaranteed to be present in the providers list. Therefore, avoid defensive StopIteration handling for next() when locating the Azure provider in providers within src/app/endpoints/query.py. This change applies specifically to this file (or nearby provider lookup code) and relies on the invariant that the Azure provider exists; if the invariant could be violated, keep the existing StopIteration handling.
Applied to files:
src/app/endpoints/query.py
📚 Learning: 2026-04-15T18:54:07.540Z
Learnt from: Lifto
Repo: lightspeed-core/lightspeed-stack PR: 1510
File: src/models/requests.py:769-773
Timestamp: 2026-04-15T18:54:07.540Z
Learning: In lightspeed-core/lightspeed-stack request models, keep schema-level size limits defined as inline numeric literals (e.g., Pydantic Field max_length values used for validation) rather than extracting them into constants.py. Only extract values intended as configurable runtime defaults (e.g., DEFAULT_* settings like header/file upload sizes). Do not flag inline numeric literals used directly in Pydantic Field constraints or field validators as an extraction-to-constants issue.
Applied to files:
src/models/requests.py
📚 Learning: 2026-02-23T14:56:59.186Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1198
File: src/utils/responses.py:184-192
Timestamp: 2026-02-23T14:56:59.186Z
Learning: In the lightspeed-stack codebase (lightspeed-core/lightspeed-stack), do not enforce de-duplication of duplicate client.models.list() calls in model selection flows (e.g., in src/utils/responses.py prepare_responses_params). These calls are considered relatively cheap and removing duplicates could add unnecessary complexity to the flow. Apply this guideline specifically to this file/context unless similar performance characteristics and design decisions are documented elsewhere.
Applied to files:
src/utils/responses.py
🪛 GitHub Actions: OpenAPI (Spectral)
docs/openapi.json
[error] 1-1: OpenAPI schema is out of date. diff -u docs/openapi.json /tmp/openapi-generated.json failed; regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json.
🪛 markdownlint-cli2 (0.22.1)
src/models/api/responses/successful/README.md
[warning] 3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 9-9: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 12-12: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 15-15: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 18-18: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 21-21: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 24-24: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 27-27: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 30-30: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 33-33: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
src/models/api/README.md
[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
src/models/api/responses/README.md
[warning] 9-9: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 12-12: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
ad420c2 to
5f8f41a
Compare
5f8f41a to
53ff338
Compare
Description
Replaces successful responses from monolithic responses.py into multiple shorter files. Unifies documentation. Updates imports. No functional changes,
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit
Documentation
Chores