Skip to content

Commit cda64ae

Browse files
are-cesclaude
andcommitted
LCORE-1422: Add streaming and responses API inline RAG e2e tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ee3a48f commit cda64ae

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

tests/e2e/features/inline_rag.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,28 @@ Feature: Inline RAG (BYOK) support tests
4141
"""
4242
Then The status code of the response is 200
4343
And The response should contain non-empty referenced_documents
44+
45+
Scenario: Streaming query with inline RAG returns relevant content
46+
Given The system is in default state
47+
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
48+
When I use "streaming_query" to ask question with authorization header
49+
"""
50+
{"query": "What is the title of the article from Paul?", "system_prompt": "You are an assistant. Write only lowercase letters"}
51+
"""
52+
Then The status code of the response is 200
53+
And I wait for the response to be completed
54+
And The streamed response should contain following fragments
55+
| Fragments in LLM response |
56+
| great work |
57+
58+
Scenario: Responses API with inline RAG returns relevant content
59+
Given The system is in default state
60+
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
61+
When I use "responses" to ask question with authorization header
62+
"""
63+
{"input": "What is the title of the article from Paul?", "model": "{PROVIDER}/{MODEL}", "stream": false, "instructions": "You are an assistant. Write only lowercase letters"}
64+
"""
65+
Then The status code of the response is 200
66+
And The response should contain following fragments
67+
| Fragments in LLM response |
68+
| great work |

tests/e2e/features/steps/llm_query_response.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,21 @@ def check_fragments_in_response(context: Context) -> None:
173173
"""
174174
assert context.response is not None
175175
response_json = context.response.json()
176-
response = response_json["response"]
176+
177+
# Support both query endpoint format (response field) and responses API format (output array)
178+
if "response" in response_json:
179+
response = response_json["response"]
180+
else:
181+
# Responses API format: extract text from output messages
182+
response = " ".join(
183+
part.get("text", "")
184+
for item in response_json.get("output", [])
185+
if item.get("type") == "message"
186+
for part in (
187+
item.get("content") if isinstance(item.get("content"), list) else []
188+
)
189+
if part.get("type") == "output_text"
190+
)
177191

178192
assert context.table is not None, "Fragments are not specified in table"
179193

0 commit comments

Comments
 (0)