Skip to content

Commit 584cd25

Browse files
authored
Merge pull request #762 from asimurka/fix_403_error_descriptions
LCORE-757: Fixed 403 error descriptions for queries and feedback
2 parents ab002e0 + a133b77 commit 584cd25

File tree

5 files changed

+113
-133
lines changed

5 files changed

+113
-133
lines changed

docs/openapi.json

Lines changed: 110 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
"query"
325325
],
326326
"summary": "Query Endpoint Handler",
327-
"description": "Handle request to the /query endpoint.\n\nProcesses a POST request to the /query endpoint, forwarding the\nuser's query to a selected Llama Stack LLM or agent and\nreturning the generated response.\n\nValidates configuration and authentication, selects the appropriate model\nand provider, retrieves the LLM response, updates metrics, and optionally\nstores a transcript of the interaction. Handles connection errors to the\nLlama Stack service by returning an HTTP 500 error.\n\nReturns:\n QueryResponse: Contains the conversation ID and the LLM-generated response.",
327+
"description": "Handle request to the /query endpoint using Agent API.\n\nThis is a wrapper around query_endpoint_handler_base that provides\nthe Agent API specific retrieve_response and get_topic_summary functions.\n\nReturns:\n QueryResponse: Contains the conversation ID and the LLM-generated response.",
328328
"operationId": "query_endpoint_handler_v1_query_post",
329329
"requestBody": {
330330
"content": {
@@ -366,7 +366,7 @@
366366
}
367367
},
368368
"403": {
369-
"description": "User is not authorized",
369+
"description": "Client does not have permission to access conversation",
370370
"content": {
371371
"application/json": {
372372
"schema": {
@@ -452,7 +452,7 @@
452452
}
453453
},
454454
"403": {
455-
"description": "User is not authorized",
455+
"description": "Client does not have permission to access conversation",
456456
"content": {
457457
"application/json": {
458458
"schema": {
@@ -631,7 +631,7 @@
631631
"operationId": "feedback_status_v1_feedback_status_get",
632632
"responses": {
633633
"200": {
634-
"description": "Successful Response",
634+
"description": "Feedback status successfully retrieved",
635635
"content": {
636636
"application/json": {
637637
"schema": {
@@ -661,7 +661,7 @@
661661
},
662662
"responses": {
663663
"200": {
664-
"description": "Successful Response",
664+
"description": "Feedback status successfully updated",
665665
"content": {
666666
"application/json": {
667667
"schema": {
@@ -670,6 +670,26 @@
670670
}
671671
}
672672
},
673+
"401": {
674+
"description": "Missing or invalid credentials provided by client",
675+
"content": {
676+
"application/json": {
677+
"schema": {
678+
"$ref": "#/components/schemas/UnauthorizedResponse"
679+
}
680+
}
681+
}
682+
},
683+
"403": {
684+
"description": "Client does not have permission to access resource",
685+
"content": {
686+
"application/json": {
687+
"schema": {
688+
"$ref": "#/components/schemas/ForbiddenResponse"
689+
}
690+
}
691+
}
692+
},
673693
"422": {
674694
"description": "Validation Error",
675695
"content": {
@@ -1179,6 +1199,83 @@
11791199
}
11801200
}
11811201
},
1202+
"/v2/query": {
1203+
"post": {
1204+
"tags": [
1205+
"query_v2"
1206+
],
1207+
"summary": "Query Endpoint Handler V2",
1208+
"description": "Handle request to the /query endpoint using Responses API.\n\nThis is a wrapper around query_endpoint_handler_base that provides\nthe Responses API specific retrieve_response and get_topic_summary functions.\n\nReturns:\n QueryResponse: Contains the conversation ID and the LLM-generated response.",
1209+
"operationId": "query_endpoint_handler_v2_v2_query_post",
1210+
"requestBody": {
1211+
"content": {
1212+
"application/json": {
1213+
"schema": {
1214+
"$ref": "#/components/schemas/QueryRequest"
1215+
}
1216+
}
1217+
},
1218+
"required": true
1219+
},
1220+
"responses": {
1221+
"200": {
1222+
"description": "Successful Response",
1223+
"content": {
1224+
"application/json": {
1225+
"schema": {
1226+
"$ref": "#/components/schemas/QueryResponse"
1227+
}
1228+
}
1229+
},
1230+
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
1231+
"response": "LLM answer",
1232+
"referenced_documents": [
1233+
{
1234+
"doc_url": "https://docs.openshift.com/container-platform/4.15/operators/olm/index.html",
1235+
"doc_title": "Operator Lifecycle Manager (OLM)"
1236+
}
1237+
]
1238+
},
1239+
"400": {
1240+
"description": "Missing or invalid credentials provided by client",
1241+
"content": {
1242+
"application/json": {
1243+
"schema": {
1244+
"$ref": "#/components/schemas/UnauthorizedResponse"
1245+
}
1246+
}
1247+
}
1248+
},
1249+
"403": {
1250+
"description": "Client does not have permission to access conversation",
1251+
"content": {
1252+
"application/json": {
1253+
"schema": {
1254+
"$ref": "#/components/schemas/ForbiddenResponse"
1255+
}
1256+
}
1257+
}
1258+
},
1259+
"500": {
1260+
"description": "Internal Server Error",
1261+
"detail": {
1262+
"response": "Unable to connect to Llama Stack",
1263+
"cause": "Connection error."
1264+
}
1265+
},
1266+
"422": {
1267+
"description": "Validation Error",
1268+
"content": {
1269+
"application/json": {
1270+
"schema": {
1271+
"$ref": "#/components/schemas/HTTPValidationError"
1272+
}
1273+
}
1274+
}
1275+
}
1276+
}
1277+
}
1278+
},
11821279
"/readiness": {
11831280
"get": {
11841281
"tags": [
@@ -1436,7 +1533,7 @@
14361533
}
14371534
]
14381535
},
1439-
"AuthenticationConfiguration-Input": {
1536+
"AuthenticationConfiguration": {
14401537
"properties": {
14411538
"module": {
14421539
"type": "string",
@@ -1476,7 +1573,7 @@
14761573
"jwk_config": {
14771574
"anyOf": [
14781575
{
1479-
"$ref": "#/components/schemas/JwkConfiguration-Input"
1576+
"$ref": "#/components/schemas/JwkConfiguration"
14801577
},
14811578
{
14821579
"type": "null"
@@ -1489,75 +1586,7 @@
14891586
"title": "AuthenticationConfiguration",
14901587
"description": "Authentication configuration."
14911588
},
1492-
"AuthenticationConfiguration-Output": {
1493-
"properties": {
1494-
"module": {
1495-
"type": "string",
1496-
"title": "Module",
1497-
"default": "noop"
1498-
},
1499-
"skip_tls_verification": {
1500-
"type": "boolean",
1501-
"title": "Skip Tls Verification",
1502-
"default": false
1503-
},
1504-
"k8s_cluster_api": {
1505-
"anyOf": [
1506-
{
1507-
"type": "string",
1508-
"minLength": 1,
1509-
"format": "uri"
1510-
},
1511-
{
1512-
"type": "null"
1513-
}
1514-
],
1515-
"title": "K8S Cluster Api"
1516-
},
1517-
"k8s_ca_cert_path": {
1518-
"anyOf": [
1519-
{
1520-
"type": "string",
1521-
"format": "file-path"
1522-
},
1523-
{
1524-
"type": "null"
1525-
}
1526-
],
1527-
"title": "K8S Ca Cert Path"
1528-
},
1529-
"jwk_config": {
1530-
"anyOf": [
1531-
{
1532-
"$ref": "#/components/schemas/JwkConfiguration-Output"
1533-
},
1534-
{
1535-
"type": "null"
1536-
}
1537-
]
1538-
}
1539-
},
1540-
"additionalProperties": false,
1541-
"type": "object",
1542-
"title": "AuthenticationConfiguration",
1543-
"description": "Authentication configuration."
1544-
},
1545-
"AuthorizationConfiguration-Input": {
1546-
"properties": {
1547-
"access_rules": {
1548-
"items": {
1549-
"$ref": "#/components/schemas/AccessRule"
1550-
},
1551-
"type": "array",
1552-
"title": "Access Rules"
1553-
}
1554-
},
1555-
"additionalProperties": false,
1556-
"type": "object",
1557-
"title": "AuthorizationConfiguration",
1558-
"description": "Authorization configuration."
1559-
},
1560-
"AuthorizationConfiguration-Output": {
1589+
"AuthorizationConfiguration": {
15611590
"properties": {
15621591
"access_rules": {
15631592
"items": {
@@ -1753,12 +1782,12 @@
17531782
"title": "Mcp Servers"
17541783
},
17551784
"authentication": {
1756-
"$ref": "#/components/schemas/AuthenticationConfiguration-Output"
1785+
"$ref": "#/components/schemas/AuthenticationConfiguration"
17571786
},
17581787
"authorization": {
17591788
"anyOf": [
17601789
{
1761-
"$ref": "#/components/schemas/AuthorizationConfiguration-Output"
1790+
"$ref": "#/components/schemas/AuthorizationConfiguration"
17621791
},
17631792
{
17641793
"type": "null"
@@ -2717,7 +2746,7 @@
27172746
"title": "JsonPathOperator",
27182747
"description": "Supported operators for JSONPath evaluation."
27192748
},
2720-
"JwkConfiguration-Input": {
2749+
"JwkConfiguration": {
27212750
"properties": {
27222751
"url": {
27232752
"type": "string",
@@ -2726,7 +2755,7 @@
27262755
"title": "Url"
27272756
},
27282757
"jwt_configuration": {
2729-
"$ref": "#/components/schemas/JwtConfiguration-Input"
2758+
"$ref": "#/components/schemas/JwtConfiguration"
27302759
}
27312760
},
27322761
"additionalProperties": false,
@@ -2737,52 +2766,7 @@
27372766
"title": "JwkConfiguration",
27382767
"description": "JWK configuration."
27392768
},
2740-
"JwkConfiguration-Output": {
2741-
"properties": {
2742-
"url": {
2743-
"type": "string",
2744-
"minLength": 1,
2745-
"format": "uri",
2746-
"title": "Url"
2747-
},
2748-
"jwt_configuration": {
2749-
"$ref": "#/components/schemas/JwtConfiguration-Output"
2750-
}
2751-
},
2752-
"additionalProperties": false,
2753-
"type": "object",
2754-
"required": [
2755-
"url"
2756-
],
2757-
"title": "JwkConfiguration",
2758-
"description": "JWK configuration."
2759-
},
2760-
"JwtConfiguration-Input": {
2761-
"properties": {
2762-
"user_id_claim": {
2763-
"type": "string",
2764-
"title": "User Id Claim",
2765-
"default": "user_id"
2766-
},
2767-
"username_claim": {
2768-
"type": "string",
2769-
"title": "Username Claim",
2770-
"default": "username"
2771-
},
2772-
"role_rules": {
2773-
"items": {
2774-
"$ref": "#/components/schemas/JwtRoleRule"
2775-
},
2776-
"type": "array",
2777-
"title": "Role Rules"
2778-
}
2779-
},
2780-
"additionalProperties": false,
2781-
"type": "object",
2782-
"title": "JwtConfiguration",
2783-
"description": "JWT configuration."
2784-
},
2785-
"JwtConfiguration-Output": {
2769+
"JwtConfiguration": {
27862770
"properties": {
27872771
"user_id_claim": {
27882772
"type": "string",

src/app/endpoints/feedback.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454
"description": "Feedback status successfully updated",
5555
"model": FeedbackStatusUpdateResponse,
5656
},
57-
400: {
58-
"description": "Missing or invalid credentials provided by client",
59-
"model": UnauthorizedResponse,
60-
},
6157
401: {
6258
"description": "Missing or invalid credentials provided by client",
6359
"model": UnauthorizedResponse,

src/app/endpoints/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"model": UnauthorizedResponse,
8484
},
8585
403: {
86-
"description": "User is not authorized",
86+
"description": "Client does not have permission to access conversation",
8787
"model": ForbiddenResponse,
8888
},
8989
500: {

src/app/endpoints/query_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"model": UnauthorizedResponse,
5757
},
5858
403: {
59-
"description": "User is not authorized",
59+
"description": "Client does not have permission to access conversation",
6060
"model": ForbiddenResponse,
6161
},
6262
500: {

src/app/endpoints/streaming_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"model": UnauthorizedResponse,
102102
},
103103
403: {
104-
"description": "User is not authorized",
104+
"description": "Client does not have permission to access conversation",
105105
"model": ForbiddenResponse,
106106
},
107107
500: {

0 commit comments

Comments
 (0)