Skip to content

Commit dc792e9

Browse files
committed
Implement CodeRabbit's feedback
1 parent 075c629 commit dc792e9

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

src/app/endpoints/query.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@
7878
}
7979
],
8080
},
81-
400: {
81+
401: {
8282
"description": "Missing or invalid credentials provided by client",
8383
"model": UnauthorizedResponse,
8484
},
8585
403: {
8686
"description": "User is not authorized",
8787
"model": ForbiddenResponse,
8888
},
89+
404: {
90+
"description": "Requested model or provider not found",
91+
},
8992
500: {
9093
"detail": {
9194
"response": "Unable to connect to Llama Stack",

tests/e2e/features/query.feature

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,47 @@ Feature: Query endpoint API tests
5959
{"detail": "No Authorization header found"}
6060
"""
6161

62-
Scenario: Check if LLM responds to sent question with error when not authenticated with invalid token
62+
Scenario: Check if LLM responds to sent question with error when authenticated with invalid token
63+
Given The service is started locally
64+
And REST API service prefix is /v1
6365
Given The system is in default state
6466
And I set the Authorization header to Bearer invalid
6567
When I use "query" to ask question with authorization header
66-
"""
67-
{"query": "Write a simple code for reversing string"}
68-
"""
69-
Then The status code of the response is 401
70-
And The body of the response is the following
71-
"""
72-
{"detail":"Invalid token: decode error"}
73-
"""
68+
"""
69+
{"query": "Write a simple code for reversing string"}
70+
"""
71+
Then The status code of the response is 401
72+
And The body of the response is the following
73+
"""
74+
{"detail":"Invalid token: decode error"}
75+
"""
7476

7577
Scenario: Check if LLM responds to sent question with error when model does not exist
78+
Given The service is started locally
79+
And REST API service prefix is /v1
7680
Given The system is in default state
7781
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
7882
When I use "query" to ask question with authorization header
79-
"""
80-
{"query": "Write a simple code for reversing string", "model": "does-not-exist", "provider": "does-not-exist"}
81-
"""
82-
Then The status code of the response is 404
83-
And The body of the response contains Model does-not-exist from provider does-not-exist not found in available models
84-
83+
"""
84+
{"query": "Write a simple code for reversing string", "model": "does-not-exist", "provider": "does-not-exist"}
85+
"""
86+
Then The status code of the response is 404
87+
And The body of the response contains Model does-not-exist from provider does-not-exist not found in available models
8588

8689
Scenario: Check if LLM responds to sent question with error when attempting to access conversation
90+
Given The service is started locally
91+
And REST API service prefix is /v1
8792
Given The system is in default state
88-
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
89-
When I use "query" to ask question with authorization header
90-
"""
91-
{"conversation_id": "123e4567-e89b-12d3-a456-426614174000", "query": "Write a simple code for reversing string"}
92-
"""
93-
Then The status code of the response is 404
94-
And The body of the response contains Conversation not found
93+
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
94+
When I use "query" to ask question with authorization header
95+
"""
96+
{"conversation_id": "123e4567-e89b-12d3-a456-426614174000", "query": "Write a simple code for reversing string"}
97+
"""
98+
Then The status code of the response is 404
99+
And The body of the response contains Conversation not found
100+
101+
Scenario: Check if LLM responds for query request with error for missing query
95102

96-
Scenario: Check if LLM responds for query request with error for missing query
97103
Given The system is in default state
98104
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
99105
When I use "query" to ask question with authorization header

0 commit comments

Comments
 (0)