Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Sep 26, 2025

Description

Regenerated OpenAPI specification

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-632

Summary by CodeRabbit

  • New Features

    • Expanded API responses: QueryResponse now includes rag_chunks, tool_calls, and referenced_documents.
    • Introduced conversation_cache configuration with support for noop, memory, sqlite, and postgres.
    • Added new public models: RAGChunk, ReferencedDocument, ToolCall, and InMemoryCacheConfig (with max_entries).
  • Documentation

    • Updated OpenAPI and docs to describe new models and fields, with refreshed examples.
    • Added ConversationCacheConfiguration and InMemoryCacheConfig sections.
    • Included ReferencedDocument details in readiness output.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

Walkthrough

Adds new public schemas and fields to OpenAPI documentation: extends QueryResponse with rag_chunks, tool_calls, referenced_documents; introduces RAGChunk, ToolCall, ReferencedDocument; adds ConversationCacheConfiguration and InMemoryCacheConfig; updates Configuration to include conversation_cache; refreshes examples and markdown sections accordingly.

Changes

Cohort / File(s) Summary
OpenAPI schema (JSON)
docs/openapi.json
Expands QueryResponse with rag_chunks, tool_calls, referenced_documents; adds schemas RAGChunk, ToolCall, ReferencedDocument; introduces ConversationCacheConfiguration and InMemoryCacheConfig; updates Configuration to reference conversation_cache; updates examples.
OpenAPI documentation (Markdown)
docs/openapi.md
Documents new/updated models: ConversationCacheConfiguration, InMemoryCacheConfig, RAGChunk, ReferencedDocument, ToolCall; reflects extended QueryResponse and Configuration; updates sample outputs and readiness references.
Docs output summary
docs/output.md
Summarizes added public models and extended response signatures; reiterates new configuration field conversation_cache and related types.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API
  participant RAG as RAG Retriever
  participant Tools as Tool Runner
  Client->>API: POST /query (prompt)
  API->>RAG: Retrieve chunks
  RAG-->>API: RAGChunk[]
  alt tools required
    API->>Tools: Invoke tool(s) with arguments
    Tools-->>API: ToolCall results
  end
  API-->>Client: QueryResponse { rag_chunks, tool_calls?, referenced_documents }
  note over API,Client: Response schema updated in OpenAPI
Loading
sequenceDiagram
  autonumber
  actor Admin
  participant Service as Service Config
  Admin->>Service: Set conversation_cache config
  Service-->>Admin: Confirms type (noop/memory/sqlite/postgres) and params (e.g., InMemoryCacheConfig.max_entries)
  note over Service: New ConversationCacheConfiguration in OpenAPI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • asamal4
  • VladimirKadlec

Poem

A rabbit taps docs with careful paws,
New chunks, tools, and refs obey the laws.
Cache burrows mapped—memory to PG—
Schemas aligned for all to see.
Hippity-hop, the spec now sings,
With tidy fields and documented things. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change of regenerating the OpenAPI specification and corresponds to the content of the updates to the API schemas and documentation.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/openapi.json (1)

676-679: Inconsistent field name in example vs schema

The 200 DELETE example uses "message" but schema defines "response". Align the example field name.

-                        "success": true,
-                        "message": "Conversation deleted successfully"
+                        "success": true,
+                        "response": "Conversation deleted successfully"
🧹 Nitpick comments (19)
docs/output.md (7)

565-566: Document the new field with a link and brief description

Add a short description and link to ConversationCacheConfiguration to make this discoverable.

-| conversation_cache |  |  |
+| conversation_cache |  | Conversation cache settings (see ConversationCacheConfiguration) |

568-579: Clarify allowed values and which sub-config applies

State allowed type values (noop, memory, sqlite, postgres) and that only the matching sub-config should be set.

-Conversation cache configuration.
+Conversation cache configuration.
+
+Allowed types: noop, memory, sqlite, postgres.
+Only the sub-configuration matching the selected type should be populated (e.g., memory when type=memory).

1131-1139: Remove TODOs from public API docs

The TODO lines leak internal roadmap into public docs. Either document them formally or omit for now.

-    TODO: truncated: Whether conversation history was truncated.
-    TODO: input_tokens: Number of tokens sent to LLM.
-    TODO: output_tokens: Number of tokens received from LLM.
-    TODO: available_quotas: Quota available as measured by all configured quota limiters
-    TODO: tool_results: List of tool results.

1141-1148: Specify type for tool_calls

The type column is empty; specify array or null to match the schema.

-| tool_calls |  | List of tool calls made during response generation |
+| tool_calls | array or null | List of tool calls made during response generation |

1156-1161: Add types for RAGChunk fields

Document types for source and score to match the schema (string or null, number or null).

-| source |  | Source document or URL |
-| score |  | Relevance score |
+| source | string or null | Source document or URL |
+| score | number or null | Relevance score |

1196-1210: Make doc_url type explicit and fix capitalization

Use “URL” and specify the type and format.

-    doc_url: Url to the referenced doc.
+    doc_url: URL to the referenced document.
...
-| doc_url |  | URL of the referenced document |
+| doc_url | string (URI) or null | URL of the referenced document |

1278-1289: Specify type for ToolCall.result

Add “object or null” to align with the schema.

-| result |  | Result from the tool |
+| result | object or null | Result from the tool |
docs/openapi.json (5)

1181-1234: Enforce config consistency with oneOf/if-then

Currently any combination of sub-configs is allowed. Add a discriminated union tying type to the required sub-config to prevent misconfiguration.

             "ConversationCacheConfiguration": {
-                "properties": {
+                "properties": {
                     "type": {
                         "anyOf": [
                             {
                                 "type": "string",
                                 "enum": [
                                     "noop",
                                     "memory",
                                     "sqlite",
                                     "postgres"
                                 ]
                             },
                             {
                                 "type": "null"
                             }
                         ],
                         "title": "Type"
                     },
                     "memory": {
                         "anyOf": [
                             {
                                 "$ref": "#/components/schemas/InMemoryCacheConfig"
                             },
                             {
                                 "type": "null"
                             }
                         ]
                     },
                     "sqlite": {
                         "anyOf": [
                             {
                                 "$ref": "#/components/schemas/SQLiteDatabaseConfiguration"
                             },
                             {
                                 "type": "null"
                             }
                         ]
                     },
                     "postgres": {
                         "anyOf": [
                             {
                                 "$ref": "#/components/schemas/PostgreSQLDatabaseConfiguration"
                             },
                             {
                                 "type": "null"
                             }
                         ]
                     }
                 },
+                "oneOf": [
+                    { "properties": { "type": { "const": "noop" } }, "required": ["type"] },
+                    { "properties": { "type": { "const": "memory" }, "memory": {} }, "required": ["type","memory"] },
+                    { "properties": { "type": { "const": "sqlite" }, "sqlite": {} }, "required": ["type","sqlite"] },
+                    { "properties": { "type": { "const": "postgres" }, "postgres": {} }, "required": ["type","postgres"] }
+                ],
                 "additionalProperties": false,
                 "type": "object",
                 "title": "ConversationCacheConfiguration",
                 "description": "Conversation cache configuration."
             },

1819-1833: Prefer minimum: 1 over exclusiveMinimum: 0 for compatibility

Some tools mishandle exclusiveMinimum on integers. Using minimum: 1 is clearer and widely supported.

-                    "max_entries": {
-                        "type": "integer",
-                        "exclusiveMinimum": 0.0,
-                        "title": "Max Entries"
-                    }
+                    "max_entries": {
+                        "type": "integer",
+                        "minimum": 1,
+                        "title": "Max Entries"
+                    }

2455-2494: Optional: add default empty arrays for consistency

Consider default: [] for referenced_documents to mirror rag_chunks, easing client handling.

                     "referenced_documents": {
                         "items": {
                             "$ref": "#/components/schemas/ReferencedDocument"
                         },
                         "type": "array",
                         "title": "Referenced Documents",
-                        "description": "List of documents referenced in generating the response",
+                        "description": "List of documents referenced in generating the response",
+                        "default": [],

2501-2502: Remove TODOs from public description

Keep schema descriptions clean; track TODOs elsewhere.

-                "description": "Model representing LLM response to a query.\n\nAttributes:\n    conversation_id: The optional conversation ID (UUID).\n    response: The response.\n    rag_chunks: List of RAG chunks used to generate the response.\n    referenced_documents: The URLs and titles for the documents used to generate the response.\n    tool_calls: List of tool calls made during response generation.\n    TODO: truncated: Whether conversation history was truncated.\n    TODO: input_tokens: Number of tokens sent to LLM.\n    TODO: output_tokens: Number of tokens received from LLM.\n    TODO: available_quotas: Quota available as measured by all configured quota limiters\n    TODO: tool_results: List of tool results.",
+                "description": "Model representing LLM response to a query.\n\nAttributes:\n    conversation_id: The optional conversation ID (UUID).\n    response: The response.\n    rag_chunks: List of RAG chunks used to generate the response.\n    referenced_documents: The URLs and titles for the documents used to generate the response.\n    tool_calls: List of tool calls made during response generation.",

2617-2645: Make doc_url required and non-null (or justify nullability)

For traceability, doc_url should typically be required and a URI. If nullability is intentional (e.g., offline sources), document that in markdown.

-                    "doc_url": {
-                        "anyOf": [
-                            {
-                                "type": "string",
-                                "minLength": 1,
-                                "format": "uri"
-                            },
-                            {
-                                "type": "null"
-                            }
-                        ],
-                        "title": "Doc Url",
-                        "description": "URL of the referenced document"
-                    },
+                    "doc_url": {
+                        "type": "string",
+                        "minLength": 1,
+                        "format": "uri",
+                        "title": "Doc Url",
+                        "description": "URL of the referenced document"
+                    },
...
-                "required": [
-                    "doc_title"
-                ],
+                "required": [
+                    "doc_url",
+                    "doc_title"
+                ],
docs/openapi.md (7)

565-566: Document the new field with a link and brief description

Mirror the JSON schema by referencing ConversationCacheConfiguration.

-| conversation_cache |  |  |
+| conversation_cache |  | Conversation cache settings (see ConversationCacheConfiguration) |

568-579: Clarify allowed values and sub-config selection

Add allowed type values and note only matching sub-config should be set.

-Conversation cache configuration.
+Conversation cache configuration.
+
+Allowed types: noop, memory, sqlite, postgres.
+Only the sub-configuration matching the selected type should be populated.

1129-1139: Remove TODOs from public docs

Same rationale as JSON schema: keep public docs clean.

-    TODO: truncated: Whether conversation history was truncated.
-    TODO: input_tokens: Number of tokens sent to LLM.
-    TODO: output_tokens: Number of tokens received from LLM.
-    TODO: available_quotas: Quota available as measured by all configured quota limiters
-    TODO: tool_results: List of tool results.

1141-1148: Specify type for tool_calls

Fill in the type to match the schema.

-| tool_calls |  | List of tool calls made during response generation |
+| tool_calls | array or null | List of tool calls made during response generation |

1156-1161: Add types for RAGChunk fields

Match the schema types.

-| source |  | Source document or URL |
-| score |  | Relevance score |
+| source | string or null | Source document or URL |
+| score | number or null | Relevance score |

1196-1210: Make doc_url type explicit and fix capitalization

Clarify “URL” and type.

-    doc_url: Url to the referenced doc.
+    doc_url: URL to the referenced document.
...
-| doc_url |  | URL of the referenced document |
+| doc_url | string (URI) or null | URL of the referenced document |

1278-1289: Specify type for ToolCall.result

Add “object or null”.

-| result |  | Result from the tool |
+| result | object or null | Result from the tool |
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 991c001 and 60ded47.

📒 Files selected for processing (3)
  • docs/openapi.json (7 hunks)
  • docs/openapi.md (5 hunks)
  • docs/output.md (5 hunks)
⏰ 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
🔇 Additional comments (1)
docs/openapi.json (1)

1165-1167: LGTM: configuration now exposes conversation_cache

New field correctly references ConversationCacheConfiguration and remains optional.

Comment on lines 154 to 162
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"response": "LLM answer"
"response": "LLM answer",
"referenced_documents": [
{
"doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
"doc_title": "Operator Lifecycle Manager (OLM)"
}
]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Invalid placement of example fields in response

The example fields are placed directly under 200, not under content.application/json.example. Move them to “example” within the media type.

                     "200": {
                         "description": "Successful Response",
                         "content": {
                             "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/QueryResponse"
-                                }
+                                "schema": {
+                                    "$ref": "#/components/schemas/QueryResponse"
+                                },
+                                "example": {
+                                    "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
+                                    "response": "LLM answer",
+                                    "referenced_documents": [
+                                        {
+                                            "doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
+                                            "doc_title": "Operator Lifecycle Manager (OLM)"
+                                        }
+                                    ]
+                                }
                             }
                         },
-                        "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
-                        "response": "LLM answer",
-                        "referenced_documents": [
-                            {
-                                "doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
-                                "doc_title": "Operator Lifecycle Manager (OLM)"
-                            }
-                        ]
                     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"response": "LLM answer"
"response": "LLM answer",
"referenced_documents": [
{
"doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
"doc_title": "Operator Lifecycle Manager (OLM)"
}
]
},
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryResponse"
},
"example": {
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"response": "LLM answer",
"referenced_documents": [
{
"doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
"doc_title": "Operator Lifecycle Manager (OLM)"
}
]
}
}
}
}
🤖 Prompt for AI Agents
In docs/openapi.json around lines 154 to 162, the response example JSON is
incorrectly placed directly under the HTTP 200 response object; move that
example into the media type path: add a content -> "application/json" -> example
(or examples) property and place the existing example object there, removing it
from the top-level 200 object so the OpenAPI response follows the structure: 200
-> description -> content -> "application/json" -> example.

@tisnik tisnik merged commit a32f966 into lightspeed-core:main Sep 26, 2025
18 of 19 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 6, 2025
15 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 9, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant