-
Notifications
You must be signed in to change notification settings - Fork 99
LCORE-3047: Snuryyeva/okp rag #2497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
822e774
a7d40d4
b870f99
a59edea
3a070be
b5add51
cadd731
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| @cfg_okp @skip | ||
| Feature: OKP(Solr) RAG retrieval tests | ||
|
|
||
| # Offline Knowledge Portal (OKP) provides a Solr-backed RAG source to LSC. | ||
| # Tests verify that Lightspeed Stack can use OKP for both Inline RAG | ||
| # (context injected before the LLM request) and Tool RAG (context | ||
| # retrieved on demand via file_search), in both offline and online modes. | ||
|
|
||
| Background: | ||
| Given The service is started locally | ||
| And The system is in default state | ||
| And OKP(Solr) server is running | ||
| And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Remove the hardcoded Bearer token. Line 13 adds a token literal to a feature file. Load the test credential through the E2E secret-injection mechanism instead. As per coding guidelines, flag “secrets or tokens logged in plaintext or hardcoded in source.” 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| And REST API service prefix is /v1 | ||
| And the Lightspeed stack configuration directory is "tests/e2e/configuration" | ||
|
|
||
| # ── Inline RAG — Query (offline) ── | ||
|
|
||
| Scenario: Offline mode query with inline RAG returns rag_chunks and referenced_documents | ||
| Given The service uses the lightspeed-stack-okp-offline.yaml configuration | ||
| And The service is restarted | ||
| When I use "query" to ask question with authorization header | ||
| """ | ||
| {"query": "configure remote desktop using gnome", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The response contains non-empty rag_chunks | ||
| And The response contains non-empty referenced_documents | ||
| And The number of rag_chunk returned is 1 | ||
| And Each rag_chunk has a non-empty score | ||
| And Each rag_chunk source is "okp" | ||
| And Each referenced_document has fields doc_url, doc_title, source, and document_id | ||
| And The number of eferenced_document returned is 1 | ||
| And Each referenced_document doc_url contains "localhost:8081" | ||
| And Each referenced_document doc_title is not empty | ||
| And Each referenced_document source is "okp" | ||
| And Each referenced_document has a non-empty document_id | ||
|
|
||
| # ── Inline RAG — Streaming Query (online) ── | ||
|
|
||
| Scenario: Online mode streaming query with inline RAG returns referenced_documents | ||
| Given The service uses the lightspeed-stack-okp-online.yaml configuration | ||
| And The service is restarted | ||
| When I use "streaming_query" to ask question with authorization header | ||
| """ | ||
| {"query": "configure remote desktop using gnome", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And I wait for the response to be completed | ||
| And The response contains non-empty referenced_documents | ||
| And Each referenced_document has fields doc_url, doc_title, source, and document_id | ||
| And The number of eferenced_document returned is 3 | ||
| And Each referenced_document doc_url contains "docs.redhat.com" | ||
| And Each referenced_document doc_title is not empty | ||
| And Each referenced_document doc_title contains "openshift container platform 4.21" | ||
| And Each referenced_document source is "okp" | ||
| And Each referenced_document has a non-empty document_id | ||
|
|
||
| # ── Inline RAG — Query with Dynamic Filter ── | ||
|
|
||
| Scenario: Query with inline RAG with dynamic semantic filter returns rag_chunks and referenced_documents | ||
| Given The service uses the lightspeed-stack-okp-offline.yaml configuration | ||
| And The service is restarted | ||
| When I use "query" to ask question with authorization header | ||
| """ | ||
| {"query": "Security best practices", | ||
| "solr": { | ||
| "mode": "semantic", | ||
| "filters": { | ||
| "filters": { | ||
| "type": "in", | ||
| "key": "product", | ||
| "value": ["openshift_container_platform", "ansible_automation_platform", "red_hat_enterprise_linux"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The response contains "security best practices" | ||
| And The response contains non-empty rag_chunks | ||
| And The response contains non-empty referenced_documents | ||
| And The number of rag_chunk returned is 1 | ||
| And Each rag_chunk has a non-empty score | ||
| And Each rag_chunk source is "okp" | ||
| And Each referenced_document has fields doc_url, doc_title, source, and document_id | ||
| And The number of eferenced_document returned is 1 | ||
| And Each referenced_document doc_url contains "localhost:8081" | ||
| And Each referenced_document doc_title is not empty | ||
| And Each referenced_document source is "okp" | ||
| And Each referenced_document has a non-empty document_id | ||
|
|
||
| # ── Tool RAG — Query API (offline) ── | ||
|
|
||
| Scenario: Offline query API with OKP tool RAG has rag_chunk and referenced_documents returned | ||
| Given The service uses the lightspeed-stack-okp-tool-offline.yaml configuration | ||
| And The service is restarted | ||
| When I use "query" to ask question with authorization header | ||
| """ | ||
| { | ||
| "query": "Troubleshooting guide", | ||
| "model": "{MODEL}", | ||
| "provider": "{PROVIDER}", | ||
| "system_prompt": "You MUST use the file_search tool to answer." | ||
| } | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The response contains non-empty tool_calls | ||
| And A tool_call has name "file_search" | ||
| And The response contains non-empty rag_chunks | ||
| And The number of rag_chunk returned is 2 | ||
| And Each rag_chunk has a non-empty score | ||
| And Each rag_chunk source is "okp" | ||
| And The response contains non-empty referenced_documents | ||
| And Each referenced_document has fields doc_url, doc_title, source, and document_id | ||
| And Each referenced_document doc_url contains "localhost:8081" | ||
| And Each referenced_document doc_title is not empty | ||
| And Each referenced_document source is "okp" | ||
| And Each referenced_document has a non-empty document_id | ||
|
|
||
| # ── Tool RAG — Responses API (online) ── | ||
|
|
||
| Scenario: Online responses API with OKP tool RAG has rag results returned | ||
| Given The service uses the lightspeed-stack-okp-tool-online.yaml configuration | ||
| And The service is restarted | ||
| When I use "responses" to ask question with authorization header | ||
| """ | ||
| { | ||
| "input": "Troubleshooting guide", | ||
| "model": "{PROVIDER}/{MODEL}", | ||
| "stream": false, | ||
| "instructions": "You MUST use the file_search tool to answer." | ||
| } | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The responses output includes an item with type "file_search_call" | ||
| And The response contains non-empty tool_calls | ||
| And A tool_call has type "file_search" | ||
| And The response contains non-empty results | ||
| And The number of results returned is 3 | ||
| And Each rag_chunk has a non-empty score | ||
| And Each rag_chunk source is "okp" | ||
| And Each rag_chunk reference_url contains "access.redhat.com" | ||
|
|
||
| # ── OKP Server Unavailable — Graceful Error Handling ── | ||
|
|
||
| Scenario: Query succeeds with empty rag_chunks when OKP server is unavailable | ||
| Given The service uses the lightspeed-stack-okp-online.yaml configuration | ||
| And The service is restarted | ||
| And The OKP(Solr) server is stopped | ||
| When I use "query" to ask question with authorization header | ||
| """ | ||
| {"query": "configure remote desktop using gnome", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The response contains no rag_chunks | ||
| And The response contains no referenced_documents | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,3 +279,25 @@ Scenario: Check if LLM responds for query request with error for missing query | |
| When I use "query" to ask question with too-long query and authorization header | ||
| Then The status code of the response is 413 | ||
| And The body of the response contains Prompt is too long | ||
|
|
||
| # # ── OKP RAG Disabled (okp not in rag.retrieval.inline.sources) ───── | ||
| @cfg_okp | ||
| @skip | ||
| Scenario: Query returns no rag_chunks and no reference_documents when OKP OKP is disabled | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these tests might become a problem if the test RAG is extended, since e2e-test-docs is connected in these tests. |
||
| When I use "query" to ask question with authorization header | ||
| """ | ||
| {"query": "configure remote desktop using gnome", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And The response contains no rag_chunks | ||
| And The response contains no referenced_documents | ||
| @cfg_okp | ||
| @skip | ||
| Scenario: Streaming query returns no referenced_documents when OKP is disabled | ||
| When I use "streaming_query" to ask question with authorization header | ||
| """ | ||
| {"query": "configure remote desktop using gnome", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
| And I wait for the response to be completed | ||
| And The response contains no referenced_documents | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 32725
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 30113
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 50389
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 38111
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 4620
Add the missing OKP fixtures before enabling the tests.
@skipsuppresses all scenarios intests/e2e/features/okp_rag.featureand both OKP-disabled scenarios intests/e2e/features/query.feature. The five referenced OKP YAML files are absent fromtests/e2e/configuration; removing@skipalone makes configuration loading fail. Add or provide the fixtures, then remove the skips and retain@cfg_okp.📍 Affects 2 files
tests/e2e/features/okp_rag.feature#L1-L1(this comment)tests/e2e/features/query.feature#L284-L307🤖 Prompt for AI Agents