-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathconversations.feature
More file actions
174 lines (162 loc) · 7.93 KB
/
conversations.feature
File metadata and controls
174 lines (162 loc) · 7.93 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
@Authorized
Feature: conversations endpoint API tests
Background:
Given The service is started locally
And REST API service prefix is /v1
Scenario: Check if conversations endpoint finds the correct conversation when it exists
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
When I access REST API endpoint "conversations" using HTTP GET method
Then The status code of the response is 200
And The conversation with conversation_id from above is returned
And The conversation details are following
"""
{"last_used_model": "{MODEL}", "last_used_provider": "{PROVIDER}", "message_count": 1}
"""
Scenario: Check if conversations endpoint fails when the auth header is not present
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
And I remove the auth header
When I access REST API endpoint "conversations" using HTTP GET method
Then The status code of the response is 401
And The body of the response is the following
"""
{
"detail": "No Authorization header found"
}
"""
Scenario: Check if conversations/{conversation_id} endpoint finds the correct conversation when it exists
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 200
And The returned conversation details have expected conversation_id
And The body of the response has following messages
"""
{"content": "Say hello", "type": "user", "content_response": "Hello", "type_response": "assistant"}
"""
And The body of the response has the following schema
"""
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"conversation_id": { "type": "string" },
"chat_history": {
"type": "array",
"items": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": { "type": "string" },
"type": { "type": "string", "enum": ["user", "assistant"] }
}
}
},
"started_at": { "type": "string", "format": "date-time" },
"completed_at": { "type": "string", "format": "date-time" }
}
}
}
}
}
"""
Scenario: Check if conversations/{conversation_id} endpoint fails when the auth header is not present
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
And I remove the auth header
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 401
And The body of the response is the following
"""
{
"detail": "No Authorization header found"
}
"""
Scenario: Check if conversations/{conversation_id} GET endpoint fails when conversation_id is malformed
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use REST API conversation endpoint with conversation_id "abcdef" using HTTP GET method
Then The status code of the response is 400
Scenario: Check if conversations/{conversation_id} GET endpoint fails when llama-stack is unavailable
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Check if conversations DELETE endpoint removes the correct conversation
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
When I use REST API conversation endpoint with conversation_id from above using HTTP DELETE method
Then The status code of the response is 200
And The returned conversation details have expected conversation_id
And The body of the response, ignoring the "conversation_id" field, is the following
"""
{"success": true, "response": "Conversation deleted successfully"}
"""
And I use REST API conversation endpoint with conversation_id from above using HTTP GET method
And The status code of the response is 404
Scenario: Check if conversations/{conversation_id} DELETE endpoint fails when conversation_id is malformed
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use REST API conversation endpoint with conversation_id "abcdef" using HTTP DELETE method
Then The status code of the response is 400
Scenario: Check if conversations DELETE endpoint fails when the conversation does not exist
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use REST API conversation endpoint with conversation_id "12345678-abcd-0000-0123-456789abcdef" using HTTP DELETE method
Then The status code of the response is 404
Scenario: Check if conversations/{conversation_id} DELETE endpoint fails when llama-stack is unavailable
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack