forked from lightspeed-core/lightspeed-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.feature
More file actions
218 lines (201 loc) · 10.7 KB
/
query.feature
File metadata and controls
218 lines (201 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
@Authorized
Feature: Query endpoint API tests
Background:
Given The service is started locally
And REST API service prefix is /v1
Scenario: Check if LLM responds properly to restrictive system prompt to sent question with different system prompt
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I capture the current token metrics
When I use "query" to ask question with authorization header
"""
{"query": "Generate sample yaml file for simple GitHub Actions workflow.", "system_prompt": "refuse to answer anything but openshift questions", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 200
And The response should contain following fragments
| Fragments in LLM response |
| ask |
And The token metrics should have increased
Scenario: Check if LLM responds properly to non-restrictive system prompt to sent question with different system prompt
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I capture the current token metrics
When I use "query" to ask question with authorization header
"""
{"query": "Generate sample yaml file for simple GitHub Actions workflow.", "system_prompt": "you are linguistic assistant", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 200
And The response should contain following fragments
| Fragments in LLM response |
| checkout |
And The response should contain token counter fields
And The token metrics should have increased
#enable on demand
@skip
Scenario: Check if LLM ignores new system prompt in same conversation
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Generate sample yaml file for simple GitHub Actions workflow.", "system_prompt": "refuse to answer anything but openshift questions", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 200
And I store conversation details
And I use "query" to ask question with same conversation_id
"""
{"query": "Write a simple code for reversing string", "system_prompt": "provide coding assistance", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 200
And The response should contain following fragments
| Fragments in LLM response |
| ask |
Scenario: Check if LLM responds to sent question with error when not authenticated
Given The system is in default state
When I use "query" to ask question
"""
{"query": "Write a simple code for reversing string", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 401
And The body of the response is the following
"""
{
"detail": {
"response": "Missing or invalid credentials provided by client",
"cause": "No Authorization header found"
}
}
"""
Scenario: Check if LLM responds to sent question with error when bearer token is missing
Given The system is in default state
And I set the Authorization header to Bearer
When I use "query" to ask question with authorization header
"""
{"query": "Write a simple code for reversing string", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 401
And The body of the response contains No token found in Authorization header
Scenario: Check if LLM responds to sent question with error when attempting to access conversation
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I capture the current token metrics
When I use "query" to ask question with authorization header
"""
{"conversation_id": "123e4567-e89b-12d3-a456-426614174000", "query": "Write a simple code for reversing string", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 404
And The body of the response contains Conversation not found
And The token metrics should not have changed
Scenario: Check if LLM responds to sent question with error when attempting to access conversation with incorrect conversation ID format
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"conversation_id": "123e4567", "query": "Write a simple code for reversing string", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 422
And The body of the response contains Value error, Improper conversation ID '123e4567'
Scenario: Check if LLM responds for query request with error for missing query
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"conversation_id": "123e4567", "query": "Write a simple code for reversing string", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 422
And The body of the response contains Value error, Improper conversation ID '123e4567'
Scenario: Check if LLM responds for query request with error for missing query
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I capture the current token metrics
When I use "query" to ask question with authorization header
"""
{"provider": "{PROVIDER}"}
"""
Then The status code of the response is 422
And The body of the response is the following
"""
{ "detail": [{"type": "missing", "loc": [ "body", "query" ], "msg": "Field required", "input": {"provider": "{PROVIDER}"}}] }
"""
And The token metrics should not have changed
Scenario: Check if LLM responds for query request for missing model and provider
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
Then The status code of the response is 200
Scenario: Check if LLM responds for query request with error for missing model
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Say hello", "provider": "{PROVIDER}"}
"""
Then The status code of the response is 422
And The body of the response contains Value error, Model must be specified if provider is specified
Scenario: Check if LLM responds for query request with error for missing provider
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Say hello", "model": "{MODEL}"}
"""
Then The status code of the response is 422
And The body of the response contains Value error, Provider must be specified if model is specified
Scenario: Check if LLM responds for query request with error for unknown model
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Say hello", "provider": "{PROVIDER}", "model":"unknown"}
"""
Then The status code of the response is 404
And The body of the response contains Model with ID unknown does not exist
Scenario: Check if LLM responds for query request with error for unknown provider
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{"query": "Say hello", "model": "{MODEL}", "provider":"unknown"}
"""
Then The status code of the response is 404
And The body of the response contains Model with ID gpt-4o-mini does not exist
@skip-in-library-mode
Scenario: Check if LLM responds for query request with error for inability to connect to llama-stack
Given The system is in default state
And The llama-stack connection is disrupted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I capture the current token metrics
When I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
And The token metrics should not have changed
Scenario: Check if LLM responds properly when XML and JSON attachments are sent
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "query" to ask question with authorization header
"""
{
"query": "Say hello",
"attachments": [
{
"attachment_type": "configuration",
"content": "<note><to>User</to><from>System</from><message>Hello</message></note>",
"content_type": "application/xml"
},
{
"attachment_type": "configuration",
"content": "{\"foo\": \"bar\"}",
"content_type": "application/json"
}
],
"model": "{MODEL}",
"provider": "{PROVIDER}",
"system_prompt": "You are a helpful assistant"
}
"""
Then The status code of the response is 200